Submission #1027655

# Submission time Handle Problem Language Result Execution time Memory
1027655 2024-07-19T08:28:56 Z 변재우(#10954) None (JOI16_dungeon2) C++14
0 / 100
11 ms 604 KB
#include "dungeon2.h"
#include <bits/stdc++.h>
using namespace std;

int cnt=0;

void Set1(bool flag) {
	int P=LastRoad(), K=NumberOfRoads();
	if(Color()==1) {
		if(flag) Move(P, 1); return;
	}
	for(int i=1; i<=K; i++) Move(i, 1), Set1(true);
	if(flag) Move(P, 1);
}

void Set2(bool flag) {
	int P=LastRoad(), K=NumberOfRoads(), C=Color();
	if(C!=2) {
		if(flag) Move(P, C); return;
	}
	for(int i=1; i<=K; i++) Move(i, 1), Set2(true);
	if(flag) Move(P, 1);
}

void Count(int x, bool flag) {
	int P=LastRoad(), K=NumberOfRoads(), C=Color();
	if(!x) {
		if(C==1) {
			cnt++;
			if(flag) Move(P, 2);
		}
		else {
			if(flag) Move(P, C);
		}
		return;
	}
	if(C==1) {
		cnt++;
		for(int i=1; i<=K; i++) Move(i, 2), Count(x-1, true);
		if(flag) Move(P, 2);
	}
	else if(C==2) {
		for(int i=1; i<=K; i++) Move(i, 3), Count(x-1, true);
		if(flag) Move(P, 2);
	}
	else if(C==3) {
		for(int i=1; i<=K; i++) Move(i, 3), Count(x-1, true);
		if(flag) Move(P, 3);
	}
}

void F(int x, bool flag) {
	int P=LastRoad(), K=NumberOfRoads(), C=Color();
	if(C==3) {
		Move(P, C); return;
	}
	Count(x, false), cnt--;
	Set2(false);
	for(int i=1; i<=K; i++) Move(i, 3), F(x, true);
	if(flag) Move(P, 3);
}

void Inspect(int R) {
	for(int i=1; i<=R; i++) {
		Set1(false);
		cnt=0;
		F(i, false);
		Answer(i, cnt);
	}
}
/*
5 3 3
1 2
3 1 3 4
2 2 4
3 2 3 5
1 4
5
9
10
*/

/*
5 3 1
1 2
3 1 3 4
2 2 4
3 2 3 5
1 4
5
*/

Compilation message

dungeon2.cpp: In function 'void Set1(bool)':
dungeon2.cpp:10:3: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   10 |   if(flag) Move(P, 1); return;
      |   ^~
dungeon2.cpp:10:24: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   10 |   if(flag) Move(P, 1); return;
      |                        ^~~~~~
dungeon2.cpp: In function 'void Set2(bool)':
dungeon2.cpp:19:3: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   19 |   if(flag) Move(P, C); return;
      |   ^~
dungeon2.cpp:19:24: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   19 |   if(flag) Move(P, C); return;
      |                        ^~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 348 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 348 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 11 ms 604 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -