Skip to content

Commit 429adf5

Browse files
committed
[codeforces - 1316] Add C++ solution for C. Primitive Primes.
1 parent 639499d commit 429adf5

File tree

6 files changed

+35
-0
lines changed

6 files changed

+35
-0
lines changed

codeforces/1316/c-1.ans

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1

codeforces/1316/c-1.in

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
3 2 2
2+
1 1 2
3+
2 1

codeforces/1316/c-2.ans

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0

codeforces/1316/c-2.in

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2 2 999999937
2+
2 1
3+
3 1

codeforces/1316/c.cc

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// https://codeforces.com/contest/1316/problem/C
2+
#include <bits/stdc++.h>
3+
4+
using namespace std;
5+
using ll = long long;
6+
using ii = tuple<int, int>;
7+
using vi = vector<ll>;
8+
using vii = vector<ii>;
9+
using vvi = vector<vi>;
10+
using si = set<ll>;
11+
12+
int main() {
13+
cin.tie(0), ios::sync_with_stdio(0);
14+
ll n, m, p, a, b;
15+
cin >> n >> m >> p;
16+
int k = -1, l = -1;
17+
for (int i=0; i<n; i++) {
18+
cin >> a;
19+
if (a%p != 0 && k < 0) k=i;
20+
}
21+
for (int j=0; j<m; j++) {
22+
cin >> b;
23+
if (b%p != 0 && l < 0) l=j;
24+
}
25+
cout << k+l << endl;
26+
}

codeforces/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
There are solutions for the following [codeforces](http://codeforces.com/) problems:
44

55
### Contests ([problemset site](https://codeforces.com/problemset))
6+
1. [1316C - Primitive Primes](1316/c.cc) ([problem site](https://codeforces.com/contest/1316/problem/C))
67
1. [1316B - String Modification](1316/b.cc) ([problem site](https://codeforces.com/contest/1316/problem/B))
78
1. [1316A - Grade Allocation](1316/a.cc) ([problem site](https://codeforces.com/contest/1316/problem/A))
89
1. [1315C - Restoring Permutation](1315/c.cc) ([problem site](https://codeforces.com/contest/1315/problem/C))

0 commit comments

Comments
 (0)