Submission #29005

# Submission time Handle Problem Language Result Execution time Memory
29005 2017-07-18T05:39:49 Z 김동현(#1169) Arranging Tickets (JOI17_arranging_tickets) C++14
0 / 100
633 ms 2020 KB
#include <bits/stdc++.h>
using namespace std;

int n, m, a[22], b[22], c[22], ans;

int main(){
	scanf("%d%d", &n, &m);
	for(int i = 0, _; i < m; i++){
		scanf("%d%d%d", a + i, b + i, &_);
		a[i]--; b[i]--;
	}
	ans = m;
	for(int i = 0; i < (1 << m); i++){
		fill(c, c + n, 0);
		for(int j = 0; j < m; j++){
			for(int k = 0; k < n; k++){
				c[k] += ((i >> j) & 1) ^ (a[j] <= k && k < b[j]);
			}
		}
		ans = min(ans, *max_element(c, c + n));
	}
	printf("%d\n", ans);
}

Compilation message

arranging_tickets.cpp: In function 'int main()':
arranging_tickets.cpp:7:23: 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:9:36: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d%d", a + i, b + i, &_);
                                    ^
# Verdict Execution time Memory Grader output
1 Incorrect 633 ms 2020 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 633 ms 2020 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 633 ms 2020 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 633 ms 2020 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 633 ms 2020 KB Output isn't correct
2 Halted 0 ms 0 KB -