답안 #261247

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
261247 2020-08-11T15:19:50 Z Saboon 치료 계획 (JOI20_treatment) C++14
5 / 100
3000 ms 6136 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll maxn = 2e5 + 10;
 
ll T[maxn], L[maxn], R[maxn], C[maxn], p[maxn], dp[maxn];
 
int main(){
	ios_base::sync_with_stdio(false);
	ll n, m;
	cin >> n >> m;
	for (ll i = 1; i <= m; i++)
		cin >> T[i] >> L[i] >> R[i] >> C[i];
	for (ll i = 1; i <= m; i++)
		p[i] = i;
	memset(dp, -1, sizeof dp);
	for (ll _ = 0; _ < m; _++){
		for (ll iit = 1; iit <= m; iit++){
			ll i = p[iit];
			if (L[i] == 1)
				dp[i] = C[i];
			for (ll jit = 1; jit <= m; jit++){
				ll j = p[jit];
				if (abs(T[i]-T[j]) <= R[j]-L[i]+1 and dp[j] != -1)
					if (dp[i] == -1 or dp[i] > dp[j] + C[i])
						dp[i] = dp[j] + C[i];
			}
		}
	}
	ll answer = -1;
	for (ll i = 1; i <= m; i++)
		if (R[i] == n and dp[i] != -1 and (answer == -1 or answer > dp[i]))
			answer = dp[i];
	cout << answer << endl;
}
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3060 ms 6136 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1920 KB Output is correct
2 Correct 1 ms 1920 KB Output is correct
3 Correct 2 ms 1920 KB Output is correct
4 Correct 1 ms 1920 KB Output is correct
5 Correct 2 ms 1920 KB Output is correct
6 Correct 2 ms 1920 KB Output is correct
7 Correct 2 ms 1920 KB Output is correct
8 Correct 2 ms 1912 KB Output is correct
9 Correct 2 ms 1932 KB Output is correct
10 Correct 2 ms 1920 KB Output is correct
11 Correct 2 ms 1920 KB Output is correct
12 Correct 2 ms 1920 KB Output is correct
13 Correct 1 ms 1920 KB Output is correct
14 Correct 2 ms 1920 KB Output is correct
15 Correct 2 ms 1920 KB Output is correct
16 Correct 2 ms 1920 KB Output is correct
17 Correct 1 ms 1920 KB Output is correct
18 Correct 2 ms 1920 KB Output is correct
19 Correct 1 ms 1920 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1920 KB Output is correct
2 Correct 1 ms 1920 KB Output is correct
3 Correct 2 ms 1920 KB Output is correct
4 Correct 1 ms 1920 KB Output is correct
5 Correct 2 ms 1920 KB Output is correct
6 Correct 2 ms 1920 KB Output is correct
7 Correct 2 ms 1920 KB Output is correct
8 Correct 2 ms 1912 KB Output is correct
9 Correct 2 ms 1932 KB Output is correct
10 Correct 2 ms 1920 KB Output is correct
11 Correct 2 ms 1920 KB Output is correct
12 Correct 2 ms 1920 KB Output is correct
13 Correct 1 ms 1920 KB Output is correct
14 Correct 2 ms 1920 KB Output is correct
15 Correct 2 ms 1920 KB Output is correct
16 Correct 2 ms 1920 KB Output is correct
17 Correct 1 ms 1920 KB Output is correct
18 Correct 2 ms 1920 KB Output is correct
19 Correct 1 ms 1920 KB Output is correct
20 Execution timed out 3013 ms 2176 KB Time limit exceeded
21 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3060 ms 6136 KB Time limit exceeded
2 Halted 0 ms 0 KB -