# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
957978 | 2024-04-04T15:24:04 Z | Nika533 | 쌀 창고 (IOI11_ricehub) | C++17 | 440 ms | 8124 KB |
#pragma GCC diagnostic warning "-std=c++11" #include <bits/stdc++.h> #include "ricehub.h" #define pb push_back #define f first #define s second #define MOD 1000000007 #define flush fflush(stdout) #define all(x) (x).begin(),(x).end() #define allr(x) (x).rbegin(), (x).rend() #define pii pair<int,int> using namespace std; int m,T,k; int besthub(int n, int L, int X[], long long B){ set<pair<int,int>> s; long long pref[n+1]; pref[0]=0; for (int i=0; i<n; i++) { s.insert({X[i],i}); pref[i+1]=pref[i]+X[i]; } int ans=0; for (int i=0; i<n; i++) { int l=0,r=L+5,val; while (l<=r) { int mid=(l+r)/2; set<pii> :: iterator it2=s.upper_bound({X[i]+mid,n}),it1=s.lower_bound({X[i]-mid,0}); it2--; long long a=(*it1).s,b=(*it2).s; long long num=X[i]; num*=(b+a-2*i); long long sum=(pref[b+1]-pref[i+1])-(pref[i]-pref[a])-num; if (sum<=B) { l=mid+1; val=b-a+1; } else { r=mid-1; } //cout<<"MID "<<mid<<" "<<num<<" "<<sum<<" "<<a<<" "<<b<<" "<<c<<" "<<d<<endl; } //cout<<"I "<<val<<endl; ans=max(ans,val); } 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 | 0 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 0 ms | 348 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
10 | Correct | 0 ms | 348 KB | Output is correct |
11 | Incorrect | 0 ms | 348 KB | Output isn't correct |
12 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 2 ms | 348 KB | Output is correct |
5 | Incorrect | 1 ms | 348 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 51 ms | 1372 KB | Output is correct |
2 | Correct | 50 ms | 1368 KB | Output is correct |
3 | Correct | 411 ms | 8020 KB | Output is correct |
4 | Correct | 440 ms | 8124 KB | Output is correct |
5 | Incorrect | 69 ms | 5396 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |