답안 #100896

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
100896 2019-03-15T03:51:34 Z autumn_eel Telegraph (JOI16_telegraph) C++14
10 / 100
254 ms 512 KB
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

int a[20],c[20];
int main(){
	int n;cin>>n;
	if(n>10)abort();
	vector<int>v;
	rep(i,n){
		v.push_back(i);
	}
	rep(i,n){
		scanf("%d%d",&a[i],&c[i]);a[i]--;
	}
	ll Min=LLONG_MAX;
	do{
		ll cnt=0;
		rep(i,n){
			if(v[(i+n-1)%n]!=a[v[i]])cnt+=c[v[i]];
		}
		Min=min(Min,cnt);
	}while(next_permutation(v.begin(),v.end()));
	cout<<Min<<endl;
}

Compilation message

telegraph.cpp: In function 'int main()':
telegraph.cpp:16:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d",&a[i],&c[i]);a[i]--;
   ~~~~~^~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 218 ms 512 KB Output is correct
2 Correct 210 ms 504 KB Output is correct
3 Correct 221 ms 256 KB Output is correct
4 Correct 231 ms 256 KB Output is correct
5 Correct 201 ms 376 KB Output is correct
6 Correct 206 ms 512 KB Output is correct
7 Correct 200 ms 356 KB Output is correct
8 Correct 207 ms 504 KB Output is correct
9 Correct 209 ms 384 KB Output is correct
10 Correct 226 ms 504 KB Output is correct
11 Correct 209 ms 508 KB Output is correct
12 Correct 236 ms 256 KB Output is correct
13 Correct 205 ms 256 KB Output is correct
14 Correct 199 ms 356 KB Output is correct
15 Correct 228 ms 384 KB Output is correct
16 Correct 208 ms 384 KB Output is correct
17 Correct 204 ms 256 KB Output is correct
18 Correct 194 ms 384 KB Output is correct
19 Correct 201 ms 384 KB Output is correct
20 Correct 205 ms 384 KB Output is correct
21 Correct 183 ms 384 KB Output is correct
22 Correct 213 ms 504 KB Output is correct
23 Correct 254 ms 504 KB Output is correct
24 Correct 232 ms 384 KB Output is correct
25 Correct 226 ms 504 KB Output is correct
26 Correct 212 ms 256 KB Output is correct
27 Correct 217 ms 504 KB Output is correct
28 Correct 213 ms 360 KB Output is correct
29 Correct 202 ms 504 KB Output is correct
30 Correct 203 ms 384 KB Output is correct
31 Correct 221 ms 384 KB Output is correct
32 Correct 215 ms 384 KB Output is correct
33 Correct 209 ms 504 KB Output is correct
34 Correct 209 ms 384 KB Output is correct
35 Correct 203 ms 504 KB Output is correct
36 Correct 224 ms 504 KB Output is correct
37 Correct 164 ms 384 KB Output is correct
38 Correct 163 ms 384 KB Output is correct
39 Correct 212 ms 384 KB Output is correct
40 Correct 210 ms 384 KB Output is correct
41 Correct 3 ms 384 KB Output is correct
42 Correct 2 ms 256 KB Output is correct
43 Correct 2 ms 384 KB Output is correct
44 Correct 3 ms 256 KB Output is correct
45 Correct 4 ms 384 KB Output is correct
46 Correct 2 ms 384 KB Output is correct
47 Correct 212 ms 476 KB Output is correct
48 Correct 202 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 218 ms 512 KB Output is correct
2 Correct 210 ms 504 KB Output is correct
3 Correct 221 ms 256 KB Output is correct
4 Correct 231 ms 256 KB Output is correct
5 Correct 201 ms 376 KB Output is correct
6 Correct 206 ms 512 KB Output is correct
7 Correct 200 ms 356 KB Output is correct
8 Correct 207 ms 504 KB Output is correct
9 Correct 209 ms 384 KB Output is correct
10 Correct 226 ms 504 KB Output is correct
11 Correct 209 ms 508 KB Output is correct
12 Correct 236 ms 256 KB Output is correct
13 Correct 205 ms 256 KB Output is correct
14 Correct 199 ms 356 KB Output is correct
15 Correct 228 ms 384 KB Output is correct
16 Correct 208 ms 384 KB Output is correct
17 Correct 204 ms 256 KB Output is correct
18 Correct 194 ms 384 KB Output is correct
19 Correct 201 ms 384 KB Output is correct
20 Correct 205 ms 384 KB Output is correct
21 Correct 183 ms 384 KB Output is correct
22 Correct 213 ms 504 KB Output is correct
23 Correct 254 ms 504 KB Output is correct
24 Correct 232 ms 384 KB Output is correct
25 Correct 226 ms 504 KB Output is correct
26 Correct 212 ms 256 KB Output is correct
27 Correct 217 ms 504 KB Output is correct
28 Correct 213 ms 360 KB Output is correct
29 Correct 202 ms 504 KB Output is correct
30 Correct 203 ms 384 KB Output is correct
31 Correct 221 ms 384 KB Output is correct
32 Correct 215 ms 384 KB Output is correct
33 Correct 209 ms 504 KB Output is correct
34 Correct 209 ms 384 KB Output is correct
35 Correct 203 ms 504 KB Output is correct
36 Correct 224 ms 504 KB Output is correct
37 Correct 164 ms 384 KB Output is correct
38 Correct 163 ms 384 KB Output is correct
39 Correct 212 ms 384 KB Output is correct
40 Correct 210 ms 384 KB Output is correct
41 Correct 3 ms 384 KB Output is correct
42 Correct 2 ms 256 KB Output is correct
43 Correct 2 ms 384 KB Output is correct
44 Correct 3 ms 256 KB Output is correct
45 Correct 4 ms 384 KB Output is correct
46 Correct 2 ms 384 KB Output is correct
47 Correct 212 ms 476 KB Output is correct
48 Correct 202 ms 256 KB Output is correct
49 Runtime error 3 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
50 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 218 ms 512 KB Output is correct
2 Correct 210 ms 504 KB Output is correct
3 Correct 221 ms 256 KB Output is correct
4 Correct 231 ms 256 KB Output is correct
5 Correct 201 ms 376 KB Output is correct
6 Correct 206 ms 512 KB Output is correct
7 Correct 200 ms 356 KB Output is correct
8 Correct 207 ms 504 KB Output is correct
9 Correct 209 ms 384 KB Output is correct
10 Correct 226 ms 504 KB Output is correct
11 Correct 209 ms 508 KB Output is correct
12 Correct 236 ms 256 KB Output is correct
13 Correct 205 ms 256 KB Output is correct
14 Correct 199 ms 356 KB Output is correct
15 Correct 228 ms 384 KB Output is correct
16 Correct 208 ms 384 KB Output is correct
17 Correct 204 ms 256 KB Output is correct
18 Correct 194 ms 384 KB Output is correct
19 Correct 201 ms 384 KB Output is correct
20 Correct 205 ms 384 KB Output is correct
21 Correct 183 ms 384 KB Output is correct
22 Correct 213 ms 504 KB Output is correct
23 Correct 254 ms 504 KB Output is correct
24 Correct 232 ms 384 KB Output is correct
25 Correct 226 ms 504 KB Output is correct
26 Correct 212 ms 256 KB Output is correct
27 Correct 217 ms 504 KB Output is correct
28 Correct 213 ms 360 KB Output is correct
29 Correct 202 ms 504 KB Output is correct
30 Correct 203 ms 384 KB Output is correct
31 Correct 221 ms 384 KB Output is correct
32 Correct 215 ms 384 KB Output is correct
33 Correct 209 ms 504 KB Output is correct
34 Correct 209 ms 384 KB Output is correct
35 Correct 203 ms 504 KB Output is correct
36 Correct 224 ms 504 KB Output is correct
37 Correct 164 ms 384 KB Output is correct
38 Correct 163 ms 384 KB Output is correct
39 Correct 212 ms 384 KB Output is correct
40 Correct 210 ms 384 KB Output is correct
41 Correct 3 ms 384 KB Output is correct
42 Correct 2 ms 256 KB Output is correct
43 Correct 2 ms 384 KB Output is correct
44 Correct 3 ms 256 KB Output is correct
45 Correct 4 ms 384 KB Output is correct
46 Correct 2 ms 384 KB Output is correct
47 Correct 212 ms 476 KB Output is correct
48 Correct 202 ms 256 KB Output is correct
49 Runtime error 3 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
50 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 218 ms 512 KB Output is correct
2 Correct 210 ms 504 KB Output is correct
3 Correct 221 ms 256 KB Output is correct
4 Correct 231 ms 256 KB Output is correct
5 Correct 201 ms 376 KB Output is correct
6 Correct 206 ms 512 KB Output is correct
7 Correct 200 ms 356 KB Output is correct
8 Correct 207 ms 504 KB Output is correct
9 Correct 209 ms 384 KB Output is correct
10 Correct 226 ms 504 KB Output is correct
11 Correct 209 ms 508 KB Output is correct
12 Correct 236 ms 256 KB Output is correct
13 Correct 205 ms 256 KB Output is correct
14 Correct 199 ms 356 KB Output is correct
15 Correct 228 ms 384 KB Output is correct
16 Correct 208 ms 384 KB Output is correct
17 Correct 204 ms 256 KB Output is correct
18 Correct 194 ms 384 KB Output is correct
19 Correct 201 ms 384 KB Output is correct
20 Correct 205 ms 384 KB Output is correct
21 Correct 183 ms 384 KB Output is correct
22 Correct 213 ms 504 KB Output is correct
23 Correct 254 ms 504 KB Output is correct
24 Correct 232 ms 384 KB Output is correct
25 Correct 226 ms 504 KB Output is correct
26 Correct 212 ms 256 KB Output is correct
27 Correct 217 ms 504 KB Output is correct
28 Correct 213 ms 360 KB Output is correct
29 Correct 202 ms 504 KB Output is correct
30 Correct 203 ms 384 KB Output is correct
31 Correct 221 ms 384 KB Output is correct
32 Correct 215 ms 384 KB Output is correct
33 Correct 209 ms 504 KB Output is correct
34 Correct 209 ms 384 KB Output is correct
35 Correct 203 ms 504 KB Output is correct
36 Correct 224 ms 504 KB Output is correct
37 Correct 164 ms 384 KB Output is correct
38 Correct 163 ms 384 KB Output is correct
39 Correct 212 ms 384 KB Output is correct
40 Correct 210 ms 384 KB Output is correct
41 Correct 3 ms 384 KB Output is correct
42 Correct 2 ms 256 KB Output is correct
43 Correct 2 ms 384 KB Output is correct
44 Correct 3 ms 256 KB Output is correct
45 Correct 4 ms 384 KB Output is correct
46 Correct 2 ms 384 KB Output is correct
47 Correct 212 ms 476 KB Output is correct
48 Correct 202 ms 256 KB Output is correct
49 Runtime error 3 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
50 Halted 0 ms 0 KB -