Submission #222467

# Submission time Handle Problem Language Result Execution time Memory
222467 2020-04-13T07:56:38 Z shenxy Checker (COCI19_checker) C++11
110 / 110
927 ms 37856 KB
#include <cstdio>
#include <algorithm>
#include <map>
#include <set>
using namespace std;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
int main() {
	int N;
	scanf("%d", &N);
	scanf("%d", &N);
	map<ii, char> edges;
	char edge;
	for (int i = 0; i < N; ++i) {
		scanf(" %c", &edge);
		edges[ii(min(i, (i + 1) % N), max(i, (i + 1) % N))] = edge;
	}
	int X, Y;
	set<int> rempts;
	set<iii> vulpts;
	for (int i = 0; i < N; ++i) rempts.insert(i);
	for (int i = 0; i < N - 3; ++i) {
		scanf("%d %d %c", &X, &Y, &edge);
		edges[ii(min(X - 1, Y - 1), max(X - 1, Y - 1))] = edge;
		if (min(X, Y) == 1 && max(X, Y) == N - 1) vulpts.insert(iii(N - 1, ii(N - 2, 0)));
		else if (min(X, Y) == 2 && max(X, Y) == N) vulpts.insert(iii(0, ii(N - 1, 1)));
		else if (max(X, Y) - min(X, Y) == 2) vulpts.insert(iii(min(X, Y), ii(min(X, Y) - 1, max(X, Y) - 1)));
	}
	bool patriot = true;
	for (int i = 0; i < N - 2; ++i) {
		if (vulpts.empty()) {
			printf("neispravna triangulacija");
			return 0;
		}
		iii vr = *vulpts.begin();
		int a = vr.first, b = *(rempts.find(a) == rempts.begin() ? --rempts.end() : --rempts.find(a)), c = *(rempts.find(a) == --rempts.end() ? rempts.begin() : ++rempts.find(a));
		if (b != vr.second.first || c != vr.second.second) {
			printf("neispravna triangulacija");
			return 0;
		}
		vulpts.erase(vr);
		rempts.erase(a);
		if (edges[ii(min(a, b), max(a, b))] == edges[ii(min(a, c), max(a, c))] || edges[ii(min(a, b), max(a, b))] == edges[ii(min(b, c), max(b, c))] || edges[ii(min(c, b), max(c, b))] == edges[ii(min(a, c), max(a, c))]) patriot = false;
		int d = *(rempts.find(b) == rempts.begin() ? --rempts.end() : --rempts.find(b)), e = *(rempts.find(c) == --rempts.end() ? rempts.begin() : ++rempts.find(c));
		if (edges.find(ii(min(c, d), max(c, d))) != edges.end()) vulpts.insert(iii(b, ii(d, c)));
		if (edges.find(ii(min(b, e), max(b, e))) != edges.end()) vulpts.insert(iii(c, ii(b, e)));
	}
	if (patriot) printf("tocno");
	else printf("neispravno bojenje" );
	return 0;
}

Compilation message

checker.cpp: In function 'int main()':
checker.cpp:10:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &N);
  ~~~~~^~~~~~~~~~
checker.cpp:11:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &N);
  ~~~~~^~~~~~~~~~
checker.cpp:15:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf(" %c", &edge);
   ~~~~~^~~~~~~~~~~~~~
checker.cpp:23:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d %c", &X, &Y, &edge);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Correct 4 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Correct 4 ms 256 KB Output is correct
8 Correct 9 ms 640 KB Output is correct
9 Correct 9 ms 640 KB Output is correct
10 Correct 9 ms 640 KB Output is correct
11 Correct 8 ms 640 KB Output is correct
12 Correct 9 ms 640 KB Output is correct
13 Correct 9 ms 640 KB Output is correct
14 Correct 9 ms 640 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 912 ms 37724 KB Output is correct
2 Correct 889 ms 37740 KB Output is correct
3 Correct 884 ms 37672 KB Output is correct
4 Correct 856 ms 37752 KB Output is correct
5 Correct 851 ms 37752 KB Output is correct
6 Correct 691 ms 34936 KB Output is correct
7 Correct 629 ms 34808 KB Output is correct
8 Correct 451 ms 34680 KB Output is correct
9 Correct 476 ms 34808 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 897 ms 37752 KB Output is correct
2 Correct 876 ms 37752 KB Output is correct
3 Correct 903 ms 37736 KB Output is correct
4 Correct 917 ms 37668 KB Output is correct
5 Correct 927 ms 37724 KB Output is correct
6 Correct 675 ms 34784 KB Output is correct
7 Correct 666 ms 34796 KB Output is correct
8 Correct 681 ms 34836 KB Output is correct
9 Correct 647 ms 34796 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Correct 4 ms 256 KB Output is correct
8 Correct 9 ms 640 KB Output is correct
9 Correct 9 ms 640 KB Output is correct
10 Correct 9 ms 640 KB Output is correct
11 Correct 8 ms 640 KB Output is correct
12 Correct 9 ms 640 KB Output is correct
13 Correct 9 ms 640 KB Output is correct
14 Correct 9 ms 640 KB Output is correct
15 Correct 912 ms 37724 KB Output is correct
16 Correct 889 ms 37740 KB Output is correct
17 Correct 884 ms 37672 KB Output is correct
18 Correct 856 ms 37752 KB Output is correct
19 Correct 851 ms 37752 KB Output is correct
20 Correct 691 ms 34936 KB Output is correct
21 Correct 629 ms 34808 KB Output is correct
22 Correct 451 ms 34680 KB Output is correct
23 Correct 476 ms 34808 KB Output is correct
24 Correct 897 ms 37752 KB Output is correct
25 Correct 876 ms 37752 KB Output is correct
26 Correct 903 ms 37736 KB Output is correct
27 Correct 917 ms 37668 KB Output is correct
28 Correct 927 ms 37724 KB Output is correct
29 Correct 675 ms 34784 KB Output is correct
30 Correct 666 ms 34796 KB Output is correct
31 Correct 681 ms 34836 KB Output is correct
32 Correct 647 ms 34796 KB Output is correct
33 Correct 916 ms 37752 KB Output is correct
34 Correct 896 ms 37856 KB Output is correct
35 Correct 900 ms 37760 KB Output is correct
36 Correct 875 ms 37628 KB Output is correct
37 Correct 910 ms 37676 KB Output is correct
38 Correct 910 ms 37728 KB Output is correct
39 Correct 904 ms 37716 KB Output is correct
40 Correct 733 ms 34796 KB Output is correct
41 Correct 657 ms 34808 KB Output is correct
42 Correct 668 ms 34808 KB Output is correct
43 Correct 663 ms 34680 KB Output is correct