# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
7363 |
2014-08-03T15:06:08 Z |
tncks0121 |
경비원 (GA8_guard) |
C++ |
|
192 ms |
20444 KB |
#include <cstdio>
using namespace std;
int gcd (int a, int b) { return b == 0 ? a : gcd(b, a%b); }
int n, a[2225], g[2225][2225], w[2225], c;
bool used[2225];
int res;
void solve (int x) {
if(x == n) {
for(int i = 0; i < c; i++) {
for(int j = i+1; j < c; j++) {
if(gcd(a[i], a[j]) > 1) return;
}
}
++res;
return;
}
w[c++] = x;
solve(x+1);
w[--c] = 0;
}
int main() {
scanf("%d", &n);
for(int i = 0; i < n; i++) scanf("%d", a+i);
for(int i = 0; i < n; i++) {
for(int j = i+1; j < n; j++) {
g[i][j] = g[j][i] = gcd(a[i], a[j]);
}
}
solve(0);
res -= n+1;
printf("%d\n", res);
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
20444 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
20444 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
96 ms |
20444 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
192 ms |
20444 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
188 ms |
20444 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |