# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1000885 | 2024-06-18T10:56:05 Z | 변재우(#10901) | 봉쇄 시간 (IOI23_closing) | C++17 | 41 ms | 9960 KB |
#include "closing.h" #include <bits/stdc++.h> using namespace std; using ll=long long; const int Nmax=3010; ll S[Nmax]; int max_score(int N, int X, int Y, ll K, vector<int> U, vector<int> V, vector<int> W) { X++, Y++; ll ans=0; fill(S+1, S+N+1, 0); for(int i=2; i<=N; i++) S[i]=S[i-1]+W[i-2]; ll sum=0; for(int r=X; r<=N; r++) { vector<pair<ll, ll>> V; ll tsum=sum, cnt=0, sum2=0, p=0; for(int i=X-1; i>=1; i--) V.push_back({S[X]-S[i], false}); for(int i=Y+1; i<=N; i++) { if(i>r) V.push_back({S[i]-S[Y], false}); else cnt++; } sort(V.begin(), V.end()); while(p<V.size() && sum+sum2+V[p].first<=K) sum2+=V[p++].first; for(int l=Y; l>=1; l--) { sum+=(S[Y]-S[l]); if(X<=l && l<=r) sum-=min(S[Y]-S[l], S[l]-S[X]); if(l<X) { auto q=upper_bound(V.begin(), V.end(), make_pair(S[X]-S[l], 0ll))-1; if(q<=V.begin()+p-1) cnt--; (*q).second=true, cnt++; } while(p<V.size() && sum+sum2+V[p].first<=K) sum2+=(1-V[p].second)*V[p].first, cnt-=V[p++].second; while(p>0 && sum+sum2>K) sum2-=(1-V[--p].second)*V[p].first, cnt+=V[p].second; if(sum<=K) ans=max(ans, r-X+1+Y-l+1+cnt+p); } sum=tsum+S[r+1]-S[X]; } return ans; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | 1st lines differ - on the 1st token, expected: '6', found: '5' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 41 ms | 9960 KB | Execution killed with signal 11 |
2 | 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 | 1 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 | 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 | 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 | 1 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 | 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 | Correct | 0 ms | 348 KB | Output is correct |
12 | Incorrect | 1 ms | 348 KB | 1st lines differ - on the 1st token, expected: '173', found: '172' |
13 | 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 | 1 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 | 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 | Correct | 0 ms | 348 KB | Output is correct |
12 | Incorrect | 1 ms | 348 KB | 1st lines differ - on the 1st token, expected: '173', found: '172' |
13 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | 1st lines differ - on the 1st token, expected: '6', found: '5' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | 1st lines differ - on the 1st token, expected: '6', found: '5' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | 1st lines differ - on the 1st token, expected: '6', found: '5' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | 1st lines differ - on the 1st token, expected: '6', found: '5' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | 1st lines differ - on the 1st token, expected: '6', found: '5' |
2 | Halted | 0 ms | 0 KB | - |