Submission #1071064

# Submission time Handle Problem Language Result Execution time Memory
1071064 2024-08-23T04:04:32 Z sleepntsheep Arranging Tickets (JOI17_arranging_tickets) C++14
10 / 100
249 ms 596 KB
#include <stdio.h>
#include <algorithm>
using namespace std;

int z = 1e9, n, m, a[22], b[22], p[22];

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];
		if (a[i] > b[i]) swap(a[i], b[i]);
	}

	for (int j = 0; j < (1 << m); ++j) {
		for (int i = 0; i < n; ++i) p[i] = 0;
		for (int i = 0; i < m; ++i) {
			if ((j >> i) & 1) {
				++p[a[i]], --p[b[i]];
			} else {
				++p[0], --p[a[i]], ++p[b[i]];
			}
		}
		for (int i = 1; i < n; ++i) p[i] += p[i - 1];
		int e = *max_element(p, p + n);
		if (z > e) z = e;
	}
	printf("%d", z);
}


Compilation message

arranging_tickets.cpp: In function 'int main()':
arranging_tickets.cpp:8:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |  scanf("%d%d", &n, &m);
      |  ~~~~~^~~~~~~~~~~~~~~~
arranging_tickets.cpp:10:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |   scanf("%d%d%d", a + i, b + i, &_), --a[i], --b[i];
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 92 ms 344 KB Output is correct
2 Correct 105 ms 392 KB Output is correct
3 Correct 94 ms 348 KB Output is correct
4 Correct 95 ms 596 KB Output is correct
5 Correct 106 ms 348 KB Output is correct
6 Correct 106 ms 344 KB Output is correct
7 Correct 91 ms 348 KB Output is correct
8 Correct 98 ms 348 KB Output is correct
9 Correct 97 ms 348 KB Output is correct
10 Correct 114 ms 348 KB Output is correct
11 Correct 91 ms 400 KB Output is correct
12 Correct 96 ms 344 KB Output is correct
13 Correct 106 ms 348 KB Output is correct
14 Correct 93 ms 404 KB Output is correct
15 Correct 91 ms 388 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 92 ms 344 KB Output is correct
2 Correct 105 ms 392 KB Output is correct
3 Correct 94 ms 348 KB Output is correct
4 Correct 95 ms 596 KB Output is correct
5 Correct 106 ms 348 KB Output is correct
6 Correct 106 ms 344 KB Output is correct
7 Correct 91 ms 348 KB Output is correct
8 Correct 98 ms 348 KB Output is correct
9 Correct 97 ms 348 KB Output is correct
10 Correct 114 ms 348 KB Output is correct
11 Correct 91 ms 400 KB Output is correct
12 Correct 96 ms 344 KB Output is correct
13 Correct 106 ms 348 KB Output is correct
14 Correct 93 ms 404 KB Output is correct
15 Correct 91 ms 388 KB Output is correct
16 Incorrect 249 ms 348 KB Output isn't correct
17 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 92 ms 344 KB Output is correct
2 Correct 105 ms 392 KB Output is correct
3 Correct 94 ms 348 KB Output is correct
4 Correct 95 ms 596 KB Output is correct
5 Correct 106 ms 348 KB Output is correct
6 Correct 106 ms 344 KB Output is correct
7 Correct 91 ms 348 KB Output is correct
8 Correct 98 ms 348 KB Output is correct
9 Correct 97 ms 348 KB Output is correct
10 Correct 114 ms 348 KB Output is correct
11 Correct 91 ms 400 KB Output is correct
12 Correct 96 ms 344 KB Output is correct
13 Correct 106 ms 348 KB Output is correct
14 Correct 93 ms 404 KB Output is correct
15 Correct 91 ms 388 KB Output is correct
16 Incorrect 249 ms 348 KB Output isn't correct
17 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 92 ms 344 KB Output is correct
2 Correct 105 ms 392 KB Output is correct
3 Correct 94 ms 348 KB Output is correct
4 Correct 95 ms 596 KB Output is correct
5 Correct 106 ms 348 KB Output is correct
6 Correct 106 ms 344 KB Output is correct
7 Correct 91 ms 348 KB Output is correct
8 Correct 98 ms 348 KB Output is correct
9 Correct 97 ms 348 KB Output is correct
10 Correct 114 ms 348 KB Output is correct
11 Correct 91 ms 400 KB Output is correct
12 Correct 96 ms 344 KB Output is correct
13 Correct 106 ms 348 KB Output is correct
14 Correct 93 ms 404 KB Output is correct
15 Correct 91 ms 388 KB Output is correct
16 Incorrect 249 ms 348 KB Output isn't correct
17 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 92 ms 344 KB Output is correct
2 Correct 105 ms 392 KB Output is correct
3 Correct 94 ms 348 KB Output is correct
4 Correct 95 ms 596 KB Output is correct
5 Correct 106 ms 348 KB Output is correct
6 Correct 106 ms 344 KB Output is correct
7 Correct 91 ms 348 KB Output is correct
8 Correct 98 ms 348 KB Output is correct
9 Correct 97 ms 348 KB Output is correct
10 Correct 114 ms 348 KB Output is correct
11 Correct 91 ms 400 KB Output is correct
12 Correct 96 ms 344 KB Output is correct
13 Correct 106 ms 348 KB Output is correct
14 Correct 93 ms 404 KB Output is correct
15 Correct 91 ms 388 KB Output is correct
16 Incorrect 249 ms 348 KB Output isn't correct
17 Halted 0 ms 0 KB -