답안 #1071818

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1071818 2024-08-23T11:35:49 Z Abito Tricks of the Trade (CEOI23_trade) C++17
10 / 100
8000 ms 4700 KB
#include <bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define ppb pop_back
#define ep insert
#define endl '\n'
#define elif else if
#define pow pwr
#define sqrt sqrtt
#define int long long
#define ll long long
typedef unsigned long long ull;
using namespace std;
const int N=3e5+5;
int n,k,a[N],b[N];
bool ans[N];
int32_t main(){
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	cin>>n>>k;
	for (int i=1;i<=n;i++) cin>>a[i];
	for (int i=1;i<=n;i++) cin>>b[i];
	int mx=LLONG_MIN;
	for (int i=1;i+k-1<=n;i++){
		multiset<int> s;
		int sum=0;
		for (int j=i;j<i+k;j++){
			s.ep(b[j]);
			sum-=a[j];
			sum+=b[j];
		}
		mx=max(mx,sum);
		for (int j=i+k;j<=n;j++){
			s.ep(b[j]);
			sum-=a[j];
			sum+=b[j];
			int x=*s.begin();
			s.erase(s.begin());
			sum-=x;
			mx=max(mx,sum);
		}
	}cout<<mx<<endl;
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Partially correct 0 ms 4440 KB Partially correct
2 Partially correct 1 ms 4444 KB Partially correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 0 ms 4444 KB Partially correct
2 Partially correct 1 ms 4444 KB Partially correct
3 Partially correct 0 ms 4444 KB Partially correct
4 Partially correct 1 ms 4444 KB Partially correct
5 Partially correct 1 ms 4444 KB Partially correct
6 Partially correct 1 ms 4444 KB Partially correct
7 Partially correct 1 ms 4444 KB Partially correct
8 Partially correct 2 ms 4444 KB Partially correct
9 Partially correct 1 ms 4444 KB Partially correct
10 Partially correct 2 ms 4444 KB Partially correct
11 Partially correct 1 ms 4440 KB Partially correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 0 ms 4444 KB Partially correct
2 Partially correct 1 ms 4444 KB Partially correct
3 Partially correct 0 ms 4444 KB Partially correct
4 Partially correct 1 ms 4444 KB Partially correct
5 Partially correct 1 ms 4444 KB Partially correct
6 Partially correct 1 ms 4444 KB Partially correct
7 Partially correct 1 ms 4444 KB Partially correct
8 Partially correct 2 ms 4444 KB Partially correct
9 Partially correct 1 ms 4444 KB Partially correct
10 Partially correct 2 ms 4444 KB Partially correct
11 Partially correct 1 ms 4440 KB Partially correct
12 Partially correct 1 ms 4444 KB Partially correct
13 Partially correct 0 ms 4560 KB Partially correct
14 Partially correct 1 ms 4444 KB Partially correct
15 Partially correct 1 ms 4580 KB Partially correct
16 Partially correct 1 ms 4444 KB Partially correct
17 Partially correct 2 ms 4440 KB Partially correct
18 Partially correct 1 ms 4444 KB Partially correct
19 Partially correct 1 ms 4444 KB Partially correct
20 Partially correct 2 ms 4444 KB Partially correct
21 Partially correct 1 ms 4444 KB Partially correct
22 Partially correct 1 ms 4560 KB Partially correct
23 Partially correct 2 ms 4700 KB Partially correct
24 Partially correct 364 ms 4616 KB Partially correct
25 Partially correct 1075 ms 4648 KB Partially correct
26 Partially correct 788 ms 4444 KB Partially correct
27 Partially correct 849 ms 4700 KB Partially correct
28 Partially correct 350 ms 4444 KB Partially correct
29 Partially correct 1151 ms 4700 KB Partially correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 1 ms 4444 KB Partially correct
2 Execution timed out 8086 ms 4700 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 1 ms 4444 KB Partially correct
2 Execution timed out 8086 ms 4700 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 0 ms 4440 KB Partially correct
2 Partially correct 1 ms 4444 KB Partially correct
3 Partially correct 0 ms 4444 KB Partially correct
4 Partially correct 1 ms 4444 KB Partially correct
5 Partially correct 0 ms 4444 KB Partially correct
6 Partially correct 1 ms 4444 KB Partially correct
7 Partially correct 1 ms 4444 KB Partially correct
8 Partially correct 1 ms 4444 KB Partially correct
9 Partially correct 1 ms 4444 KB Partially correct
10 Partially correct 2 ms 4444 KB Partially correct
11 Partially correct 1 ms 4444 KB Partially correct
12 Partially correct 2 ms 4444 KB Partially correct
13 Partially correct 1 ms 4440 KB Partially correct
14 Partially correct 1 ms 4444 KB Partially correct
15 Partially correct 0 ms 4560 KB Partially correct
16 Partially correct 1 ms 4444 KB Partially correct
17 Partially correct 1 ms 4580 KB Partially correct
18 Partially correct 1 ms 4444 KB Partially correct
19 Partially correct 2 ms 4440 KB Partially correct
20 Partially correct 1 ms 4444 KB Partially correct
21 Partially correct 1 ms 4444 KB Partially correct
22 Partially correct 2 ms 4444 KB Partially correct
23 Partially correct 1 ms 4444 KB Partially correct
24 Partially correct 1 ms 4560 KB Partially correct
25 Partially correct 2 ms 4700 KB Partially correct
26 Partially correct 364 ms 4616 KB Partially correct
27 Partially correct 1075 ms 4648 KB Partially correct
28 Partially correct 788 ms 4444 KB Partially correct
29 Partially correct 849 ms 4700 KB Partially correct
30 Partially correct 350 ms 4444 KB Partially correct
31 Partially correct 1151 ms 4700 KB Partially correct
32 Partially correct 1 ms 4444 KB Partially correct
33 Execution timed out 8086 ms 4700 KB Time limit exceeded
34 Halted 0 ms 0 KB -