제출 #1352510

#제출 시각아이디문제언어결과실행 시간메모리
1352510lukaye_19Casino (JOI26_casino)C++20
컴파일 에러
0 ms0 KiB
#include "Azzurro.h"
#include <bits/stdc++.h>
using namespace std;

vector<vector<int>>Azzurro(int N, int L, string S)
{
    vector<vector<int>>encoded(8,vector<int>(8));
    int total = 0;
    
    for (int i = 0; i < 8; i++)
        for (int j = 0; j < 8; j++)
        {
            if (i % 2 == 1 && j % 2 == 1) 
            {
                total++;
                
                encoded[i][j] = S[total] == 'A' ? 0 : 1;
            }
            else encoded[i][j] = 0;
        }
    
    return encoded;
}
#include "Bordeaux.h"
#include <bits/stdc++.h>
using namespace std;

string Bordeaux(int N, int L, vector<vector<int>>T)
{
    int total = 0;
    
    string R = "";
    
    for (int i = 0; i < 8; i++)
    {
        for (int j = 0; j < 8; j++)
        {
            if (i % 2 == 1 && j % 2 == 1)
            {
                total++;
                
                bool reversed = false;
                
                if (i < 7 && j < 7)
                {
                    int toprightn = t[i + 1][j - 1];
                    int bottomleftn = t[i - 1][j + 1];
                    
                    int topn = t[i][j - 1];
                    int bottomn = t[i][j + 1];
                    
                    int leftn = t[i - 1][j];
                    int rightn = t[i + 1][j];
                    
                    int totalentries = topn + bottomn + leftn + rightn;
                    
                    else if (totalentries == 2 && (toprightn + bottomleftn == 0)) reversed = true;
                }
                
                int currentR = t[i][j];
                
                if (reversed) currentR = 1 - currentR;
                
                if (currentR) R.push_back('B');
                else R.push_back('A');
            }
            
            if (total == L) break;
        }
        
        if (total == L) break;
    }
    
    return R;
}

컴파일 시 표준 에러 (stderr) 메시지

# 2번째 컴파일 단계

Bordeaux.cpp: In function 'std::string Bordeaux(int, int, std::vector<std::vector<int> >)':
Bordeaux.cpp:23:37: error: 't' was not declared in this scope
   23 |                     int toprightn = t[i + 1][j - 1];
      |                                     ^
Bordeaux.cpp:34:21: error: expected '}' before 'else'
   34 |                     else if (totalentries == 2 && (toprightn + bottomleftn == 0)) reversed = true;
      |                     ^~~~
Bordeaux.cpp:22:17: note: to match this '{'
   22 |                 {
      |                 ^
Bordeaux.cpp:34:30: error: 'totalentries' was not declared in this scope
   34 |                     else if (totalentries == 2 && (toprightn + bottomleftn == 0)) reversed = true;
      |                              ^~~~~~~~~~~~
Bordeaux.cpp:34:52: error: 'toprightn' was not declared in this scope
   34 |                     else if (totalentries == 2 && (toprightn + bottomleftn == 0)) reversed = true;
      |                                                    ^~~~~~~~~
Bordeaux.cpp:34:64: error: 'bottomleftn' was not declared in this scope
   34 |                     else if (totalentries == 2 && (toprightn + bottomleftn == 0)) reversed = true;
      |                                                                ^~~~~~~~~~~
Bordeaux.cpp:37:32: error: 't' was not declared in this scope
   37 |                 int currentR = t[i][j];
      |                                ^
Bordeaux.cpp:39:21: error: 'reversed' was not declared in this scope
   39 |                 if (reversed) currentR = 1 - currentR;
      |                     ^~~~~~~~
Bordeaux.cpp:48:25: error: break statement not within loop or switch
   48 |         if (total == L) break;
      |                         ^~~~~
Bordeaux.cpp:49:5: warning: no return statement in function returning non-void [-Wreturn-type]
   49 |     }
      |     ^
Bordeaux.cpp: At global scope:
Bordeaux.cpp:51:5: error: expected unqualified-id before 'return'
   51 |     return R;
      |     ^~~~~~
Bordeaux.cpp:52:1: error: expected declaration before '}' token
   52 | }
      | ^