제출 #844701

#제출 시각아이디문제언어결과실행 시간메모리
844701vjudge1Pod starim krovovima (COCI20_psk)C++17
40 / 50
1 ms348 KiB
#define li #define MP make_pair #define pb push_back #define REP(i,n) for(int (i) = 0; (i) < (n); (i)++) #include <bits/stdc++.h> using namespace std; const double EPS = 0.00001; const int INF = 1e9+500; const int N = 1e5+5; int n,m,q,k; vector<int> t; vector<array<int,2> > z; vector<array<int,2> > res; vector<int> ans; void solve() { cin>>n; t.resize(n); z.resize(n); int sum = 0; for(int i = 0; i<n; i++) { cin>>t[i]>>z[i][0]; z[i][1] = i; sum += t[i]; } sort(z.begin(),z.end()); int i; int last = 0; for(i = n-1; i>=0; i--) { sum-=z[i][0]; if(sum <= 0) { last = z[i][0] + sum; res.pb({last, z[i][1]}); break; } else { res.pb(z[i]); } } cout<<i<<"\n"; ans.resize(n,0); for(int i = 0; i < res.size(); i++) { ans[res[i][1]] = res[i][0]; } for(auto i : ans) { cout<<i<<" "; } } signed main() { int test = 1; //cin>>test; while(test--) { solve(); } }

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

psk.cpp: In function 'void solve()':
psk.cpp:44:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::array<int, 2> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |     for(int i = 0; i < res.size(); i++) {
      |                    ~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...