제출 #781019

#제출 시각아이디문제언어결과실행 시간메모리
781019tolbi동굴 (IOI13_cave)C++17
100 / 100
624 ms588 KiB
#pragma optimize("Bismillahirrahmanirrahim") //█▀█─█──█──█▀█─█─█ //█▄█─█──█──█▄█─█■█ //█─█─█▄─█▄─█─█─█─█ //Allahuekber //ahmet23 orz... //FatihSultanMehmedHan //YavuzSultanSelimHan //AbdulhamidHan //Sani buyuk Osman Pasa Plevneden cikmam diyor #define author tolbi #include <bits/stdc++.h> using namespace std; template<typename X, typename Y> ostream& operator<<(ostream& os, pair<X,Y> pr){return os<<pr.first<<" "<<pr.second;} template<typename X> ostream& operator<<(ostream& os, vector<X> v){for (auto &it : v) os<<it; return os;} template<typename X, size_t Y> ostream& operator<<(ostream& os, array<X,Y> v){for (auto &it : v) os<<it; return os;} #define endl '\n' #define deci(x) int x;cin>>x; #define decstr(x) string x;cin>>x; #define vint(x) vector<int> x #define sortarr(x) sort(x.begin(), x.end()) #define sortrarr(x) sort(x.rbegin(), x.rend()) #define rev(x) reverse(x.begin(), x.end()) #define tol(bi) (1LL<<((long long)(bi))) #define coutarr(x) for (auto &it : x) cout<<it<<endl; typedef long long ll; const ll INF = LONG_LONG_MAX; const int MOD = 1e9+7; mt19937 ayahya(chrono::high_resolution_clock().now().time_since_epoch().count()); #include "cave.h" /* int tryCombination(int S[]); void answer(int S[], int D[]); */ int ask(vector<int> v){ int _RES[v.size()]; for (int i = 0; i < v.size(); ++i) { _RES[i]=v[i]; } return tryCombination(_RES); } int ask(vector<bool> v){ int _RES[v.size()]; for (int i = 0; i < v.size(); ++i) { _RES[i]=v[i]; } return tryCombination(_RES); } void exploreCave(int n) { vector<pair<int,int>> ans(n,{-1,-1}); for (int i = 0; i < n; ++i) { vector<int> dene(n,0); for (int j = 0; j < i; j++){ dene[ans[j].first]=ans[j].second; } int res = ask(dene); int kk = (res==i); int l = 1, r = n-i; while (l<r){ int mid = l+(r-l)/2; dene.clear(); dene.resize(n,-1); for (int j = 0; j < i; j++){ dene[ans[j].first]=ans[j].second; } int kal = mid; for (int j = 0; j < n; j++){ if (dene[j]!=-1) continue; if (kal) dene[j]=1,kal--; else dene[j]=0; } res = ask(dene); if ((res==i)==kk) l=mid+1; else r=mid; } vector<int> vis(n,false); for (int j = 0; j < i; ++j) { vis[ans[j].first]=true; } for (int j = 0; j < n; j++){ if (vis[j]) continue; l--; if (!l){ ans[i]={j,kk}; break; } } } int __RES_[n],__RES2_[n];//first place second on off for (int i = 0; i < n; i++){ __RES_[ans[i].first]=ans[i].second; __RES2_[ans[i].first]=i; } answer(__RES_,__RES2_); }

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

cave.cpp:1: warning: ignoring '#pragma optimize ' [-Wunknown-pragmas]
    1 | #pragma optimize("Bismillahirrahmanirrahim")
      | 
cave.cpp: In function 'int ask(std::vector<int>)':
cave.cpp:37:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |  for (int i = 0; i < v.size(); ++i)
      |                  ~~^~~~~~~~~~
cave.cpp: In function 'int ask(std::vector<bool>)':
cave.cpp:45:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<bool>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   45 |  for (int i = 0; i < v.size(); ++i)
      |                  ~~^~~~~~~~~~
#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...