제출 #993299

#제출 시각아이디문제언어결과실행 시간메모리
993299emad234로봇 (IOI13_robots)C++17
0 / 100
1 ms440 KiB
#include "bits/stdc++.h" #define F first #define S second #define ll long long #define pii pair<ll,ll> const int mxN = 5e5 + 5; const int mod = 1e9 + 7; using namespace std; #ifndef __ROBOTS_H__ #define __ROBOTS_H__ #ifdef __cplusplus extern "C" { #endif vector<pii>v; int w[mxN],s[mxN]; int a,b; bool solve(int m){ priority_queue<int>q; int i = 0; for(auto x : v){ if(x.F >= w[i] && i < a){ int t = m; while(t-- && q.size()) q.pop(); i++; } q.push(x.S); } for(i; i < a;i++) { int t = m; while(t-- && q.size()) q.pop(); } i = 0; for(i;i < b;i++){ int t = m; while(t-- && q.size() && q.top() < s[i]) q.pop(); } return q.empty(); } int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]){ a = A; b = B; for(int i = 0;i < A;i++) w[i] = X[i]; for(int i = 0;i < B;i++) s[i] = Y[i]; for(int i = 0;i < T;i++) v.push_back({W[i],S[i]}); sort(v.begin(),v.end()); int l = 1,r = T; int md; int ans = -1; while(l < r){ md = l; // cout<<md<<' '; if(solve(md)){ ans = md; break; }l++; } return ans; } #ifdef __cplusplus } #endif #endif /* __ROBOTS_H__ */

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

robots.cpp: In function 'bool solve(int)':
robots.cpp:29:9: warning: statement has no effect [-Wunused-value]
   29 |     for(i; i < a;i++) {
      |         ^
robots.cpp:34:9: warning: statement has no effect [-Wunused-value]
   34 |     for(i;i < b;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...