답안 #550253

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
550253 2022-04-17T17:32:22 Z Antekb 치료 계획 (JOI20_treatment) C++14
35 / 100
3000 ms 5968 KB
#include<bits/stdc++.h>
#define st first
#define nd second
using namespace std;
using ll = long long;
const int N=1<<17;
const ll INF=1e18;
ll dist[N];
bool vis[N];
int main(){
	int l, n;
	cin>>l>>n;
	vector<pair<pair<int, int>, pair<int, int>> > V(n);
	for(int i=0; i<n; ++i){
		cin>>V[i].nd.st>>V[i].st.st>>V[i].st.nd>>V[i].nd.nd;
		V[i].st.st--;
	}
	for(int i=0; i<n; i++){
		if(V[i].st.st)dist[i]=INF;
		else dist[i]=V[i].nd.nd;
	}
	for(int ii=0; ii<n; ii++){
		int opt=0;
		for(int j=0; j<n; j++){
			//cout<<dist[j]<<" \n"[j==n-1];
			if(!vis[j] && (vis[opt] || dist[j]<dist[opt]))opt=j;
		}
		vis[opt]=1;
		if(V[opt].st.nd==l && dist[opt]!=INF){
			cout<<dist[opt];
			return 0;
		}
		for(int i=0; i<n; i++){
			if(V[i].st.st+V[i].nd.st<=V[opt].st.nd+V[opt].nd.st 
				&& V[i].st.st-V[i].nd.st<=V[opt].st.nd-V[opt].nd.st){
				if(dist[i]>V[i].nd.nd+dist[opt]){
					dist[i]=V[i].nd.nd+dist[opt];
				}
			}
		}
	}
	cout<<-1;
}
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3079 ms 5968 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 312 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 312 KB Output is correct
7 Correct 0 ms 308 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 304 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 0 ms 308 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 312 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 312 KB Output is correct
7 Correct 0 ms 308 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 304 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 0 ms 308 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 145 ms 468 KB Output is correct
21 Correct 141 ms 532 KB Output is correct
22 Correct 168 ms 600 KB Output is correct
23 Correct 161 ms 600 KB Output is correct
24 Correct 17 ms 576 KB Output is correct
25 Correct 87 ms 612 KB Output is correct
26 Correct 81 ms 628 KB Output is correct
27 Correct 79 ms 612 KB Output is correct
28 Correct 19 ms 504 KB Output is correct
29 Correct 80 ms 628 KB Output is correct
30 Correct 74 ms 608 KB Output is correct
31 Correct 78 ms 628 KB Output is correct
32 Correct 9 ms 596 KB Output is correct
33 Correct 11 ms 576 KB Output is correct
34 Correct 178 ms 584 KB Output is correct
35 Correct 7 ms 592 KB Output is correct
36 Correct 6 ms 576 KB Output is correct
37 Correct 155 ms 468 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3079 ms 5968 KB Time limit exceeded
2 Halted 0 ms 0 KB -