답안 #234765

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
234765 2020-05-25T13:54:06 Z amoo_safar Segway (COI19_segway) C++14
40 / 100
1000 ms 972 KB
#include <bits/stdc++.h>

#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define debug(x) cerr << #x << " : " << x << '\n'

using namespace std;

typedef long long ll;
typedef long double ld;
typedef string str;
typedef pair<ll, ll> pll;

const ll Mod = 1000000007LL;
const int N = 2e4 + 10;
const ll Inf = 2242545357980376863LL;
const ll Log = 30;

bool acc[310];
int n;
int s1[N], s2[N], s3[N];
int rm[N];
int wh[N], rmt[N], pas[N], ans[N];

int Speed(int i){
	if(rm[i]) return 1;
	if(wh[i] < 100) return s1[i];
	if(wh[i] < 200) return s2[i];
	if(wh[i] < 300) return s3[i];
	return 1e9;
}

int main(){
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n;
	for(int i = 1; i <= n; i++) cin >> s1[i] >> s2[i] >> s3[i];
	int m;
	cin >> m;
	int pos;
	for(int i = 0; i < m; i++){
		cin >> pos;
		acc[pos] = true;
	}
	for(int i = 1; i <= n; i++) rmt[i] = Speed(i);

	int T = 0;
	while(true){
		int del = *min_element(rmt + 1, rmt + n + 1);
		if(del > 50) break;
		for(int i = 1; i <= n; i++){
			if(rmt[i] == Speed(i)) pas[wh[i]] ++;
		}
		T += del;
		for(int i = 1; i <= n; i++){
			rmt[i] -= del;
			if(rmt[i] == 0){
				if(rm[i]) rm[i] --;
				wh[i] ++;
				if(acc[wh[i]] && rm[i] == 0){
					rm[i] += pas[wh[i]] % 20;
				}
				rmt[i] = Speed(i);
				if(wh[i] == 300) ans[i] = T;
			}
		}
	}
	for(int i = 1; i <= n; i++) cout << ans[i] << '\n';
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 16 ms 384 KB Output is correct
3 Correct 58 ms 384 KB Output is correct
4 Correct 232 ms 512 KB Output is correct
5 Execution timed out 1091 ms 972 KB Time limit exceeded
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 7 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 6 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 8 ms 384 KB Output is correct
8 Correct 11 ms 384 KB Output is correct
9 Correct 12 ms 384 KB Output is correct
10 Correct 17 ms 384 KB Output is correct
11 Correct 8 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 16 ms 384 KB Output is correct
3 Correct 58 ms 384 KB Output is correct
4 Correct 232 ms 512 KB Output is correct
5 Execution timed out 1091 ms 972 KB Time limit exceeded