Submission #412095

#TimeUsernameProblemLanguageResultExecution timeMemory
412095losmi247Cave (IOI13_cave)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
//#include "cave.h"
using namespace std;
typedef long long ll;
const int N = 5002;

int n;



/*int *prvi,*drugi;
int *kojisvic;
int tryCombination(int *S){
    for(int i = 0; i < n; i++){
        if(S[i] != prvi[kojisvic[i]]) return i;
    }
    return -1;
}

void answer(int *S,int *D){
    for(int i = 0; i < n; i++){
        if(S[i] != prvi[i]){
            cout << "WA1" << endl;
            exit(0);
        }
    }
    for(int i = 0; i < n; i++){
        if(D[i] != drugi[i]){
            cout << "WA2" << endl;
            exit(0);
        }
    }
    cout << "OK" << endl;
}*/




void znamred(){
    int *niz = (int*)malloc(sizeof(int)*n);
    int *odg1 = (int*)malloc(sizeof(int)*n);
    for(int i = 0; i < n; i++){ niz[i] = 0; odg1[i] = i; }

    while(1){
        int x = tryCombination(niz);
        if(x == -1) break;
        niz[x] ^= 1;
    }

    answer(niz,odg1);
}

void exploreCave(int br){
    n = br;

    znamred();
}

/*int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int gh;
    cin >> gh;
    prvi = (int*)malloc(sizeof(int)*gh);
    drugi = (int*)malloc(sizeof(int)*gh);
    kojisvic = (int*)malloc(sizeof(int)*gh);
    for(int i = 0; i < gh; i++) cin >> prvi[i];
    for(int i = 0; i < gh; i++){ cin >> drugi[i]; kojisvic[drugi[i]] = i; }

    exploreCave(gh);
}*/

Compilation message (stderr)

cave.cpp: In function 'void znamred()':
cave.cpp:45:17: error: 'tryCombination' was not declared in this scope
   45 |         int x = tryCombination(niz);
      |                 ^~~~~~~~~~~~~~
cave.cpp:50:5: error: 'answer' was not declared in this scope
   50 |     answer(niz,odg1);
      |     ^~~~~~