# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1003187 | 2024-06-20T07:35:39 Z | ayankarimova | 쌀 창고 (IOI11_ricehub) | C++14 | 610 ms | 7760 KB |
#include "ricehub.h" #include <bits/stdc++.h> using namespace std; #define endl '\n' #define ll long long const ll sz=5005; ll a[sz], b[sz], s1[sz], s2[sz], s[sz], d[sz]; map<ll, ll>mp; int besthub(int r, int l, int x[], long long k) { for(int i=0; i<r; i++){ mp[x[i]]++; s[x[i]]++; } for(int i=0; i<r; i++){ for(int j=0; j<i; j++){ d[i]+=x[i]-x[j]; } //cout<<d[i]<<' '; } for(int i=1; i<=l+1; i++) s[i]+=s[i-1]; ll sum=0; for(ll i=1; i<=l; i++){ a[i]=a[i-1]+s1[i-1]; s1[i]=mp[i]+s1[i-1]; } //cout<<endl; sum=0; for(ll i=l; i>=1; i--){ b[i]=b[i+1]+s2[i+1]; s2[i]=mp[i]+s2[i+1]; //cout<<b[i]<<' '; } ll ans=0; for(int i=0; i<r; i++){ for(int j=i; j<r; j++){ ll m=(i+j)/2; ll num1=(d[m]-d[i])-i*(x[m]-x[i]); ll num2=(d[j]-d[m])-m*(x[j]-x[m]); if(num1+num2<=k){ ans=max(ans, (ll)j-i+1); //cout<<i<<' '<<j<<' '<<num1<<' '<<num2<<' '<<ans<<endl; } } } return ans; } /* {} [] 5 20 6 1 2 10 12 14 3 */
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Incorrect | 0 ms | 348 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 448 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 | 1 ms | 348 KB | Output is correct |
7 | Correct | 1 ms | 348 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
10 | Correct | 1 ms | 348 KB | Output is correct |
11 | Incorrect | 1 ms | 344 KB | Output isn't correct |
12 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 1112 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 610 ms | 7760 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |