제출 #419807

#제출 시각아이디문제언어결과실행 시간메모리
419807SuhaibSawalha1자동 인형 (IOI18_doll)C++17
0 / 100
1 ms332 KiB
#include "doll.h" #include <bits/stdc++.h> using namespace std; void create_circuit(int M, vector<int> A) { int N = A.size(); vector<int> C(M + 1), X(1), Y(1), cnt(M + 1); vector<vector<int>> a(3); for (int i : A) { ++cnt[i]; } for (int i = 1; i <= M; ++i) { a[cnt[i]].push_back(i); } if (a[2].empty()) { C[0] = -1; X[0] = -1; } else { C[0] = X[0] = a[2][0]; for (int i = 0; i < a[2].size() - 1; ++i) { C[a[2][i]] = a[2][i + 1]; } C[a[2].back()] = -1; } if (a[1].empty()) { } else { Y[0] = a[1][0]; for (int i = 0; i < a[1].size() - 1; ++i) { C[a[1][i]] = a[1][i + 1]; } C[a[1].back()] = 0; } answer(C, X, Y); }

컴파일 시 표준 에러 (stderr) 메시지

doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:21:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |     for (int i = 0; i < a[2].size() - 1; ++i) {
      |                     ~~^~~~~~~~~~~~~~~~~
doll.cpp:30:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |     for (int i = 0; i < a[1].size() - 1; ++i) {
      |                     ~~^~~~~~~~~~~~~~~~~
doll.cpp:6:7: warning: unused variable 'N' [-Wunused-variable]
    6 |   int N = A.size();
      |       ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...