# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
111820 | 2019-05-16T09:46:06 Z | model_code | Minerals (JOI19_minerals) | C++17 | 1000 ms | 3736 KB |
#include <cstdio> #include <vector> #include<algorithm> #include<cmath> #include "minerals.h" using namespace std; int used[110000]; vector<int>gr[2]; void rec(vector<int>A,vector<int>B,int c){ if(A.size()==0)return; if(A.size()==1){ used[A[0]]=B[0]; used[B[0]]=A[0]; return; } int rac=0; int SZ= (3 - sqrt(5)) / 2*A.size(); if(c==0){ SZ= (1-(3 - sqrt(5)) / 2 )*A.size(); } if(SZ==0)SZ++; if(SZ==A.size())SZ--; vector<int>X1; vector<int>X2; vector<int>Y1; vector<int>Y2; if(c==1){ for(int i=0;i<SZ;i++){ rac=Query(A[i]+1); } for(int i=0;i<A.size();i++){ if(i<SZ)X1.push_back(A[i]); else X2.push_back(A[i]); } for(int i=0;i<B.size();i++){ if(Y1.size()==X1.size()){ Y2.push_back(B[i]); }else if(X2.size()==Y2.size()){ Y1.push_back(B[i]); }else{ int tmp=Query(B[i]+1); if(rac!=tmp){ Y1.push_back(B[i]); }else Y2.push_back(B[i]); rac=tmp; } } }else{ for(int i=SZ;i<A.size();i++){ rac=Query(A[i]+1); } for(int i=0;i<A.size();i++){ if(i<SZ)X1.push_back(A[i]); else X2.push_back(A[i]); } for(int i=0;i<B.size();i++){ if(Y1.size()==X1.size()){ Y2.push_back(B[i]); }else if(X2.size()==Y2.size()){ Y1.push_back(B[i]); }else{ int tmp=Query(B[i]+1); if(rac!=tmp){ Y1.push_back(B[i]); }else Y2.push_back(B[i]); rac=tmp; } } } rec(X1,Y1,0); rec(X2,Y2,1); } void Solve(int N){ while(N > 40000); int cur=0; for(int i=0;i<N*2;i++){ int tmp=Query(i+1); if(cur<tmp){ gr[0].push_back(i); }else gr[1].push_back(i); cur=tmp; } random_shuffle(gr[0].begin(),gr[0].end()); random_shuffle(gr[1].begin(),gr[1].end()); rec(gr[0],gr[1],1); for(int i=0;i<N;i++){ Answer(gr[0][i]+1,used[gr[0][i]]+1); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 512 KB | Output is correct |
3 | Correct | 6 ms | 640 KB | Output is correct |
4 | Correct | 12 ms | 896 KB | Output is correct |
5 | Correct | 32 ms | 1576 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
5 | Correct | 4 ms | 384 KB | Output is correct |
6 | Correct | 5 ms | 512 KB | Output is correct |
7 | Correct | 6 ms | 640 KB | Output is correct |
8 | Correct | 12 ms | 896 KB | Output is correct |
9 | Correct | 32 ms | 1576 KB | Output is correct |
10 | Correct | 3 ms | 384 KB | Output is correct |
11 | Correct | 22 ms | 1068 KB | Output is correct |
12 | Correct | 28 ms | 1696 KB | Output is correct |
13 | Correct | 25 ms | 1720 KB | Output is correct |
14 | Correct | 29 ms | 1568 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
5 | Correct | 4 ms | 384 KB | Output is correct |
6 | Correct | 5 ms | 512 KB | Output is correct |
7 | Correct | 6 ms | 640 KB | Output is correct |
8 | Correct | 12 ms | 896 KB | Output is correct |
9 | Correct | 32 ms | 1576 KB | Output is correct |
10 | Correct | 3 ms | 384 KB | Output is correct |
11 | Correct | 22 ms | 1068 KB | Output is correct |
12 | Correct | 28 ms | 1696 KB | Output is correct |
13 | Correct | 25 ms | 1720 KB | Output is correct |
14 | Correct | 29 ms | 1568 KB | Output is correct |
15 | Correct | 58 ms | 3644 KB | Output is correct |
16 | Correct | 76 ms | 3456 KB | Output is correct |
17 | Correct | 82 ms | 3552 KB | Output is correct |
18 | Correct | 81 ms | 3344 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
5 | Correct | 4 ms | 384 KB | Output is correct |
6 | Correct | 5 ms | 512 KB | Output is correct |
7 | Correct | 6 ms | 640 KB | Output is correct |
8 | Correct | 12 ms | 896 KB | Output is correct |
9 | Correct | 32 ms | 1576 KB | Output is correct |
10 | Correct | 3 ms | 384 KB | Output is correct |
11 | Correct | 22 ms | 1068 KB | Output is correct |
12 | Correct | 28 ms | 1696 KB | Output is correct |
13 | Correct | 25 ms | 1720 KB | Output is correct |
14 | Correct | 29 ms | 1568 KB | Output is correct |
15 | Correct | 58 ms | 3644 KB | Output is correct |
16 | Correct | 76 ms | 3456 KB | Output is correct |
17 | Correct | 82 ms | 3552 KB | Output is correct |
18 | Correct | 81 ms | 3344 KB | Output is correct |
19 | Correct | 78 ms | 3584 KB | Output is correct |
20 | Correct | 68 ms | 3644 KB | Output is correct |
21 | Correct | 72 ms | 3628 KB | Output is correct |
22 | Correct | 61 ms | 3384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
5 | Correct | 4 ms | 384 KB | Output is correct |
6 | Correct | 5 ms | 512 KB | Output is correct |
7 | Correct | 6 ms | 640 KB | Output is correct |
8 | Correct | 12 ms | 896 KB | Output is correct |
9 | Correct | 32 ms | 1576 KB | Output is correct |
10 | Correct | 3 ms | 384 KB | Output is correct |
11 | Correct | 22 ms | 1068 KB | Output is correct |
12 | Correct | 28 ms | 1696 KB | Output is correct |
13 | Correct | 25 ms | 1720 KB | Output is correct |
14 | Correct | 29 ms | 1568 KB | Output is correct |
15 | Correct | 58 ms | 3644 KB | Output is correct |
16 | Correct | 76 ms | 3456 KB | Output is correct |
17 | Correct | 82 ms | 3552 KB | Output is correct |
18 | Correct | 81 ms | 3344 KB | Output is correct |
19 | Correct | 78 ms | 3584 KB | Output is correct |
20 | Correct | 68 ms | 3644 KB | Output is correct |
21 | Correct | 72 ms | 3628 KB | Output is correct |
22 | Correct | 61 ms | 3384 KB | Output is correct |
23 | Correct | 88 ms | 3736 KB | Output is correct |
24 | Correct | 77 ms | 3624 KB | Output is correct |
25 | Correct | 93 ms | 3632 KB | Output is correct |
26 | Correct | 84 ms | 3544 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
5 | Correct | 4 ms | 384 KB | Output is correct |
6 | Correct | 5 ms | 512 KB | Output is correct |
7 | Correct | 6 ms | 640 KB | Output is correct |
8 | Correct | 12 ms | 896 KB | Output is correct |
9 | Correct | 32 ms | 1576 KB | Output is correct |
10 | Correct | 3 ms | 384 KB | Output is correct |
11 | Correct | 22 ms | 1068 KB | Output is correct |
12 | Correct | 28 ms | 1696 KB | Output is correct |
13 | Correct | 25 ms | 1720 KB | Output is correct |
14 | Correct | 29 ms | 1568 KB | Output is correct |
15 | Correct | 58 ms | 3644 KB | Output is correct |
16 | Correct | 76 ms | 3456 KB | Output is correct |
17 | Correct | 82 ms | 3552 KB | Output is correct |
18 | Correct | 81 ms | 3344 KB | Output is correct |
19 | Correct | 78 ms | 3584 KB | Output is correct |
20 | Correct | 68 ms | 3644 KB | Output is correct |
21 | Correct | 72 ms | 3628 KB | Output is correct |
22 | Correct | 61 ms | 3384 KB | Output is correct |
23 | Correct | 88 ms | 3736 KB | Output is correct |
24 | Correct | 77 ms | 3624 KB | Output is correct |
25 | Correct | 93 ms | 3632 KB | Output is correct |
26 | Correct | 84 ms | 3544 KB | Output is correct |
27 | Execution timed out | 3010 ms | 640 KB | Time limit exceeded |
28 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
5 | Correct | 4 ms | 384 KB | Output is correct |
6 | Correct | 5 ms | 512 KB | Output is correct |
7 | Correct | 6 ms | 640 KB | Output is correct |
8 | Correct | 12 ms | 896 KB | Output is correct |
9 | Correct | 32 ms | 1576 KB | Output is correct |
10 | Correct | 3 ms | 384 KB | Output is correct |
11 | Correct | 22 ms | 1068 KB | Output is correct |
12 | Correct | 28 ms | 1696 KB | Output is correct |
13 | Correct | 25 ms | 1720 KB | Output is correct |
14 | Correct | 29 ms | 1568 KB | Output is correct |
15 | Correct | 58 ms | 3644 KB | Output is correct |
16 | Correct | 76 ms | 3456 KB | Output is correct |
17 | Correct | 82 ms | 3552 KB | Output is correct |
18 | Correct | 81 ms | 3344 KB | Output is correct |
19 | Correct | 78 ms | 3584 KB | Output is correct |
20 | Correct | 68 ms | 3644 KB | Output is correct |
21 | Correct | 72 ms | 3628 KB | Output is correct |
22 | Correct | 61 ms | 3384 KB | Output is correct |
23 | Correct | 88 ms | 3736 KB | Output is correct |
24 | Correct | 77 ms | 3624 KB | Output is correct |
25 | Correct | 93 ms | 3632 KB | Output is correct |
26 | Correct | 84 ms | 3544 KB | Output is correct |
27 | Execution timed out | 3010 ms | 640 KB | Time limit exceeded |
28 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
5 | Correct | 4 ms | 384 KB | Output is correct |
6 | Correct | 5 ms | 512 KB | Output is correct |
7 | Correct | 6 ms | 640 KB | Output is correct |
8 | Correct | 12 ms | 896 KB | Output is correct |
9 | Correct | 32 ms | 1576 KB | Output is correct |
10 | Correct | 3 ms | 384 KB | Output is correct |
11 | Correct | 22 ms | 1068 KB | Output is correct |
12 | Correct | 28 ms | 1696 KB | Output is correct |
13 | Correct | 25 ms | 1720 KB | Output is correct |
14 | Correct | 29 ms | 1568 KB | Output is correct |
15 | Correct | 58 ms | 3644 KB | Output is correct |
16 | Correct | 76 ms | 3456 KB | Output is correct |
17 | Correct | 82 ms | 3552 KB | Output is correct |
18 | Correct | 81 ms | 3344 KB | Output is correct |
19 | Correct | 78 ms | 3584 KB | Output is correct |
20 | Correct | 68 ms | 3644 KB | Output is correct |
21 | Correct | 72 ms | 3628 KB | Output is correct |
22 | Correct | 61 ms | 3384 KB | Output is correct |
23 | Correct | 88 ms | 3736 KB | Output is correct |
24 | Correct | 77 ms | 3624 KB | Output is correct |
25 | Correct | 93 ms | 3632 KB | Output is correct |
26 | Correct | 84 ms | 3544 KB | Output is correct |
27 | Execution timed out | 3010 ms | 640 KB | Time limit exceeded |
28 | Halted | 0 ms | 0 KB | - |