제출 #1101334

#제출 시각아이디문제언어결과실행 시간메모리
1101334alexander707070동굴 (IOI13_cave)C++14
100 / 100
492 ms844 KiB
#include<bits/stdc++.h> #define MAXN 5007 #include "cave.h" using namespace std; int n; int s[MAXN],t[MAXN]; vector<int> unknown; pair<int,int> ans[MAXN]; int ask(vector<int> z){ for(int i=0;i<n;i++)s[i]=0; for(int i:z)s[i-1]=1; int curr=tryCombination(s); if(curr==-1)return n+1; return curr+1; } pair<int,int> findlever(int pos,vector<int> w){ vector<int> toask; for(int i=1;i<pos;i++){ if(ans[i].second==1)toask.push_back(ans[i].first); } int curr=ask(toask); if(curr>pos){ int l=-1,r=w.size(),tt; while(l+1<r){ tt=(l+r)/2; for(int f=0;f<=tt;f++){ toask.push_back(w[f]); } if(ask(toask)==pos){ r=tt; }else{ l=tt; } for(int f=0;f<=tt;f++)toask.pop_back(); } return {w[r],0}; }else{ int l=-1,r=w.size(),tt; while(l+1<r){ tt=(l+r)/2; for(int f=0;f<=tt;f++){ toask.push_back(w[f]); } if(ask(toask)>pos){ r=tt; }else{ l=tt; } for(int f=0;f<=tt;f++)toask.pop_back(); } return {w[r],1}; } } void exploreCave(int N) { n=N; for(int i=1;i<=n;i++)unknown.push_back(i); for(int i=1;i<=n;i++){ ans[i]=findlever(i,unknown); for(int f=0;f<unknown.size();f++){ if(unknown[f]==ans[i].first){ swap(unknown[f],unknown[unknown.size()-1]); unknown.pop_back(); break; } } } for(int i=1;i<=n;i++){ t[ans[i].first-1]=i-1; s[ans[i].first-1]=ans[i].second; } answer(s,t); }

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

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:79:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   79 |         for(int f=0;f<unknown.size();f++){
      |                     ~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...