Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <algorithm>
- #include <string>
- using namespace std;
- //int s = 0;
- int n;
- bool f(int i, int j) {
- //s++;
- if(i>n || j>n) {
- string ansss="0 ";
- for (int k = 0; k < n-1; ++k) {
- ansss+="0 ";
- }
- ansss+="0";
- cout << ansss;
- cout.flush();
- exit(0);
- }
- string ans;
- string l = to_string(i);
- string r = to_string(j);
- string z = "1 " + l + " " + r;
- cout << z;
- cout.flush();
- cin >> ans;
- if (ans == "YES") {
- return true;
- } else {
- return false;
- }
- }
- int main() {
- cin >> n;
- int *arr = new int[n];
- for (int i = 0; i < n; ++i) {
- arr[i] = i + 1;
- }
- sort(arr, arr + n, f);
- string anss="0 ";
- for (int j = 0; j < n-1; ++j) {
- anss+=to_string(arr[j]) + " ";
- }
- anss+=to_string(arr[n-1]);
- cout << anss;
- cout.flush();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement