제출 #137555

#제출 시각아이디문제언어결과실행 시간메모리
137555Mahdi_Jfri커다란 상품 (IOI17_prize)C++14
20 / 100
113 ms5436 KiB
#include "prize.h" #include<bits/stdc++.h> using namespace std; #define ll long long #define pb push_back const int maxn = 2e5 + 20; vector<int> res[maxn] , candid; int mx; vector<int> reval(int k) { if(!res[k].empty()) return res[k]; res[k] = ask(k); while(k >= 1000 && res[k][0] + res[k][1] > mx) cout << 1/0; return res[k]; } void solve(int l , int r) { while(l < r) { auto tmp = reval(l); if(tmp[0] + tmp[1] != mx) candid.pb(l++); else break; } while(l < r) { r--; auto tmp = reval(r); if(tmp[0] + tmp[1] != mx) candid.pb(r); else break; } if(l >= r) return; reval(l); reval(r); if(res[r][0] - res[l][0] == 0) return; int m = (l + r) / 2; solve(m , r + 1); solve(l , m); } int find_best(int n) { if(n <= 5000) { for(int i = 0; i < n; i++) { std::vector<int> res = ask(i); if(res[0] + res[1] == 0) return i; } } for(int i = 0; i < 1000; i++) { vector<int> tmp = reval(i); mx = max(mx , tmp[0] + tmp[1]); } solve(0 , n); for(auto x : candid) { auto tmp = reval(x); if(tmp[0] + tmp[1] == 0) return x; } cout << 1/0; return -85; }

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

prize.cpp: In function 'std::vector<int> reval(int)':
prize.cpp:21:58: warning: division by zero [-Wdiv-by-zero]
  while(k >= 1000 && res[k][0] + res[k][1] > mx) cout << 1/0;
                                                         ~^~
prize.cpp: In function 'int find_best(int)':
prize.cpp:82:11: warning: division by zero [-Wdiv-by-zero]
  cout << 1/0;
          ~^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...