제출 #1055587

#제출 시각아이디문제언어결과실행 시간메모리
1055587MrPavlitoCave (IOI13_cave)C++17
컴파일 에러
0 ms0 KiB
#include "cave.h"
#include <bits/stdc++.h>
//#define int long long
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define sc second
#define endl "\n"
#define pii pair<int,int>

using namespace std;

const int MAXN = 5e3+5;
const int mod7 = 1e9+7;
const long long inf = 1e18;


void exploreCave(int N) {
    n = N;
    int trenutnacomb[n];
    int solved[n];
    int rez[n];
    for(int i=0; i<n; i++)trenutnacomb[i] = 0, solved[i] = 0, rez[i] = 0;
    for(int i=0; i<n; i++)
    {
        for(int j=0; j<n; j++)if(solved[j])trenutnacomb[j] = solved[j];
        int t = tryCombination(trenutnacomb);
        int l = 0;
        int r = n-1;
        while(l<r)
        {
            int mid = l+r >> 1;
            for(int j=l; j<= mid; j++)if(!solved[j])trenutnacomb[j] ^= 1;
            int p = tryCombination(trenutnacomb);
            bool pomoc;
            if(p == i && t == i)pomoc = true;
            else if(p != i && t == i)pomoc = false;
            else if(p == i && t !=i) pomoc = false;
            else pomoc = true;
            if(!pomoc)r = mid;
            else l = mid+1;
            t = p;
        }
        solved[l] = i;
        rez[l] = trenutnacomb[l];
        if(t == i)rez[l] = (trenutnacomb[l]^1);
    }
    answer(trenutnacomb, solved);

}

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

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:20:5: error: 'n' was not declared in this scope
   20 |     n = N;
      |     ^
cave.cpp:24:27: error: 'trenutnacomb' was not declared in this scope
   24 |     for(int i=0; i<n; i++)trenutnacomb[i] = 0, solved[i] = 0, rez[i] = 0;
      |                           ^~~~~~~~~~~~
cave.cpp:24:48: error: 'solved' was not declared in this scope
   24 |     for(int i=0; i<n; i++)trenutnacomb[i] = 0, solved[i] = 0, rez[i] = 0;
      |                                                ^~~~~~
cave.cpp:24:63: error: 'rez' was not declared in this scope
   24 |     for(int i=0; i<n; i++)trenutnacomb[i] = 0, solved[i] = 0, rez[i] = 0;
      |                                                               ^~~
cave.cpp:27:34: error: 'solved' was not declared in this scope
   27 |         for(int j=0; j<n; j++)if(solved[j])trenutnacomb[j] = solved[j];
      |                                  ^~~~~~
cave.cpp:27:44: error: 'trenutnacomb' was not declared in this scope
   27 |         for(int j=0; j<n; j++)if(solved[j])trenutnacomb[j] = solved[j];
      |                                            ^~~~~~~~~~~~
cave.cpp:28:32: error: 'trenutnacomb' was not declared in this scope
   28 |         int t = tryCombination(trenutnacomb);
      |                                ^~~~~~~~~~~~
cave.cpp:33:24: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   33 |             int mid = l+r >> 1;
      |                       ~^~
cave.cpp:34:43: error: 'solved' was not declared in this scope
   34 |             for(int j=l; j<= mid; j++)if(!solved[j])trenutnacomb[j] ^= 1;
      |                                           ^~~~~~
cave.cpp:45:9: error: 'solved' was not declared in this scope
   45 |         solved[l] = i;
      |         ^~~~~~
cave.cpp:46:9: error: 'rez' was not declared in this scope
   46 |         rez[l] = trenutnacomb[l];
      |         ^~~
cave.cpp:49:12: error: 'trenutnacomb' was not declared in this scope
   49 |     answer(trenutnacomb, solved);
      |            ^~~~~~~~~~~~
cave.cpp:49:26: error: 'solved' was not declared in this scope
   49 |     answer(trenutnacomb, solved);
      |                          ^~~~~~