제출 #995053

#제출 시각아이디문제언어결과실행 시간메모리
995053Nika533도서관 (JOI18_library)C++17
0 / 100
1 ms596 KiB
#pragma gcc diagnostic "-std=c++1z" #include <bits/stdc++.h> #include "library.h" #define pb push_back #define f first #define s second #define MOD 1000000007 #define pii pair<int,int> #define all(x) (x).begin(),(x).end() #define allr(x) (x).rbegin(),(x).rend() using namespace std; int m,T,k; void Solve(int n){ vector<int> v(n,1); int st; for (int i=1; i<=n; i++) { v[i-1]=0; if (Query(v)==1) st=i; v[i-1]=1; } for (int i=1; i<=n; i++) v[i-1]=0; v[st-1]=1; cout<<st<<endl; vector<int> res; res.pb(st); for (int i=2; i<=n; i++) { vector<int> q; for (int i=1; i<=n; i++) { if (v[i-1]==0) q.pb(i); } int l=0,r=q.size()-1,ind=-1; while (l<=r) { vector<int> u=v; int mid=(l+r)/2; // cout<<"MID "<<mid<<endl; for (int j=0; j<=mid; j++) { u[q[j]-1]=1; } int x=Query(u); for (int i=1; i<=n; i++) { if (v[i-1]) u[i-1]=0; } if (x==Query(u)) { ind=mid; r=mid-1; } else { l=mid+1; } } // cout<<"IND "<<ind<<endl; v[q[ind]-1]=1; res.pb(q[ind]); cout<<q[ind]<<endl; } Answer(res); }

컴파일 시 표준 에러 (stderr) 메시지

library.cpp:1: warning: ignoring '#pragma gcc diagnostic' [-Wunknown-pragmas]
    1 | #pragma gcc diagnostic "-std=c++1z"
      | 
library.cpp: In function 'void Solve(int)':
library.cpp:21:2: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   21 |  for (int i=1; i<=n; i++) v[i-1]=0; v[st-1]=1;
      |  ^~~
library.cpp:21:37: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   21 |  for (int i=1; i<=n; i++) v[i-1]=0; v[st-1]=1;
      |                                     ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...