Submission #3783971
Source Code Expand
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, a) for (int i = 0; (i) < (int) (a); (i)++) #define reps(i, a, b) for (int i = (int) (a); (i) < (int) (b); (i)++) #define rrep(i, a) for (int i = (int) a-1; (i) >= 0; (i)--) #define rreps(i, a, b) for (int i = (int) (a)-1; (i) >= (int) (b); (i)--) #define MP(a, b) make_pair((a), (b)) #define PB(a) push_back((a)) #define all(v) (v).begin(), (v).end() #define PERM(v) next_permutation(all(v)) #define UNIQUE(v) sort(all(v));(v).erase(unique(all(v)), v.end()) #define CIN(type, x) type x;cin >> x #define TRUE__ "Yes" #define FALSE__ "No" #define PRINT(f) if((f)){cout << (TRUE__) << endl;}else{cout << FALSE__ << endl;} #define RS resize #define CINV(v, N) do {\ v.RS(N);\ rep(i, N) cin >> v[i];\ } while (0); #define RCINV(v, N) do {\ v.RS(N);\ rrep(i, N) cin >> v[i];\ } while (0); #define MOD 1000000007 void init(); void solve(); signed main() { init(); solve(); } int N; void init() { cin >> N; } vector<int> v2; vector<int> v3; vector<int> v5; void solve() { if (N == 3) { cout << "2 5 63" << endl; return; } else if (N == 4) { cout << "2 3 4 9" << endl; return; } else if (N == 5) { cout << "2 3 4 6 9" << endl; return; } int cnt = 0; int s2 = 0; int s3 = 0; int s5 = 0; for (int i = 2;cnt < N; i++) { if (i == 8) continue; if (i == 6) continue; if (i % 5 == 0) { v5.PB(i); cnt++; s5 += i; } else if (i % 3 == 0) { v3.PB(i); cnt++; s3 += i; } else if (i % 2 == 0) { v2.PB(i); cnt++; s2 += i; } } if (s2 % 15) { int x = s2 % 15; for (int i = v2.size() - 1; x; i--) { v2[i] += 2; x = (x + 2) % 15; if (i == 1) i = v2.size(); } } if (s3 % 10) { int x = s3 % 10; for (int i = v3.size() - 1; x; i--) { v3[i] += 3; x = (x + 3) % 10; if (i == 1) i = v3.size(); } } if (s5 % 6) { int x = s5 % 6; for (int i = v5.size() - 1; x; i--) { v5[i] += 5; x = (x + 5) % 6; if (i == 1) i = v5.size(); } } for (int x : v2) { cout << x << " "; } for (int x : v3) { cout << x << " "; } for (int i = 0; i < (int) v5.size() - 1; i++) { cout << v5[i] << " "; } cout << v5.back() << endl; }
Submission Info
Submission Time | |
---|---|
Task | B - GCD Sequence |
User | spihill |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 2701 Byte |
Status | WA |
Exec Time | 3 ms |
Memory | 512 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 600 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | s1.txt, s2.txt |
All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, 25.txt, 26.txt, 27.txt, 28.txt, 29.txt, 30.txt, 31.txt, 32.txt, 33.txt, 34.txt, 35.txt, 36.txt, 37.txt, 38.txt, s1.txt, s2.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01.txt | WA | 3 ms | 512 KB |
02.txt | AC | 1 ms | 256 KB |
03.txt | AC | 1 ms | 256 KB |
04.txt | AC | 1 ms | 256 KB |
05.txt | AC | 1 ms | 256 KB |
06.txt | WA | 1 ms | 256 KB |
07.txt | WA | 1 ms | 256 KB |
08.txt | WA | 1 ms | 256 KB |
09.txt | WA | 1 ms | 256 KB |
10.txt | WA | 1 ms | 256 KB |
11.txt | WA | 1 ms | 256 KB |
12.txt | AC | 1 ms | 256 KB |
13.txt | AC | 1 ms | 256 KB |
14.txt | WA | 1 ms | 256 KB |
15.txt | WA | 1 ms | 256 KB |
16.txt | WA | 3 ms | 512 KB |
17.txt | WA | 3 ms | 512 KB |
18.txt | WA | 3 ms | 512 KB |
19.txt | WA | 3 ms | 512 KB |
20.txt | WA | 3 ms | 512 KB |
21.txt | WA | 3 ms | 512 KB |
22.txt | WA | 3 ms | 512 KB |
23.txt | AC | 3 ms | 512 KB |
24.txt | AC | 3 ms | 512 KB |
25.txt | WA | 3 ms | 512 KB |
26.txt | WA | 3 ms | 512 KB |
27.txt | WA | 3 ms | 512 KB |
28.txt | WA | 3 ms | 512 KB |
29.txt | WA | 3 ms | 512 KB |
30.txt | WA | 3 ms | 512 KB |
31.txt | WA | 3 ms | 512 KB |
32.txt | AC | 1 ms | 256 KB |
33.txt | WA | 1 ms | 256 KB |
34.txt | WA | 3 ms | 512 KB |
35.txt | WA | 2 ms | 384 KB |
36.txt | WA | 2 ms | 384 KB |
37.txt | WA | 3 ms | 512 KB |
38.txt | AC | 2 ms | 384 KB |
s1.txt | AC | 1 ms | 256 KB |
s2.txt | AC | 1 ms | 256 KB |