# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
815876 | Pikachu | 사육제 (CEOI14_carnival) | C++17 | 26 ms | 356 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
template<typename T>
inline bool maxi(T &x, const T &val)
{
if (x < val) return x = val, true;
return false;
}
template<typename T>
inline bool mini(T &x, const T &val)
{
if (x > val) return x = val, true;
return false;
}
const int maxn = 155;
int n;
int ans[maxn];
bool last[maxn];
set<int> rem;
int getint()
{
int tmp;
cin >> tmp;
return tmp;
}
int askrange(int l, int r)
{
cout << r - l + 1 << ' ';
for (int i = l; i <= r; i++) {
cout << i << ' ';
}
cout << endl;
return getint();
}
int askpair(int u, int v)
{
cout << 2 << ' ' << u << ' ' << v << endl;
return getint();
}
void erase(vector<int> &tmp)
{
for (int x : tmp) {
rem.erase(x);
}
tmp.clear();
}
void solve()
{
cin >> n;
int cur = askrange(1, n);
last[n] = true;
for (int i = 1; i < n; i++) {
if (askrange(i + 1, n) != cur) {
last[i] = true;
cur--;
}
else rem.insert(i);
}
int cnt = 0;
vector<int> tmp;
for (int i = 1; i <= n; i++) {
if (last[i]) {
ans[i] = ++cnt;
for (int x : rem) {
if (x > i) break;
if (askpair(x, i) == 1) {
ans[x] = cnt;
tmp.push_back(x);
}
}
erase(tmp);
}
}
cout << "0 ";
for (int i = 1; i <= n; i++) cout << ans[i] << ' ';
cout << endl;
}
signed main()
{
#ifdef LOCAL
clock_t st = clock();
#endif
ios_base::sync_with_stdio(false);
cin.tie(0);
#define Task ""
#ifdef LOCAL
if (!fopen("D:\\.inp", "r")) {
freopen("D:\\.inp", "w", stdout);
freopen("D:\\.out", "w", stdout);
cerr << "get input from file\n";
return 0;
}
freopen("D:\\.inp", "r", stdin);
freopen("D:\\.out", "w", stdout);
#else
if (fopen(Task".inp", "r")) {
freopen(Task".inp", "r", stdin);
freopen(Task".out", "w", stdout);
}
#endif
solve();
#ifdef LOCAL
cerr << clock() - st << endl;
#endif
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |