Submission #909461

# Submission time Handle Problem Language Result Execution time Memory
909461 2024-01-17T08:18:51 Z MinhAnhnd Coreputer (IOI23_coreputer) C++17
Compilation error
0 ms 0 KB
#include "coreputer.h"
#include <bits/stdc++.h>
using namespace std;
std::vector<int> cut(int N, std::vector<int> m){
    while(!m.empty()&&((vec.rbegin()->c)>=m)){
        m.pop_back()
    }
}
std::vector<int> malfunctioning_cores(int N) {

    vector<int> a;
    vector<int> larger;
    vector<int> smaller;
    vector<int> b;
    for (int i = 0;i<=N-1;i++){
        b.push_back(0);
    }

    for (int i = 0;i<=min(7,N-1);i++){
        a.push_back(i);
    }
    int half = run_diagnostic(a);
    int state = abs(half);
    a.clear();

    if (half == 1){
        for (int i = 0;i<=min(7,N-1);i++){
        larger.push_back(i);
        }
    } else{
        for (int i = 8;i<=min(15,N-1);i++){
        larger.push_back(i);
        }
    }

    int fourth = run_diagnostic(cut(N,vector<int>(larger.begin(), larger.begin()+4)));
    int eight;
    int onesix;
    int pos;
    if(state!=fourth){
        eight = run_diagnostic(cut(N,vector<int>(larger.begin(), larger.begin()+2)));
        if(eight!=state){
            onesix = run_diagnostic(cut(N,vector<int>(larger.begin(), larger.begin()+1)));
            pos = 2;
            if(onesix!=state){
                pos = 1;
            }
        }
        else{
            onesix = run_diagnostic(cut(N,vector<int>(larger.begin(), larger.begin()+3)));
            pos = 4;
            if(onesix!=state){
                pos = 3;
            }
        }
    }
    else{
        eight = run_diagnostic(cut(N,vector<int>(larger.begin(), larger.begin()+6)));
        if(eight!=state){
            onesix = run_diagnostic(cut(N,vector<int>(larger.begin(), larger.begin()+5)));
            pos = 6;
            if(onesix!=state){
                pos = 5;
            }
        }
        else{
            onesix = run_diagnostic(cut(N,vector<int>(larger.begin(), larger.begin()+7)));
            pos = 8;
            if(onesix!=state){
                pos = 7;
            }
        }
    }



    for (int i = 0;i<=N-1;i++){
        b.push_back(0);
    }
    b[pos-1] = 1;
	return b;
}

Compilation message

coreputer.cpp: In function 'std::vector<int> cut(int, std::vector<int>)':
coreputer.cpp:5:25: error: 'vec' was not declared in this scope
    5 |     while(!m.empty()&&((vec.rbegin()->c)>=m)){
      |                         ^~~
coreputer.cpp:6:21: error: expected ';' before '}' token
    6 |         m.pop_back()
      |                     ^
      |                     ;
    7 |     }
      |     ~                
coreputer.cpp:8:1: warning: no return statement in function returning non-void [-Wreturn-type]
    8 | }
      | ^