제출 #1040003

#제출 시각아이디문제언어결과실행 시간메모리
1040003LaMatematica14Split the Attractions (IOI19_split)C++17
11 / 100
41 ms12372 KiB
#include <bits/stdc++.h> using namespace std; vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) { vector<int> g(n, 3); vector<vector<int>> adj(n); for (int i = 0; i < p.size(); i++) { adj[p[i]].push_back(q[i]); adj[q[i]].push_back(p[i]); } queue<int> nx; nx.push(0); g[0] = 2; b--; while (!nx.empty()) { int att = nx.front(); nx.pop(); for (int i : adj[att]) { if (b == 0) break; if (g[i] == 2) continue; nx.push(i); g[i] = 2; b--; } if (b == 0) break; } for (int i = 0; i < n; i++) { if (g[i] == 3) { g[i] = 1; break; } } return g; }

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

split.cpp: In function 'std::vector<int> find_split(int, int, int, int, std::vector<int>, std::vector<int>)':
split.cpp:7:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    7 |     for (int i = 0; i < p.size(); i++) {
      |                     ~~^~~~~~~~~~
#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...