# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
967749 | 2024-04-22T18:36:41 Z | Hugo1729 | 쌀 창고 (IOI11_ricehub) | C++11 | 10 ms | 2908 KB |
#include <bits/stdc++.h> #include "ricehub.h" using namespace std; typedef long long ll; int besthub(int R, int L, int X[], long long B){ deque<int> a,b; int ptr=1; ll sus1=0,sus2=0; int ans=0; for(int i=0;i<R;i++){ // cout << i << ' ' << sus1 << ' ' << sus2 << '\n'; a.push_back(X[i]); // cout << "1a" << X[i] << '\n'; sus1+=X[i]; ptr=max(i+1,ptr); if(!b.empty()){ // cout << "2r" << b.front() << '\n'; b.pop_front(); sus2-=X[i]; } while((a.size()*X[i]-sus1)+(sus2-b.size()*X[i])>B){ // cout << "c" <<(a.size()*X[i]-sus1)+(sus2-b.size()*X[i]) << '\n'; sus1-=a.front(); a.pop_front(); } // cout << "sus" << '\n'; while(ptr<R&&a.size()>0&&X[i]-a.front()>=X[ptr]-X[i]){ // cout << "1r" << a.front() << '\n'; sus1-=a.front(); a.pop_front(); while(ptr<R&&(a.size()*X[i]-sus1)+(sus2-b.size()*X[i])+(X[ptr]-X[i])<=B){ // cout << "2a" << X[ptr] << '\n'; b.push_back(X[ptr]); sus2+=X[ptr]; ptr++; } } while(ptr<R&&(a.size()*X[i]-sus1)+(sus2-b.size()*X[i])+(X[ptr]-X[i])<=B){ // cout << "2a" << X[ptr] << '\n'; b.push_back(X[ptr]); sus2+=X[ptr]; ptr++; } // cout << "sus" << '\n'; if(ans<a.size()+b.size())ans=a.size()+b.size(); } return ans; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 344 KB | Output is correct |
8 | Correct | 0 ms | 348 KB | Output is correct |
9 | Incorrect | 0 ms | 348 KB | Output isn't correct |
10 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Incorrect | 0 ms | 348 KB | Output isn't correct |
7 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 348 KB | Output is correct |
2 | Correct | 2 ms | 348 KB | Output is correct |
3 | Correct | 9 ms | 2872 KB | Output is correct |
4 | Correct | 10 ms | 2908 KB | Output is correct |
5 | Correct | 5 ms | 2652 KB | Output is correct |
6 | Correct | 5 ms | 2648 KB | Output is correct |
7 | Incorrect | 9 ms | 2908 KB | Output isn't correct |
8 | Halted | 0 ms | 0 KB | - |