# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1000876 | 2024-06-18T10:49:33 Z | 변재우(#10901) | 봉쇄 시간 (IOI23_closing) | C++17 | 38 ms | 10068 KB |
#include "closing.h" #include <bits/stdc++.h> using namespace std; using ll=long long; const int Nmax=3010; ll S[Nmax]; vector<ll> C; 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), C.clear(); for(int i=2; i<=N; i++) S[i]=S[i-1]+W[i-2]; for(int i=1; i<=N; i++) C.push_back(abs(S[i]-S[X])), C.push_back(abs(S[i]-S[Y])); sort(C.begin(), C.end()); C.erase(unique(C.begin(), C.end()), C.end()); ll sum=0; for(int r=X; r<=N; r++) { vector<pair<ll, bool>> 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) (*(upper_bound(V.begin(), V.end(), make_pair(S[X]-S[l], false))-1)).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; 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 | 38 ms | 10068 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Incorrect | 0 ms | 348 KB | 1st lines differ - on the 1st token, expected: '30', found: '32' |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Incorrect | 0 ms | 348 KB | 1st lines differ - on the 1st token, expected: '30', found: '32' |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Incorrect | 0 ms | 348 KB | 1st lines differ - on the 1st token, expected: '30', found: '32' |
3 | 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 | - |