Submission #980258

# Submission time Handle Problem Language Result Execution time Memory
980258 2024-05-12T01:54:12 Z vjudge1 Closing Time (IOI23_closing) C++17
0 / 100
1000 ms 18300 KB
#include <bits/stdc++.h>
#define rep(a,b,c) for(int a=b; a<c; a++)
#define repr(a,b,c) for(int a=b-1; a>c-1; a--)
#define repa(a,b) for(auto a:b)
#define ll long long
#define pll pair<ll, ll>
#define pb push_back
#define fi first
#define se second

using namespace std;

int max_score(int N, int X, int Y, ll K, vector<int> U, vector<int> V, vector<int> W){
	ll nxt[N]{}, prv[N]{};
	rep(i,0,N-1) nxt[i]=W[i], prv[i+1]=W[i];
	int ans=0;
	ll dis[N], disx[N], disy[N];
	disx[X]=0;
	disy[Y]=0;
	rep(i,X+1,N) disx[i]=disx[i-1]+nxt[i-1];
	repr(i,X,0) disx[i]=disx[i+1]+prv[i+1];
	rep(i,Y+1,N) disy[i]=disy[i-1]+nxt[i-1];
	repr(i,Y,0) disy[i]=disy[i+1]+prv[i+1];
	rep(i,0,N) dis[i]=max(disx[i],disy[i]);
	rep(i,0,N){
		rep(j,0,N){
			if(i>X || j<X) continue;
			ll dis2[N]{}, sum=0;
			int cont=0;
			priority_queue<ll, vector<ll>, greater<ll>> pq;
			rep(k,0,N) if(i<=k && k<=j) dis2[k]=disx[k], sum+=dis2[k], cont++;
			rep(k,0,N){
				if(i<=k && k<=j) pq.push(dis[k]-dis2[k]);
				else pq.push(disy[k]-dis2[k]);
			}
			if(sum>K) continue;
			while(pq.size()){
				if(K>=sum+pq.top()) sum+=pq.top();
				else break;
				pq.pop();
				cont++;
			}
			ans=max(ans,cont);
		}
	}
	return ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1060 ms 18300 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 Incorrect 1 ms 348 KB 1st lines differ - on the 1st token, expected: '3', found: '4'
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 Incorrect 1 ms 348 KB 1st lines differ - on the 1st token, expected: '3', found: '4'
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 Incorrect 1 ms 348 KB 1st lines differ - on the 1st token, expected: '3', found: '4'
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -