답안 #909474

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
909474 2024-01-17T08:22:23 Z MinhAnhnd Coreputer (IOI23_coreputer) C++17
0 / 100
1 ms 344 KB
#include "coreputer.h"
#include <bits/stdc++.h>
using namespace std;
std::vector<int> cut(int N, std::vector<int> m){
    while(!m.empty()&&(*(m.rbegin())>=N)){
        m.pop_back();
    }
    return m;
}
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;
    
    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> malfunctioning_cores(int)':
coreputer.cpp:24:9: warning: unused variable 'state' [-Wunused-variable]
   24 |     int state = abs(half);
      |         ^~~~~
coreputer.cpp:37:9: warning: unused variable 'fourth' [-Wunused-variable]
   37 |     int fourth = run_diagnostic(cut(N,vector<int>(larger.begin(), larger.begin()+4)));
      |         ^~~~~~
coreputer.cpp:38:9: warning: unused variable 'eight' [-Wunused-variable]
   38 |     int eight;
      |         ^~~~~
coreputer.cpp:39:9: warning: unused variable 'onesix' [-Wunused-variable]
   39 |     int onesix;
      |         ^~~~~~
coreputer.cpp:45:10: warning: 'pos' may be used uninitialized in this function [-Wmaybe-uninitialized]
   45 |     b[pos-1] = 1;
      |       ~~~^~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB invalid array
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 344 KB invalid array
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB invalid array
2 Halted 0 ms 0 KB -