제출 #433540

#제출 시각아이디문제언어결과실행 시간메모리
433540Kevin_Zhang_TW카멜레온의 사랑 (JOI20_chameleon)C++17
40 / 100
27 ms384 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; #define pb emplace_back #define AI(i) begin(i), end(i) template<class T> bool chmin(T &a, T b) { return b < a && (a = b, true); } template<class T> bool chmax(T &a, T b) { return a < b && (a = b, true); } #ifdef KEV #define DE(args...) kout("[ " + string(#args) + " ] = ", args) void kout() { cerr << endl; } template<class T, class ...U> void kout(T a, U ...b) { cerr << a << ' ', kout(b...); } template<class T> void debug(T l, T r) { while (l != r) cerr << *l << " \n"[next(l)==r], ++l; } #else #define DE(...) 0 #define debug(...) 0 #endif #include "chameleon.h" #include <vector> namespace { const int MAX_N = 1010; int qry(vector<int> p) { for (int &i : p) ++i; return Query(p); } int n, love[MAX_N]; vector<int> edge[MAX_N]; void ans(int a, int b) { ++a, ++b; if (a > b) return; Answer(a, b); } } void Solve(int N) { n = N; fill(love, love + n + n, -1); for (int i = 0;i < n + n;++i) for (int j = i+1;j < n+n;++j) if (qry({i, j}) == 1) edge[i].pb(j), edge[j].pb(i); for (int i = 0;i < n + n;++i) { assert(edge[i].size() == 1 || edge[i].size() == 3); if (edge[i].size() == 1) continue; int cnt = 0; for (int j = 0;j < 3;++j) { vector<int> p {i}; for (int k = 0;k < 3;++k) if (j != k) p.pb( edge[i][k] ); if (qry(p) == 1) { love[ i ] = edge[i][j]; ++cnt; } } assert(cnt == 1); } for (int i = 0;i < n + n;++i) { for (int j = 0;j < edge[i].size();++j) { if (love[i] != edge[i][j] && love[ edge[i][j] ] != i) ans(i, edge[i][j]); } } }

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

chameleon.cpp: In function 'void Solve(int)':
chameleon.cpp:57:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   57 |   for (int j = 0;j < edge[i].size();++j) {
      |                  ~~^~~~~~~~~~~~~~~~
#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...