Submission #1172233

#TimeUsernameProblemLanguageResultExecution timeMemory
1172233sasdeArt Collections (BOI22_art)C++20
5 / 100
17 ms408 KiB
#include <bits/stdc++.h> #include "art.h" // Định nghĩa các hàm publish() và answer() using namespace std; void solve(int N) { vector<int> best_perm(N); iota(best_perm.begin(), best_perm.end(), 1); // Bắt đầu với thứ tự tự nhiên [1, 2, ..., N] vector<int> perm = best_perm; int min_complaints = N * N; // Giá trị lớn ban đầu do { int complaints = publish(perm); // Gửi thứ hạng này lên và nhận số khiếu nại if (complaints == 0) { answer(perm); // Nếu không có khiếu nại nào, đây là thứ hạng đúng return; } if (complaints < min_complaints) { min_complaints = complaints; best_perm = perm; // Lưu lại thứ hạng tốt nhất } } while (next_permutation(perm.begin(), perm.end())); answer(best_perm); // Nếu không có thứ hạng nào có khiếu nại bằng 0, gửi thứ hạng tốt nhất }
#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...