제출 #1277195

#제출 시각아이디문제언어결과실행 시간메모리
1277195avighna카멜레온의 사랑 (JOI20_chameleon)C++20
4 / 100
43 ms460 KiB
#include <bits/stdc++.h> int Query(const std::vector<int> &p); void Answer(int a, int b); void Solve(int N) { // for each index i, binary search to find the first j such that [i,j] != [i+1,j] // this will mean that [i+1,j] contains something that pairs with i, so the first such j will // be the same color for (int i = 1; i <= 2 * N; ++i) { int j = *std::ranges::partition_point(std::views::iota(i + 1, 2 * N + 1), [&](int j) { std::vector<int> a(j - i); std::iota(a.begin(), a.end(), i + 1); int q1 = Query(a); a.push_back(i); int q2 = Query(a); return q1 != q2; }); if (j != 2 * N + 1) { Answer(i, 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...