Submission #29039

# Submission time Handle Problem Language Result Execution time Memory
29039 2017-07-18T07:18:22 Z 김현수(#1170) Arranging Tickets (JOI17_arranging_tickets) C++14
10 / 100
99 ms 2020 KB
#include<bits/stdc++.h>
using namespace std;
const int N = 25;

int n, m, s[N], e[N], v[N], ans = 1e9;

void solve (int I) {
	if(I > m) {
		int V = 0;
		for(int i=1;i<=n;i++) {
			V = max(V, v[i]);
		}
		ans = min(V, ans);
		return;
	}
	for(int i=s[I];i<e[I];i++) v[i] += 1;
	solve(I+1);
	for(int i=s[I];i<e[I];i++) v[i] -= 2;
	for(int i=1;i<=n;i++) v[i] += 1;
	solve(I+1);
	for(int i=s[I];i<e[I];i++) v[i] += 1;
	for(int i=1;i<=n;i++) v[i] -= 1;
}

int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++) {
		int A, B, C;
		scanf("%d%d%d",&A,&B,&C);
		if(A > B) swap(A, B);
		s[i] = A; e[i] = B;
	}
	solve(1);
	printf("%d\n",ans);
}

Compilation message

arranging_tickets.cpp: In function 'int main()':
arranging_tickets.cpp:27:21: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d",&n,&m);
                     ^
arranging_tickets.cpp:30:27: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d%d",&A,&B,&C);
                           ^
# Verdict Execution time Memory Grader output
1 Correct 69 ms 2020 KB Output is correct
2 Correct 66 ms 2020 KB Output is correct
3 Correct 66 ms 2020 KB Output is correct
4 Correct 59 ms 2020 KB Output is correct
5 Correct 69 ms 2020 KB Output is correct
6 Correct 76 ms 2020 KB Output is correct
7 Correct 66 ms 2020 KB Output is correct
8 Correct 63 ms 2020 KB Output is correct
9 Correct 69 ms 2020 KB Output is correct
10 Correct 59 ms 2020 KB Output is correct
11 Correct 59 ms 2020 KB Output is correct
12 Correct 79 ms 2020 KB Output is correct
13 Correct 66 ms 2020 KB Output is correct
14 Correct 99 ms 2020 KB Output is correct
15 Correct 69 ms 2020 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 69 ms 2020 KB Output is correct
2 Correct 66 ms 2020 KB Output is correct
3 Correct 66 ms 2020 KB Output is correct
4 Correct 59 ms 2020 KB Output is correct
5 Correct 69 ms 2020 KB Output is correct
6 Correct 76 ms 2020 KB Output is correct
7 Correct 66 ms 2020 KB Output is correct
8 Correct 63 ms 2020 KB Output is correct
9 Correct 69 ms 2020 KB Output is correct
10 Correct 59 ms 2020 KB Output is correct
11 Correct 59 ms 2020 KB Output is correct
12 Correct 79 ms 2020 KB Output is correct
13 Correct 66 ms 2020 KB Output is correct
14 Correct 99 ms 2020 KB Output is correct
15 Correct 69 ms 2020 KB Output is correct
16 Runtime error 0 ms 2020 KB Execution killed with signal 11 (could be triggered by violating memory limits)
17 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 69 ms 2020 KB Output is correct
2 Correct 66 ms 2020 KB Output is correct
3 Correct 66 ms 2020 KB Output is correct
4 Correct 59 ms 2020 KB Output is correct
5 Correct 69 ms 2020 KB Output is correct
6 Correct 76 ms 2020 KB Output is correct
7 Correct 66 ms 2020 KB Output is correct
8 Correct 63 ms 2020 KB Output is correct
9 Correct 69 ms 2020 KB Output is correct
10 Correct 59 ms 2020 KB Output is correct
11 Correct 59 ms 2020 KB Output is correct
12 Correct 79 ms 2020 KB Output is correct
13 Correct 66 ms 2020 KB Output is correct
14 Correct 99 ms 2020 KB Output is correct
15 Correct 69 ms 2020 KB Output is correct
16 Runtime error 0 ms 2020 KB Execution killed with signal 11 (could be triggered by violating memory limits)
17 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 69 ms 2020 KB Output is correct
2 Correct 66 ms 2020 KB Output is correct
3 Correct 66 ms 2020 KB Output is correct
4 Correct 59 ms 2020 KB Output is correct
5 Correct 69 ms 2020 KB Output is correct
6 Correct 76 ms 2020 KB Output is correct
7 Correct 66 ms 2020 KB Output is correct
8 Correct 63 ms 2020 KB Output is correct
9 Correct 69 ms 2020 KB Output is correct
10 Correct 59 ms 2020 KB Output is correct
11 Correct 59 ms 2020 KB Output is correct
12 Correct 79 ms 2020 KB Output is correct
13 Correct 66 ms 2020 KB Output is correct
14 Correct 99 ms 2020 KB Output is correct
15 Correct 69 ms 2020 KB Output is correct
16 Runtime error 0 ms 2020 KB Execution killed with signal 11 (could be triggered by violating memory limits)
17 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 69 ms 2020 KB Output is correct
2 Correct 66 ms 2020 KB Output is correct
3 Correct 66 ms 2020 KB Output is correct
4 Correct 59 ms 2020 KB Output is correct
5 Correct 69 ms 2020 KB Output is correct
6 Correct 76 ms 2020 KB Output is correct
7 Correct 66 ms 2020 KB Output is correct
8 Correct 63 ms 2020 KB Output is correct
9 Correct 69 ms 2020 KB Output is correct
10 Correct 59 ms 2020 KB Output is correct
11 Correct 59 ms 2020 KB Output is correct
12 Correct 79 ms 2020 KB Output is correct
13 Correct 66 ms 2020 KB Output is correct
14 Correct 99 ms 2020 KB Output is correct
15 Correct 69 ms 2020 KB Output is correct
16 Runtime error 0 ms 2020 KB Execution killed with signal 11 (could be triggered by violating memory limits)
17 Halted 0 ms 0 KB -