# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1007054 | 2024-06-24T11:13:11 Z | amin | 봉쇄 시간 (IOI23_closing) | C++17 | 1000 ms | 11968 KB |
#include "closing.h" #include <bits/stdc++.h> #include <vector> #define ll long long using namespace std; int max_score(int n, int x, int y, long long k,vector<int> u,vector<int> v,vector<int>w) { ll ans=2; if(x>y) swap(x,y); int a=x; int b=y; vector<ll>val; ll co=0; //ll sum=0; ll path=0; for(int i=a;i<b;i++) { path+=w[i]; } ll lena=0,lenb=0; // int o=0; while(a!=0||b!=n-1) { // cout<<co<<endl; // cout<<a<<' '<<b<<endl; ll h=1e18; if(a!=0) {h=min(h,lena+w[a-1]); } if(b!=n-1) { h=min(h,lenb+w[b]); } if(h>path) { while(co>0) { // cout<<"HERE"<<endl; val.push_back(path); co--; } } if(a!=0&&b!=n-1) { if(w[a-1]<=w[b]) { // cout<<"HERE"<<endl; a--; co++; lena+=w[a]; val.push_back(lena); continue; }else { co++; lenb+=w[b]; val.push_back(lenb); b++; continue; } } if(a==0) { // cout<<"here"<<endl; co++; lenb+=w[b]; val.push_back(lenb); b++; continue; } if(b==n-1) { co++; lena+=w[a-1]; val.push_back(lena); a--; } } while(co--) val.push_back(path); for(int i=0;i<val.size();i++) { if(i) val[i]+=val[i-1]; } ll suma[n]; a=x; b=y; for(int i=a;i<=b;i++) { if(i==a) { suma[i]=0; continue; } //cout<<i<<' '<<w[i-1]; suma[i]=suma[i-1]+w[i-1]; // cout<<suma[i]<<endl; } //cout<<suma[a]; //cout<<"HERE"<<endl; ll sumb[n]; for(int i=b;i>=a;i--) { if(i==b) { sumb[i]=0; continue; } sumb[i]=sumb[i+1]+w[i]; // cout<<sumb[i]<<endl; } ll sum=0; ll no=0; a=x; b=y; for(int i=a;i<=b;i++) { sum=0; for(int y=b-1;y>=i;y--) { sum+=sumb[y]; } for(int y=a;y<=b;y++) { // cout<<i<<' '<<y<<endl; // cout<<sum<<' '; if(y>=i) { sum+=max(suma[y],sumb[y]); sum-=sumb[y]; }else sum+=suma[y]; // cout<<sum<<endl; no=b-i+1-a+y+1; if(sum>k) continue; ll j=k-sum; auto u=upper_bound(val.begin(),val.end(),j); if(u!=val.begin()) { // u--; no+=u-val.begin(); } ans=max(ans,no); // cout<<no<<endl; } } return ans; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | 1st lines differ - on the 1st token, expected: '6', found: '5' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1058 ms | 11968 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 372 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 | 344 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Incorrect | 0 ms | 348 KB | 1st lines differ - on the 1st token, expected: '26', found: '23' |
8 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 372 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 | 344 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Incorrect | 0 ms | 348 KB | 1st lines differ - on the 1st token, expected: '26', found: '23' |
8 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 372 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 | 344 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Incorrect | 0 ms | 348 KB | 1st lines differ - on the 1st token, expected: '26', found: '23' |
8 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | 1st lines differ - on the 1st token, expected: '6', found: '5' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | 1st lines differ - on the 1st token, expected: '6', found: '5' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | 1st lines differ - on the 1st token, expected: '6', found: '5' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | 1st lines differ - on the 1st token, expected: '6', found: '5' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | 1st lines differ - on the 1st token, expected: '6', found: '5' |
2 | Halted | 0 ms | 0 KB | - |