# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
133209 | 2019-07-20T09:18:37 Z | SirCeness | Minerals (JOI19_minerals) | C++14 | 1000 ms | 3204 KB |
#include "minerals.h" #include <bits/stdc++.h> using namespace std; #define mod 1000000007 #define mp make_pair #define pb push_back #define bas(x) #x << ": " << x << " " #define prarr(x, n) cout << #x << ": "; for (int qsd = 0; qsd < n; qsd++) cout << x[qsd] << " "; cout << endl; #define prarrv(x) cout << #x << ": "; for (int qsd = 0; qsd < (int)x.size(); qsd++) cout << x[qsd] << " "; cout << endl; #define inside sl<=l&&r<=sr #define outside sr<l||r<sl typedef long long ll; vector<int> in; vector<int> son; void bol(vector<int>& arr){ //prarrv(arr); if (arr.size() == 1) assert(0); if (arr.size() == 2) Answer(arr[0]+1, arr[1]+1); else { int prt = 1; int last = 0; vector<int> arr1, arr2; for (int i = 0; i < arr.size(); i++){ //cout << "i: " << arr[i] << endl; if (son[arr[i]] == 0){ //cout << "son: 0" << endl; if (prt){ //cout << "ekle: 1" << endl; last = Query(arr[i]+1); in[arr[i]] = 1; arr1.pb(arr[i]); } else { //cout << "ekle: 2" << endl; arr2.pb(arr[i]); } prt = !prt; } else { //cout << "son: 1" << endl; int ans = Query(arr[i]+1); in[arr[i]] = 1; //cout << bas(ans) << bas(last) << endl; if (ans == last) arr1.pb(arr[i]); else arr2.pb(arr[i]); last = ans; } } for (int i = 0; i < in.size(); i++){ if (in[i]) Query(i+1); in[i] = 0; } bol(arr1); bol(arr2); } } void Solve(int n){ in.resize(2*n); son.resize(2*n); for (int i = 0; i < 2*n; i++) son[i] = 0; int last = 0; for (int i = 0; i < 2*n; i++){ int ans = Query(i+1); if (ans == last) son[i] = 1; last = ans; } for (int i = 0; i < 2*n; i++) Query(i+1); vector<int> nums(2*n); for (int i = 0; i < 2*n; i++) nums[i] = i; bol(nums); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 248 KB | Output is correct |
3 | Correct | 2 ms | 248 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 376 KB | Output is correct |
2 | Correct | 14 ms | 376 KB | Output is correct |
3 | Correct | 45 ms | 504 KB | Output is correct |
4 | Correct | 167 ms | 916 KB | Output is correct |
5 | Correct | 565 ms | 1272 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 248 KB | Output is correct |
3 | Correct | 2 ms | 248 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 5 ms | 376 KB | Output is correct |
6 | Correct | 14 ms | 376 KB | Output is correct |
7 | Correct | 45 ms | 504 KB | Output is correct |
8 | Correct | 167 ms | 916 KB | Output is correct |
9 | Correct | 565 ms | 1272 KB | Output is correct |
10 | Correct | 6 ms | 376 KB | Output is correct |
11 | Correct | 258 ms | 1112 KB | Output is correct |
12 | Correct | 566 ms | 1528 KB | Output is correct |
13 | Correct | 567 ms | 1300 KB | Output is correct |
14 | Correct | 573 ms | 1400 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 248 KB | Output is correct |
3 | Correct | 2 ms | 248 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 5 ms | 376 KB | Output is correct |
6 | Correct | 14 ms | 376 KB | Output is correct |
7 | Correct | 45 ms | 504 KB | Output is correct |
8 | Correct | 167 ms | 916 KB | Output is correct |
9 | Correct | 565 ms | 1272 KB | Output is correct |
10 | Correct | 6 ms | 376 KB | Output is correct |
11 | Correct | 258 ms | 1112 KB | Output is correct |
12 | Correct | 566 ms | 1528 KB | Output is correct |
13 | Correct | 567 ms | 1300 KB | Output is correct |
14 | Correct | 573 ms | 1400 KB | Output is correct |
15 | Execution timed out | 1527 ms | 3204 KB | Time limit exceeded |
16 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 248 KB | Output is correct |
3 | Correct | 2 ms | 248 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 5 ms | 376 KB | Output is correct |
6 | Correct | 14 ms | 376 KB | Output is correct |
7 | Correct | 45 ms | 504 KB | Output is correct |
8 | Correct | 167 ms | 916 KB | Output is correct |
9 | Correct | 565 ms | 1272 KB | Output is correct |
10 | Correct | 6 ms | 376 KB | Output is correct |
11 | Correct | 258 ms | 1112 KB | Output is correct |
12 | Correct | 566 ms | 1528 KB | Output is correct |
13 | Correct | 567 ms | 1300 KB | Output is correct |
14 | Correct | 573 ms | 1400 KB | Output is correct |
15 | Execution timed out | 1527 ms | 3204 KB | Time limit exceeded |
16 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 248 KB | Output is correct |
3 | Correct | 2 ms | 248 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 5 ms | 376 KB | Output is correct |
6 | Correct | 14 ms | 376 KB | Output is correct |
7 | Correct | 45 ms | 504 KB | Output is correct |
8 | Correct | 167 ms | 916 KB | Output is correct |
9 | Correct | 565 ms | 1272 KB | Output is correct |
10 | Correct | 6 ms | 376 KB | Output is correct |
11 | Correct | 258 ms | 1112 KB | Output is correct |
12 | Correct | 566 ms | 1528 KB | Output is correct |
13 | Correct | 567 ms | 1300 KB | Output is correct |
14 | Correct | 573 ms | 1400 KB | Output is correct |
15 | Execution timed out | 1527 ms | 3204 KB | Time limit exceeded |
16 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 248 KB | Output is correct |
3 | Correct | 2 ms | 248 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 5 ms | 376 KB | Output is correct |
6 | Correct | 14 ms | 376 KB | Output is correct |
7 | Correct | 45 ms | 504 KB | Output is correct |
8 | Correct | 167 ms | 916 KB | Output is correct |
9 | Correct | 565 ms | 1272 KB | Output is correct |
10 | Correct | 6 ms | 376 KB | Output is correct |
11 | Correct | 258 ms | 1112 KB | Output is correct |
12 | Correct | 566 ms | 1528 KB | Output is correct |
13 | Correct | 567 ms | 1300 KB | Output is correct |
14 | Correct | 573 ms | 1400 KB | Output is correct |
15 | Execution timed out | 1527 ms | 3204 KB | Time limit exceeded |
16 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 248 KB | Output is correct |
3 | Correct | 2 ms | 248 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 5 ms | 376 KB | Output is correct |
6 | Correct | 14 ms | 376 KB | Output is correct |
7 | Correct | 45 ms | 504 KB | Output is correct |
8 | Correct | 167 ms | 916 KB | Output is correct |
9 | Correct | 565 ms | 1272 KB | Output is correct |
10 | Correct | 6 ms | 376 KB | Output is correct |
11 | Correct | 258 ms | 1112 KB | Output is correct |
12 | Correct | 566 ms | 1528 KB | Output is correct |
13 | Correct | 567 ms | 1300 KB | Output is correct |
14 | Correct | 573 ms | 1400 KB | Output is correct |
15 | Execution timed out | 1527 ms | 3204 KB | Time limit exceeded |
16 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 248 KB | Output is correct |
3 | Correct | 2 ms | 248 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 5 ms | 376 KB | Output is correct |
6 | Correct | 14 ms | 376 KB | Output is correct |
7 | Correct | 45 ms | 504 KB | Output is correct |
8 | Correct | 167 ms | 916 KB | Output is correct |
9 | Correct | 565 ms | 1272 KB | Output is correct |
10 | Correct | 6 ms | 376 KB | Output is correct |
11 | Correct | 258 ms | 1112 KB | Output is correct |
12 | Correct | 566 ms | 1528 KB | Output is correct |
13 | Correct | 567 ms | 1300 KB | Output is correct |
14 | Correct | 573 ms | 1400 KB | Output is correct |
15 | Execution timed out | 1527 ms | 3204 KB | Time limit exceeded |
16 | Halted | 0 ms | 0 KB | - |