답안 #313355

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
313355 2020-10-15T21:04:05 Z sofapuden Collecting Stamps 3 (JOI20_ho_t3) C++14
0 / 100
1 ms 256 KB
#include <bits/stdc++.h>

using namespace std;

int main(){
	int n, l; cin >> n >> l;
	vector<int> X(n), T(n);
	for(auto &x : X)cin >> x;
	for(auto &t : T)cin >> t;
	int ans = 0;
	for(int i = 0; i <= n; ++i){
		int cur = 0;
		int tim = 0;
		int place = l; 
		for(int j = 1; j <= i; ++j){
			tim+=place-X[n-j];
			place = X[n-j];
			if(tim <= T[n-j])cur++;
		}
		tim*=2;
		place = 0;
		for(int j = 0; j < n-i; ++j){
			tim+=X[j]-place;
			place = X[j];
			if(tim <= T[j])cur++;
		}
		ans = max(ans,cur);
	}
	for(int i = 0; i <= n; ++i){
		int cur = 0;
		int tim = 0;
		int place = 0; 
		for(int j = 0; j < i; ++j){
			tim+=X[j]-place;
			place = X[j];
			if(tim <= T[j])cur++;
		}
		tim*=2;
		place = l;
		for(int j = 1; j <= n-i; ++j){
			tim+=place-X[n-j];
			place = X[n-j];
			if(tim <= T[n-j])cur++;
		}
		ans = max(ans,cur);
	}
	cout << ans << "\n";
			
			
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Incorrect 0 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Incorrect 0 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Incorrect 0 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Incorrect 0 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -