# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
315791 | 2020-10-24T01:39:05 Z | daniel920712 | Mouse (info1cup19_mouse) | C++14 | 2310 ms | 128888 KB |
#include <iostream> #include <stdio.h> #include <stdlib.h> #include <algorithm> #include "grader.h" using namespace std; vector < int > how; bool have[500]={0}; bool have2[500]={0}; int xx[500]; map < vector < int > , int > all; int Query(vector < int > tt) { if(all.find(tt)==all.end()) all[tt]=query(tt); return all[tt]; } void solve(int N) { int a,b,c,now,i,j,jj,kk,k,ok,where,cc; how.clear(); for(i=0;i<N;i++) { how.push_back(i+1); have[i+1]=0; xx[i+1]=i+1; } //random_shuffle(xx+1,xx+N+1); for(jj=1;jj<=N;jj++) { j=xx[jj]; if(!have[j]) { how[0]=j; now=0; for(kk=1;kk<=N;kk++) { k=xx[kk]; if(!have[k]&&k!=j) { how[now+1]=k; now++; } } } a=Query(how); if(a==N) return; ok=1; where=-1; for(k=1;k<N;k++) { swap(how[0],how[k]); b=Query(how); if(b==N) return; swap(how[0],how[k]); if(a>b) { where=k; continue; } else { ok=0; break; } } if(ok) { have[how[0]]=1; have2[0]=1; cc=0; break; } else if(where!=-1) { have[how[where]]=1; have2[where]=1; cc=where; break; } } //printf("%d %d\n",cc,how[cc]); for(i=0;i<N;i++) { if(i==cc) continue; for(jj=1;jj<=N;jj++) { j=xx[jj]; if(!have[j]) { how[i]=j; now=0; for(kk=1;kk<=N;kk++) { k=xx[kk]; if(!have[k]&&k!=j) { if(i+now+1==cc) now++; if(i+now+1==N) continue; how[i+now+1]=k; now++; } } } a=Query(how); if(a==N) return; swap(how[i],how[cc]); b=Query(how); if(b==N) return; swap(how[i],how[cc]); if(a-b==2) { have[how[i]]=1; break; } } } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | Correct! Number of queries: 25 |
2 | Correct | 1 ms | 256 KB | Correct! Number of queries: 11 |
3 | Correct | 1 ms | 384 KB | Correct! Number of queries: 23 |
4 | Correct | 1 ms | 256 KB | Correct! Number of queries: 39 |
5 | Correct | 1 ms | 384 KB | Correct! Number of queries: 33 |
6 | Correct | 1 ms | 256 KB | Correct! Number of queries: 23 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | Correct! Number of queries: 25 |
2 | Correct | 1 ms | 256 KB | Correct! Number of queries: 11 |
3 | Correct | 1 ms | 384 KB | Correct! Number of queries: 23 |
4 | Correct | 1 ms | 256 KB | Correct! Number of queries: 39 |
5 | Correct | 1 ms | 384 KB | Correct! Number of queries: 33 |
6 | Correct | 1 ms | 256 KB | Correct! Number of queries: 23 |
7 | Correct | 27 ms | 632 KB | Correct! Number of queries: 1300 |
8 | Correct | 32 ms | 752 KB | Correct! Number of queries: 1500 |
9 | Correct | 21 ms | 636 KB | Correct! Number of queries: 1100 |
10 | Correct | 22 ms | 632 KB | Correct! Number of queries: 1300 |
11 | Correct | 18 ms | 512 KB | Correct! Number of queries: 1000 |
12 | Correct | 27 ms | 636 KB | Correct! Number of queries: 1300 |
13 | Correct | 20 ms | 632 KB | Correct! Number of queries: 1200 |
14 | Correct | 32 ms | 680 KB | Correct! Number of queries: 1600 |
15 | Correct | 25 ms | 760 KB | Correct! Number of queries: 1500 |
16 | Correct | 24 ms | 744 KB | Correct! Number of queries: 1400 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | Correct! Number of queries: 25 |
2 | Correct | 1 ms | 256 KB | Correct! Number of queries: 11 |
3 | Correct | 1 ms | 384 KB | Correct! Number of queries: 23 |
4 | Correct | 1 ms | 256 KB | Correct! Number of queries: 39 |
5 | Correct | 1 ms | 384 KB | Correct! Number of queries: 33 |
6 | Correct | 1 ms | 256 KB | Correct! Number of queries: 23 |
7 | Correct | 27 ms | 632 KB | Correct! Number of queries: 1300 |
8 | Correct | 32 ms | 752 KB | Correct! Number of queries: 1500 |
9 | Correct | 21 ms | 636 KB | Correct! Number of queries: 1100 |
10 | Correct | 22 ms | 632 KB | Correct! Number of queries: 1300 |
11 | Correct | 18 ms | 512 KB | Correct! Number of queries: 1000 |
12 | Correct | 27 ms | 636 KB | Correct! Number of queries: 1300 |
13 | Correct | 20 ms | 632 KB | Correct! Number of queries: 1200 |
14 | Correct | 32 ms | 680 KB | Correct! Number of queries: 1600 |
15 | Correct | 25 ms | 760 KB | Correct! Number of queries: 1500 |
16 | Correct | 24 ms | 744 KB | Correct! Number of queries: 1400 |
17 | Incorrect | 2310 ms | 128888 KB | Too many queries |
18 | Halted | 0 ms | 0 KB | - |