제출 #229925

#제출 시각아이디문제언어결과실행 시간메모리
229925Ruxandra985사육제 (CEOI14_carnival)C++14
0 / 100
31 ms384 KiB
#include <bits/stdc++.h> using namespace std; int v[160]; int main() { int dif , i , n , st , dr , mid , j , val1 , val2; cin >> n; dif = 0; for (i = 1 ; i <= n ; i++){ if (!v[i]){ v[i] = ++dif; } /// acuma ar trb sa cauti urm = v[i] if (n - i + 1 > 0){ cout << n - i + 1 << " "; for (j = i ; j <= n ; j++) cout << j << " "; cout << endl; cin >> val1; } else val1 = 0; if (n - i > 0){ cout << n - i << " "; for (j = i + 1 ; j <= n ; j++) cout << j << " "; cout << endl; cin >> val2; } else val2 = 0; if (val1 != val2){ /// v[i] nu mai apare nicaieri continue; } /// v[i] mai apare , unde? st = i + 1; dr = n; while (st <= dr){ mid = (st + dr)/2; if (mid - i + 1 > 0){ cout << mid - i + 1 << " "; for (j = i ; j <= mid ; j++) cout << j << " "; cout << endl; cin >> val1; } else val1 = 0; if (mid - i > 0){ cout << mid - i << " "; for (j = i + 1 ; j <= mid ; j++) cout << j << " "; cout << endl; cin >> val2; } else val2 = 0; if (val1 == val2){ dr = mid - 1; } else st = mid + 1; } v[st] = v[i]; } for (i = 1 ; i <= n ; i++) cout << v[i] << " "; return 0; }
#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...