# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
48272 | 2018-05-11T08:36:30 Z | marvenlee | 도서관 (JOI18_library) | C++14 | 3 ms | 376 KB |
#include <cstdio> #include <vector> #include <bits/stdc++.h> #include "library.h" using namespace std; void Solve(int n) { vector<int> m(n); vector<int>finalans; int n1=n; n--; int sizeofn=1; while(n!=1) { sizeofn +=1; n/=2; } n=n1; while(finalans.size()!=n) { int binary[n]; for(int i = 0; i < n; i++) { binary[i]=i; } int difference=0; vector<int> check(n); vector<int> m1; for(int i=0;i<n;i++) { if(binary[i]%2==1) m[i]=1; else m[i]=0; for(int i=0;i<finalans.size();i++) { m[finalans[i]]=0; } int a=Query(m); if(m[i]==0) m[i]=1; else m[i]=0; for(int i=0;i<finalans.size();i++) { m[finalans[i]]=0; } int b=Query(m); if(a==b) { difference+=pow(2,i); m1=m; } } vector<int>m2; for(int i=0;i<n;i++) { if (m1[i]==1) check.push_back(i); } m2=m1; while(check.size()!=1) { for(int i=0;i<check.size()/2;i++) { m1[check[i]]=0; m2[check[i]]=1; } int a= Query(m1); int b= Query(m2); if(a!=b) check.erase(check.begin(),check.begin()+check.size()/2); else check.erase(check.begin()+check.size()/2,check.end()); } int x=check[0]; int y=x^difference; m.assign(n,0); m[x]=1; m[finalans.size()/2 -1]=1; if(Query(m)!=1) { int z=x; x=y; y=z; } finalans.insert(finalans.begin()+finalans.size()/2,y); finalans.insert(finalans.begin()+finalans.size()/2,x); } Answer(finalans); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 3 ms | 376 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 3 ms | 376 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |