# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
429697 | 2021-06-16T08:48:03 Z | 조영욱(#7653) | GCD-sum (CPSPC17_gcds) | C++17 | 2000 ms | 1100 KB |
#include <bits/stdc++.h> using namespace std; int n; int arr[7]; int ret[8]; int gcd(int a,int b) { return b==0?a:gcd(b,a%b); } void func(vector<int> v,int ind) { if (ind==n) { set<int> s; int temp[8]; memset(temp,0,sizeof(temp)); for(int i=0;i<v.size();i++) { s.insert(v[i]); temp[v[i]]=gcd(arr[i],temp[v[i]]); } int sum=0; for(int i=1;i<=n;i++) { sum+=temp[i]; } ret[s.size()]=max(ret[s.size()],sum); return; } for(int i=1;i<=n;i++) { v[ind]=i; func(v,ind+1); } } int main(void){ scanf("%d",&n); for(int i=0;i<n;i++) { scanf("%d",&arr[i]); } vector<int> v(n); func(v,0); for(int i=1;i<=n;i++) { printf("%d\n",ret[i]); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 282 ms | 272 KB | Output is correct |
2 | Correct | 264 ms | 268 KB | Output is correct |
3 | Correct | 288 ms | 268 KB | Output is correct |
4 | Correct | 316 ms | 272 KB | Output is correct |
5 | Correct | 282 ms | 272 KB | Output is correct |
6 | Correct | 361 ms | 204 KB | Output is correct |
7 | Correct | 313 ms | 204 KB | Output is correct |
8 | Correct | 300 ms | 264 KB | Output is correct |
9 | Correct | 331 ms | 268 KB | Output is correct |
10 | Correct | 257 ms | 268 KB | Output is correct |
11 | Correct | 276 ms | 264 KB | Output is correct |
12 | Correct | 309 ms | 268 KB | Output is correct |
13 | Correct | 283 ms | 268 KB | Output is correct |
14 | Correct | 282 ms | 268 KB | Output is correct |
15 | Correct | 267 ms | 204 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 282 ms | 272 KB | Output is correct |
2 | Correct | 264 ms | 268 KB | Output is correct |
3 | Correct | 288 ms | 268 KB | Output is correct |
4 | Correct | 316 ms | 272 KB | Output is correct |
5 | Correct | 282 ms | 272 KB | Output is correct |
6 | Correct | 361 ms | 204 KB | Output is correct |
7 | Correct | 313 ms | 204 KB | Output is correct |
8 | Correct | 300 ms | 264 KB | Output is correct |
9 | Correct | 331 ms | 268 KB | Output is correct |
10 | Correct | 257 ms | 268 KB | Output is correct |
11 | Correct | 276 ms | 264 KB | Output is correct |
12 | Correct | 309 ms | 268 KB | Output is correct |
13 | Correct | 283 ms | 268 KB | Output is correct |
14 | Correct | 282 ms | 268 KB | Output is correct |
15 | Correct | 267 ms | 204 KB | Output is correct |
16 | Incorrect | 1 ms | 204 KB | Output isn't correct |
17 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2061 ms | 1100 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 332 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 282 ms | 272 KB | Output is correct |
2 | Correct | 264 ms | 268 KB | Output is correct |
3 | Correct | 288 ms | 268 KB | Output is correct |
4 | Correct | 316 ms | 272 KB | Output is correct |
5 | Correct | 282 ms | 272 KB | Output is correct |
6 | Correct | 361 ms | 204 KB | Output is correct |
7 | Correct | 313 ms | 204 KB | Output is correct |
8 | Correct | 300 ms | 264 KB | Output is correct |
9 | Correct | 331 ms | 268 KB | Output is correct |
10 | Correct | 257 ms | 268 KB | Output is correct |
11 | Correct | 276 ms | 264 KB | Output is correct |
12 | Correct | 309 ms | 268 KB | Output is correct |
13 | Correct | 283 ms | 268 KB | Output is correct |
14 | Correct | 282 ms | 268 KB | Output is correct |
15 | Correct | 267 ms | 204 KB | Output is correct |
16 | Incorrect | 1 ms | 204 KB | Output isn't correct |
17 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 332 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 282 ms | 272 KB | Output is correct |
2 | Correct | 264 ms | 268 KB | Output is correct |
3 | Correct | 288 ms | 268 KB | Output is correct |
4 | Correct | 316 ms | 272 KB | Output is correct |
5 | Correct | 282 ms | 272 KB | Output is correct |
6 | Correct | 361 ms | 204 KB | Output is correct |
7 | Correct | 313 ms | 204 KB | Output is correct |
8 | Correct | 300 ms | 264 KB | Output is correct |
9 | Correct | 331 ms | 268 KB | Output is correct |
10 | Correct | 257 ms | 268 KB | Output is correct |
11 | Correct | 276 ms | 264 KB | Output is correct |
12 | Correct | 309 ms | 268 KB | Output is correct |
13 | Correct | 283 ms | 268 KB | Output is correct |
14 | Correct | 282 ms | 268 KB | Output is correct |
15 | Correct | 267 ms | 204 KB | Output is correct |
16 | Incorrect | 1 ms | 204 KB | Output isn't correct |
17 | Halted | 0 ms | 0 KB | - |