Submission #1351192

#TimeUsernameProblemLanguageResultExecution timeMemory
1351192pandaa73Casino (JOI26_casino)C++20
Compilation error
0 ms0 KiB
int Q, N;
std::vector<int> L;
std::vector<std::string> S, R;
std::vector<std::vector<int>> X, T;

}

std::vector<std::vector<int>> Chiaro(int N, std::vector<std::vector<int>> X, std::string R){
    std::vector<std::vector<int>> res = X;
    int posX = 0, posY = 0;
    if (res[0][0] == 0) {
        res[0][0] = 1;
    }
    else {
        res[0][0] = 0;
    }
    for(int i = 0; i < 2 * N - 2; i++){
        if (R[i] == 'D') {
            posX++;
        }
        else {
            posY++;
        }
        if (res[posX][posY] == 0) {
            res[posX][posY] = 1;
        }
        else {
            res[posX][posY] = 0;
        }
    }
    return res;
}

int main(int argc, char **argv) {
	if (scanf("%d", &Q) != 1) {
		fprintf(stderr, "Error while reading input\n");
		exit(1);
	}
    if (scanf("%d", &N) != 1) {
		fprintf(stderr, "Error while reading input\n");
		exit(1);
	}

    L = std::vector<int>(Q + 1, 0);
    S = std::vector<std::string>(Q + 1, "");
    R = std::vector<std::string>(Q + 1, "");

    for (int turn = 1; turn <= Q; turn++) {
        S[turn] = "";
        R[turn] = "";
        if (scanf("%d", &L[turn]) != 1) {
            fprintf(stderr, "Error while reading input\n");
            exit(1);
        }
        char tmp;
		if (scanf("%c", &tmp) != 1) {
			fprintf(stderr, "Error while reading input\n");
			exit(1);
		}
		for (int i = 0; i < L[turn]; i++) {
			if (scanf("%c", &tmp) != 1) {
				fprintf(stderr, "Error while reading input\n");
				exit(1);
			}
			if (tmp != 'A' && tmp != 'B') {
				fprintf(stderr, "Error: A character in S is neither A nor B");
                exit(1);
			}
			S[turn] += tmp;
		}
        if (scanf("%c", &tmp) != 1) {
			fprintf(stderr, "Error while reading input\n");
			exit(1);
		}
        int Count = 0;
		for (int i = 0; i < 2 * (N - 1); i++) {
			if (scanf("%c", &tmp) != 1) {
				fprintf(stderr, "Error while reading input\n");
				exit(1);
			}
			if (tmp != 'D' && tmp != 'R') {
				fprintf(stderr, "Error: A character in R is neither D nor R");
                exit(1);
			}
            if (tmp == 'D') Count++;
			R[turn] += tmp;
		}
        if (Count != N - 1) {
            fprintf(stderr, "Error: The number of D is not N - 1");
            exit(1);
        }
    }

	int Score = 51;

	for (int turn = 1; turn <= Q; turn++) {
		X = Azzurro(N, L[turn], S[turn]);
        if (X.size() != N) {
            WrongAnswer(INVALID_X);
        }
        for (int i = 0; i < N; i++) {
            if (X[i].size() != N) {
                WrongAnswer(INVALID_X);
            }
            for (int j = 0; j < N; j++) {
                if (X[i][j] != 0 && X[i][j] != 1) {
                    WrongAnswer(INVALID_X);
                }
            }
        }
        T = Chiaro(N, X, R[turn]);
		std::string Answer = Bordeaux(N, L[turn], T);
		if ((int)Answer.size() != L[turn]) {
            WrongAnswer(INVALID_S);
        }
		for (int i = 0; i < (int)Answer.size(); i++) {
			if (Answer[i] != 'A' && Answer[i] != 'B') {
                WrongAnswer(INVALID_S);
            }
		}
		if (Answer != S[turn]) {
			Score = std::min(Score, L[turn] - 1);
		}
	}

	printf("Accepted: %d\n", Score);
	return 0;
}
#endif
// Source code

Compilation message (stderr)

# 1번째 컴파일 단계

Azzurro.cpp:129:2: error: #endif without #if
  129 | #endif
      |  ^~~~~
Azzurro.cpp:2:6: error: 'vector' in namespace 'std' does not name a template type
    2 | std::vector<int> L;
      |      ^~~~~~
Azzurro.cpp:1:1: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
  +++ |+#include <vector>
    1 | int Q, N;
Azzurro.cpp:3:6: error: 'vector' in namespace 'std' does not name a template type
    3 | std::vector<std::string> S, R;
      |      ^~~~~~
Azzurro.cpp:3:1: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
    3 | std::vector<std::string> S, R;
      | ^~~
Azzurro.cpp:4:6: error: 'vector' in namespace 'std' does not name a template type
    4 | std::vector<std::vector<int>> X, T;
      |      ^~~~~~
Azzurro.cpp:4:1: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
    4 | std::vector<std::vector<int>> X, T;
      | ^~~
Azzurro.cpp:6:1: error: expected declaration before '}' token
    6 | }
      | ^
Azzurro.cpp:8:6: error: 'vector' in namespace 'std' does not name a template type
    8 | std::vector<std::vector<int>> Chiaro(int N, std::vector<std::vector<int>> X, std::string R){
      |      ^~~~~~
Azzurro.cpp:8:1: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
    8 | std::vector<std::vector<int>> Chiaro(int N, std::vector<std::vector<int>> X, std::string R){
      | ^~~
Azzurro.cpp: In function 'int main(int, char**)':
Azzurro.cpp:35:13: error: 'scanf' was not declared in this scope
   35 |         if (scanf("%d", &Q) != 1) {
      |             ^~~~~
Azzurro.cpp:36:25: error: 'stderr' was not declared in this scope
   36 |                 fprintf(stderr, "Error while reading input\n");
      |                         ^~~~~~
Azzurro.cpp:1:1: note: 'stderr' is defined in header '<cstdio>'; did you forget to '#include <cstdio>'?
  +++ |+#include <cstdio>
    1 | int Q, N;
Azzurro.cpp:36:17: error: 'fprintf' was not declared in this scope
   36 |                 fprintf(stderr, "Error while reading input\n");
      |                 ^~~~~~~
Azzurro.cpp:37:17: error: 'exit' was not declared in this scope
   37 |                 exit(1);
      |                 ^~~~
Azzurro.cpp:1:1: note: 'exit' is defined in header '<cstdlib>'; did you forget to '#include <cstdlib>'?
  +++ |+#include <cstdlib>
    1 | int Q, N;
Azzurro.cpp:39:9: error: 'scanf' was not declared in this scope
   39 |     if (scanf("%d", &N) != 1) {
      |         ^~~~~
Azzurro.cpp:40:25: error: 'stderr' was not declared in this scope
   40 |                 fprintf(stderr, "Error while reading input\n");
      |                         ^~~~~~
Azzurro.cpp:40:25: note: 'stderr' is defined in header '<cstdio>'; did you forget to '#include <cstdio>'?
Azzurro.cpp:40:17: error: 'fprintf' was not declared in this scope
   40 |                 fprintf(stderr, "Error while reading input\n");
      |                 ^~~~~~~
Azzurro.cpp:41:17: error: 'exit' was not declared in this scope
   41 |                 exit(1);
      |                 ^~~~
Azzurro.cpp:41:17: note: 'exit' is defined in header '<cstdlib>'; did you forget to '#include <cstdlib>'?
Azzurro.cpp:44:5: error: 'L' was not declared in this scope
   44 |     L = std::vector<int>(Q + 1, 0);
      |     ^
Azzurro.cpp:44:14: error: 'vector' is not a member of 'std'
   44 |     L = std::vector<int>(Q + 1, 0);
      |              ^~~~~~
Azzurro.cpp:44:14: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
Azzurro.cpp:44:21: error: expected primary-expression before 'int'
   44 |     L = std::vector<int>(Q + 1, 0);
      |                     ^~~
Azzurro.cpp:45:5: error: 'S' was not declared in this scope
   45 |     S = std::vector<std::string>(Q + 1, "");
      |     ^
Azzurro.cpp:45:14: error: 'vector' is not a member of 'std'
   45 |     S = std::vector<std::string>(Q + 1, "");
      |              ^~~~~~
Azzurro.cpp:45:14: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
Azzurro.cpp:45:26: error: 'string' is not a member of 'std'
   45 |     S = std::vector<std::string>(Q + 1, "");
      |                          ^~~~~~
Azzurro.cpp:1:1: note: 'std::string' is defined in header '<string>'; did you forget to '#include <string>'?
  +++ |+#include <string>
    1 | int Q, N;
Azzurro.cpp:46:5: error: 'R' was not declared in this scope
   46 |     R = std::vector<std::string>(Q + 1, "");
      |     ^
Azzurro.cpp:46:14: error: 'vector' is not a member of 'std'
   46 |     R = std::vector<std::string>(Q + 1, "");
      |              ^~~~~~
Azzurro.cpp:46:14: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
Azzurro.cpp:46:26: error: 'string' is not a member of 'std'
   46 |     R = std::vector<std::string>(Q + 1, "");
      |                          ^~~~~~
Azzurro.cpp:46:26: note: 'std::string' is defined in header '<string>'; did you forget to '#include <string>'?
Azzurro.cpp:51:13: error: 'scanf' was not declared in this scope
   51 |         if (scanf("%d", &L[turn]) != 1) {
      |             ^~~~~
Azzurro.cpp:52:21: error: 'stderr' was not declared in this scope
   52 |             fprintf(stderr, "Error while reading input\n");
      |                     ^~~~~~
Azzurro.cpp:52:21: note: 'stderr' is defined in header '<cstdio>'; did you forget to '#include <cstdio>'?
Azzurro.cpp:52:13: error: 'fprintf' was not declared in this scope
   52 |             fprintf(stderr, "Error while reading input\n");
      |             ^~~~~~~
Azzurro.cpp:53:13: error: 'exit' was not declared in this scope
   53 |             exit(1);
      |             ^~~~
Azzurro.cpp:53:13: note: 'exit' is defined in header '<cstdlib>'; did you forget to '#include <cstdlib>'?
Azzurro.cpp:56:21: error: 'scanf' was not declared in this scope
   56 |                 if (scanf("%c", &tmp) != 1) {
      |                     ^~~~~
Azzurro.cpp:57:33: error: 'stderr' was not declared in this scope
   57 |                         fprintf(stderr, "Error while reading input\n");
      |                                 ^~~~~~
Azzurro.cpp:57:33: note: 'stderr' is defined in header '<cstdio>'; did you forget to '#include <cstdio>'?
Azzurro.cpp:57:25: error: 'fprintf' was not declared in this scope
   57 |                         fprintf(stderr, "Error while reading input\n");
      |                         ^~~~~~~
Azzurro.cpp:58:25: error: 'exit' was not declared in this scope
   58 |                         exit(1);
      |                         ^~~~
Azzurro.cpp:58:25: note: 'exit' is defined in header '<cstdlib>'; did you forget to '#include <cstdlib>'?
Azzurro.cpp:61:29: error: 'scanf' was not declared in this scope
   61 |                         if (scanf("%c", &tmp) != 1) {
      |                             ^~~~~
Azzurro.cpp:62:41: error: 'stderr' was not declared in this scope
   62 |                                 fprintf(stderr, "Error while reading input\n");
      |                                         ^~~~~~
Azzurro.cpp:62:41: note: 'stderr' is defined in header '<cstdio>'; did you forget to '#include <cstdio>'?
Azzurro.cpp:62:33: error: 'fprintf' was not declared in this scope
   62 |                                 fprintf(stderr, "Error while reading input\n");
      |                                 ^~~~~~~
Azzurro.cpp:63:33: error: 'exit' was not declared in this scope
   63 |                                 exit(1);
      |                                 ^~~~
Azzurro.cpp:63:33: note: 'exit' is defined in header '<cstdlib>'; did you forget to '#include <cstdlib>'?
Azzurro.cpp:66:41: error: 'stderr' was not declared in this scope
   66 |                                 fprintf(stderr, "Error: A character in S is neither A nor B");
      |                                         ^~~~~~
Azzurro.cpp:66:41: note: 'stderr' is defined in header '<cstdio>'; did you forget to '#include <cstdio>'?
Azzurro.cpp:66:33: error: 'fprintf' was not declared in this scope
   66 |                                 fprintf(stderr, "Error: A character in S is neither A nor B");
      |                                 ^~~~~~~
Azzurro.cpp:67:17: error: 'exit' was not declared in this scope
   67 |                 exit(1);
      |                 ^~~~
Azzurro.cpp:67:17: note: 'exit' is defined in header '<cstdlib>'; did you forget to '#include <cstdlib>'?
Azzurro.cpp:71:13: error: 'scanf' was not declared in this scope
   71 |         if (scanf("%c", &tmp) != 1) {
      |             ^~~~~
Azzurro.cpp:72:33: error: 'stderr' was not declared in this scope
   72 |                         fprintf(stderr, "Error while reading input\n");
      |                                 ^~~~~~
Azzurro.cpp:72:33: note: 'stderr' is defined in header '<cstdio>'; did you forget to '#include <cstdio>'?
Azzurro.cpp:72:25: error: 'fprintf' was not declared in this scope
   72 |                         fprintf(stderr, "Error while reading input\n");
      |                         ^~~~~~~
Azzurro.cpp:73:25: error: 'exit' was not declared in this scope
   73 |                         exit(1);
      |                         ^~~~
Azzurro.cpp:73:25: note: 'exit' is defined in header '<cstdlib>'; did you forget to '#include <cstdlib>'?
Azzurro.cpp:77:29: error: 'scanf' was not declared in this scope
   77 |                         if (scanf("%c", &tmp) != 1) {
      |                             ^~~~~
Azzurro.cpp:78:41: error: 'stderr' was not declared in this scope
   78 |                                 fprintf(stderr, "Error while reading input\n");
      |                                         ^~~~~~
Azzurro.cpp:78:41: note: 'stderr' is defined in header '<cstdio>'; did you forget to '#include <cstdio>'?
Azzurro.cpp:78:33: error: 'fprintf' was not declared in this scope
   78 |                                 fprintf(stderr, "Error while reading input\n");
      |                                 ^~~~~~~
Azzurro.cpp:79:33: error: 'exit' was not declared in this scope
   79 |                                 exit(1);
      |                                 ^~~~
Azzurro.cpp:79:33: note: 'exit' is defined in header '<cstdlib>'; did you forget to '#include <cstdlib>'?
Azzurro.cpp:82:41: error: 'stderr' was not declared in this scope
   82 |                                 fprintf(stderr, "Error: A character in R is neither D nor R");
      |                                         ^~~~~~
Azzurro.cpp:82:41: note: 'stderr' is defined in header '<cstdio>'; did you forget to '#include <cstdio>'?
Azzurro.cpp:82:33: error: 'fprintf' was not declared in this scope
   82 |                                 fprintf(stderr, "Error: A character in R is neither D nor R");
      |                                 ^~~~~~~
Azzurro.cpp:83:17: error: 'exit' was not declared in this scope
   83 |                 exit(1);
      |                 ^~~~
Azzurro.cpp:83:17: note: 'exit' is defined in header '<cstdlib>'; did you forget to '#include <cstdlib>'?
Azzurro.cpp:89:21: error: 'stderr' was not declared in this scope
   89 |             fprintf(stderr, "Error: The number of D is not N - 1");
      |                     ^~~~~~
Azzurro.cpp:89:21: note: 'stderr' is defined in header '<cstdio>'; did you forget to '#include <cstdio>'?
Azzurro.cpp:89:13: error: 'fprintf' was not declared in this scope
   89 |             fprintf(stderr, "Error: The number of D is not N - 1");
      |             ^~~~~~~
Azzurro.cpp:90:13: error: 'exit' was not declared in this scope
   90 |             exit(1);
      |             ^~~~
Azzurro.cpp:90:13: note: 'exit' is defined in header '<cstdlib>'; did you forget to '#include <cstdlib>'?
Azzurro.cpp:97:17: error: 'X' was not declared in this scope
   97 |                 X = Azzurro(N, L[turn], S[turn]);
      |                 ^
Azzurro.cpp:97:21: error: 'Azzurro' was not declared in this scope
   97 |                 X = Azzurro(N, L[turn], S[turn]);
      |                     ^~~~~~~
Azzurro.cpp:99:25: error: 'INVALID_X' was not declared in this scope
   99 |             WrongAnswer(INVALID_X);
      |                         ^~~~~~~~~
Azzurro.cpp:99:13: error: 'WrongAnswer' was not declared in this scope
   99 |             WrongAnswer(INVALID_X);
      |             ^~~~~~~~~~~
Azzurro.cpp:103:29: error: 'INVALID_X' was not declared in this scope
  103 |                 WrongAnswer(INVALID_X);
      |                             ^~~~~~~~~
Azzurro.cpp:103:17: error: 'WrongAnswer' was not declared in this scope
  103 |                 WrongAnswer(INVALID_X);
      |                 ^~~~~~~~~~~
Azzurro.cpp:107:33: error: 'INVALID_X' was not declared in this scope
  107 |                     WrongAnswer(INVALID_X);
      |                                 ^~~~~~~~~
Azzurro.cpp:107:21: error: 'WrongAnswer' was not declared in this scope
  107 |                     WrongAnswer(INVALID_X);
      |                     ^~~~~~~~~~~
Azzurro.cpp:111:9: error: 'T' was not declared in this scope
  111 |         T = Chiaro(N, X, R[turn]);
      |         ^
Azzurro.cpp:111:13: error: 'Chiaro' was not declared in this scope; did you mean 'char'?
  111 |         T = Chiaro(N, X, R[turn]);
      |             ^~~~~~
      |             char
Azzurro.cpp:112:22: error: 'string' is not a member of 'std'
  112 |                 std::string Answer = Bordeaux(N, L[turn], T);
      |                      ^~~~~~
Azzurro.cpp:112:22: note: 'std::string' is defined in header '<string>'; did you forget to '#include <string>'?
Azzurro.cpp:113:26: error: 'Answer' was not declared in this scope
  113 |                 if ((int)Answer.size() != L[turn]) {
      |                          ^~~~~~
Azzurro.cpp:114:25: error: 'INVALID_S' was not declared in this scope
  114 |             WrongAnswer(INVALID_S);
      |                         ^~~~~~~~~
Azzurro.cpp:114:13: error: 'WrongAnswer' was not declared in this scope
  114 |             WrongAnswer(INVALID_S);
      |             ^~~~~~~~~~~
Azzurro.cpp:116:42: error: 'Answer' was not declared in this scope
  116 |                 for (int i = 0; i < (int)Answer.size(); i++) {
      |                                          ^~~~~~
Azzurro.cpp:118:29: error: 'INVALID_S' was not declared in this scope
  118 |                 WrongAnswer(INVALID_S);
      |                             ^~~~~~~~~
Azzurro.cpp:118:17: error: 'WrongAnswer' was not declared in this scope
  118 |                 WrongAnswer(INVALID_S);
      |                 ^~~~~~~~~~~
Azzurro.cpp:121:21: error: 'Answer' was not declared in this scope
  121 |                 if (Answer != S[turn]) {
      |                     ^~~~~~
Azzurro.cpp:122:38: error: 'min' is not a member of 'std'
  122 |                         Score = std::min(Score, L[turn] - 1);
      |                                      ^~~
Azzurro.cpp:126:9: error: 'printf' was not declared in this scope
  126 |         printf("Accepted: %d\n", Score);
      |         ^~~~~~
Azzurro.cpp:126:9: note: 'printf' is defined in header '<cstdio>'; did you forget to '#include <cstdio>'?