Submission #1310717

#TimeUsernameProblemLanguageResultExecution timeMemory
1310717theiulius동굴 (IOI13_cave)C++20
Compilation error
0 ms0 KiB
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ff first
#define ss second
#define pb push_back
#include "cave.h"
int t = 1;
int n = 0;

// void answer(int a[], int b[]){
//     for (int i = 0; i < n; i++){
//         cout << a[i] << " ";
//     }
//     cout << endl;
//     for (int i = 0; i < n; i++){
//         cout << b[i] << " ";
//     }
//     cout << endl;
// }

// int tryCombination(int s[]){
//     for (int i = 0; i < n; i++){
//         cout << s[i] << " ";
//     }
//     cout << endl;
//     int x;
//     cin >> x;
//     return x;
// }

void exploreCave(int N) {
    n = N;
    map<int, int> mp;
    int a[n] = {}, b[n] = {};
    for (int i = 0; i < n; i++){ // karebebs gadavuyvebit
        for (int j = 0; j < n; j++){ // berketebi
            if (mp[j]) continue;
            a[j] = 0;
        }
        int x = tryCombination(a), berk = 0; // berketebi
        if (x > i || x == -1){ // sadgac berketi i karistvis gaxsnilia
            berk = 0;
        }else{
            berk = 1;
        }
        // cout << i << "     " << a[i] << endl;
        
        int l = 0, r = n - 1, ans = 0; // berkets vedzebt
        while (l <= r){
            int mid = (l + r) / 2;
            for (int j = 0; j <= mid; j++){
                if (mp[j]) continue;
                a[j] = berk;
            }
            for (int j = mid + 1; j < n; j++){
                if (mp[j]) continue;
                a[j] = 1 ^ berk;
            }
            x = tryCombination(a);
            
            if (x > i || x == -1){
                r = mid - 1;
                ans = mid;
            }else{
                l = mid + 1;
            }
        }
        
        // cout << ans << " " << i << endl;
        b[ans] = i;
        mp[ans] = 1;
        a[ans] = berk;
    }
    
    answer(a, b);
}

main(){
    exploreCave(4);
}

Compilation message (stderr)

cave.cpp:79:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   79 | main(){
      | ^~~~
/usr/bin/ld: /tmp/ccmF2Eqi.o: in function `main':
grader.c:(.text.startup+0x0): multiple definition of `main'; /tmp/ccTfBQIp.o:cave.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status