Submission #909843

# Submission time Handle Problem Language Result Execution time Memory
909843 2024-01-17T13:22:04 Z MinhAnhnd Coreputer (IOI23_coreputer) C++17
75 / 100
1 ms 600 KB
#include "coreputer.h"
#include <bits/stdc++.h>

using namespace std;
std::vector<int> cut(int N, std::vector<int> m){
    std::vector<int> output;
    int maxi = -1;
    for (auto i:m){
        if (maxi>=i) continue;
        maxi = i;

        if((i<N) && (i>=0)){

            output.push_back(i);

        }
    }
    //for (auto i:output){cout<<i;}
    //cout<<endl;2
    return output;
}
std::vector<int> cuttee(int N, std::vector<int> m,int yes){
    std::vector<int> output;
    int maxi = -1;
    for (auto i:m){
        if (maxi>=i) continue;
        maxi = i;

        if((i<N) && (i>=0)){

            output.push_back(i);

        }
    }
    if (yes<N) output.push_back(yes);
    //for (auto i:output){cout<<i;}
    //cout<<endl;2
    return output;
}
std::vector<int> cutter(int N, std::vector<int> m,int no){
    std::vector<int> output;
    int maxi = -1;
    for (auto i:m){
        if (maxi>=i) continue;
        maxi = i;

        if((i<N) && (i>=0) && (i!=no)){

            output.push_back(i);

        }
    }
//for (auto i:output){cout<<i;}
    //cout<<endl;
    return output;
}
std::vector<int> malfunctioning_cores(int N) {
    long delta = 0;
    long delta2 = 0;
    vector<int> a;
    vector<int> larger;
    vector<int> smaller;
    vector<int> b;

    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++){
        delta = 8;
        delta2 = -8;
        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[delta+pos-1] = 1;
    long ileft = 1;
    long illeft = 0;
    long total = 0;
    for (int i = pos+1;i<=8;i++){
        vector<int> funnyright = vector<int>(larger.begin(), larger.begin()+pos-1);
        funnyright.push_back(larger[i-1]);
        int temp = run_diagnostic(cut(N,funnyright));
        if(temp==state) {b[delta+i-1] = 1;ileft++;}
    }
    vector<int> funnyright = vector<int>(larger.begin(), larger.begin()+pos);
    for (int i = 0;i<pos-1;i++){
        int temp = run_diagnostic(cutter(N,funnyright,larger[i]));
        if(temp!=state) {b[delta+i] = 1;ileft++;illeft++;}
    }
    if (state==0) total = illeft*2 + 2;
    else if ((fourth==0)||(eight==0)||(onesix==0)){
        total = illeft*2 + 2;
    } else{
        total = illeft*2 + 1;
    }
    //total = total/2;
    vector<int> funnyleft = vector<int>(larger.begin(), larger.begin()+pos-1);
    for (int i = 8;i<=15;i++){
        int temp = run_diagnostic(cuttee(N,funnyleft,i+delta2));
        if(temp==state) {b[i+delta2] = 1;}
    }

	return b;
}

Compilation message

coreputer.cpp: In function 'std::vector<int> malfunctioning_cores(int)':
coreputer.cpp:128:10: warning: variable 'total' set but not used [-Wunused-but-set-variable]
  128 |     long total = 0;
      |          ^~~~~
# Verdict Execution time Memory Grader output
1 Partially correct 0 ms 344 KB Output is partially correct
2 Partially correct 1 ms 344 KB Output is partially correct
3 Partially correct 1 ms 344 KB Output is partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 1 ms 344 KB Output is partially correct
2 Partially correct 0 ms 344 KB Output is partially correct
3 Partially correct 1 ms 344 KB Output is partially correct
4 Partially correct 1 ms 344 KB Output is partially correct
5 Partially correct 1 ms 344 KB Output is partially correct
6 Partially correct 0 ms 344 KB Output is partially correct
7 Partially correct 0 ms 344 KB Output is partially correct
8 Partially correct 1 ms 344 KB Output is partially correct
9 Partially correct 0 ms 344 KB Output is partially correct
10 Partially correct 1 ms 344 KB Output is partially correct
11 Partially correct 1 ms 344 KB Output is partially correct
12 Partially correct 0 ms 344 KB Output is partially correct
13 Partially correct 0 ms 344 KB Output is partially correct
14 Partially correct 1 ms 344 KB Output is partially correct
15 Partially correct 0 ms 344 KB Output is partially correct
16 Partially correct 1 ms 344 KB Output is partially correct
17 Partially correct 0 ms 344 KB Output is partially correct
18 Partially correct 0 ms 344 KB Output is partially correct
19 Partially correct 1 ms 344 KB Output is partially correct
20 Partially correct 1 ms 596 KB Output is partially correct
21 Partially correct 1 ms 344 KB Output is partially correct
22 Partially correct 0 ms 344 KB Output is partially correct
23 Partially correct 1 ms 596 KB Output is partially correct
24 Partially correct 0 ms 344 KB Output is partially correct
25 Partially correct 0 ms 344 KB Output is partially correct
26 Partially correct 0 ms 344 KB Output is partially correct
27 Partially correct 0 ms 344 KB Output is partially correct
28 Partially correct 0 ms 344 KB Output is partially correct
29 Partially correct 1 ms 600 KB Output is partially correct
30 Partially correct 1 ms 600 KB Output is partially correct
31 Partially correct 1 ms 344 KB Output is partially correct
32 Partially correct 0 ms 344 KB Output is partially correct
33 Partially correct 1 ms 344 KB Output is partially correct
34 Partially correct 1 ms 344 KB Output is partially correct
35 Partially correct 0 ms 344 KB Output is partially correct
36 Partially correct 0 ms 344 KB Output is partially correct
37 Partially correct 1 ms 344 KB Output is partially correct
38 Partially correct 1 ms 344 KB Output is partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 0 ms 344 KB Output is partially correct
2 Partially correct 1 ms 344 KB Output is partially correct
3 Partially correct 1 ms 344 KB Output is partially correct
4 Partially correct 1 ms 344 KB Output is partially correct
5 Partially correct 0 ms 344 KB Output is partially correct
6 Partially correct 1 ms 344 KB Output is partially correct
7 Partially correct 1 ms 344 KB Output is partially correct
8 Partially correct 1 ms 344 KB Output is partially correct
9 Partially correct 0 ms 344 KB Output is partially correct
10 Partially correct 0 ms 344 KB Output is partially correct
11 Partially correct 1 ms 344 KB Output is partially correct
12 Partially correct 0 ms 344 KB Output is partially correct
13 Partially correct 1 ms 344 KB Output is partially correct
14 Partially correct 1 ms 344 KB Output is partially correct
15 Partially correct 0 ms 344 KB Output is partially correct
16 Partially correct 0 ms 344 KB Output is partially correct
17 Partially correct 1 ms 344 KB Output is partially correct
18 Partially correct 0 ms 344 KB Output is partially correct
19 Partially correct 1 ms 344 KB Output is partially correct
20 Partially correct 0 ms 344 KB Output is partially correct
21 Partially correct 0 ms 344 KB Output is partially correct
22 Partially correct 1 ms 344 KB Output is partially correct
23 Partially correct 1 ms 596 KB Output is partially correct
24 Partially correct 1 ms 344 KB Output is partially correct
25 Partially correct 0 ms 344 KB Output is partially correct
26 Partially correct 1 ms 596 KB Output is partially correct
27 Partially correct 0 ms 344 KB Output is partially correct
28 Partially correct 0 ms 344 KB Output is partially correct
29 Partially correct 0 ms 344 KB Output is partially correct
30 Partially correct 0 ms 344 KB Output is partially correct
31 Partially correct 0 ms 344 KB Output is partially correct
32 Partially correct 1 ms 600 KB Output is partially correct
33 Partially correct 1 ms 600 KB Output is partially correct
34 Partially correct 1 ms 344 KB Output is partially correct
35 Partially correct 0 ms 344 KB Output is partially correct
36 Partially correct 1 ms 344 KB Output is partially correct
37 Partially correct 1 ms 344 KB Output is partially correct
38 Partially correct 0 ms 344 KB Output is partially correct
39 Partially correct 0 ms 344 KB Output is partially correct
40 Partially correct 1 ms 344 KB Output is partially correct
41 Partially correct 1 ms 344 KB Output is partially correct
42 Partially correct 1 ms 344 KB Output is partially correct
43 Partially correct 1 ms 344 KB Output is partially correct
44 Partially correct 1 ms 344 KB Output is partially correct
45 Partially correct 0 ms 344 KB Output is partially correct
46 Partially correct 1 ms 344 KB Output is partially correct
47 Partially correct 0 ms 344 KB Output is partially correct
48 Partially correct 0 ms 344 KB Output is partially correct
49 Partially correct 1 ms 344 KB Output is partially correct
50 Partially correct 1 ms 344 KB Output is partially correct
51 Partially correct 1 ms 344 KB Output is partially correct
52 Partially correct 0 ms 344 KB Output is partially correct
53 Partially correct 1 ms 344 KB Output is partially correct
54 Partially correct 1 ms 344 KB Output is partially correct
55 Partially correct 0 ms 344 KB Output is partially correct
56 Partially correct 0 ms 344 KB Output is partially correct
57 Partially correct 0 ms 344 KB Output is partially correct
58 Partially correct 1 ms 344 KB Output is partially correct
59 Partially correct 1 ms 344 KB Output is partially correct
60 Partially correct 1 ms 344 KB Output is partially correct
61 Partially correct 1 ms 344 KB Output is partially correct
62 Partially correct 0 ms 344 KB Output is partially correct
63 Partially correct 0 ms 344 KB Output is partially correct
64 Partially correct 0 ms 344 KB Output is partially correct
65 Partially correct 1 ms 344 KB Output is partially correct
66 Partially correct 0 ms 344 KB Output is partially correct
67 Partially correct 0 ms 344 KB Output is partially correct
68 Partially correct 0 ms 344 KB Output is partially correct
69 Partially correct 0 ms 344 KB Output is partially correct
70 Partially correct 0 ms 344 KB Output is partially correct
71 Partially correct 0 ms 344 KB Output is partially correct
72 Partially correct 0 ms 344 KB Output is partially correct
73 Partially correct 0 ms 344 KB Output is partially correct
74 Partially correct 0 ms 344 KB Output is partially correct
75 Partially correct 1 ms 344 KB Output is partially correct
76 Partially correct 0 ms 356 KB Output is partially correct
77 Partially correct 0 ms 344 KB Output is partially correct
78 Partially correct 0 ms 356 KB Output is partially correct
79 Partially correct 1 ms 344 KB Output is partially correct
80 Partially correct 0 ms 356 KB Output is partially correct
81 Partially correct 1 ms 344 KB Output is partially correct
82 Partially correct 0 ms 356 KB Output is partially correct