Submission #1044093

# Submission time Handle Problem Language Result Execution time Memory
1044093 2024-08-05T07:19:22 Z vjudge1 Zagonetka (COI18_zagonetka) C++17
9 / 100
46 ms 592 KB
#include<bits/stdc++.h>

using namespace std;

void print(vector<int> v)
{
  for(int i = 0; i + 1 < v.size(); i++)
    cout << v[i] << ' ';
  cout << v.back() << endl;
}

bool ask(vector<int> v)
{
  cout << "query ";
  print(v); 
  bool res;
  cin >> res;
  return res;
}

void out(vector<int> a, vector<int> b)
{
  cout << "end\n";
  print(a);
  print(b);
  exit(0);
}

int main()
{
  int n;
  cin >> n;
  vector<int> p(n), a, b;
  for(int i = 0; i < n; i ++)
    cin >> p[i];
  
  a = b = p;
  sort(p.begin(), p.end());
  do
    {
      bool res = ask(p);
      if(res)
	a = min(a, p), b = max(a, p);
    }
  while(next_permutation(p.begin(), p.end()));
  out(a, b);
  return 0; 
}

Compilation message

zagonetka.cpp: In function 'void print(std::vector<int>)':
zagonetka.cpp:7:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    7 |   for(int i = 0; i + 1 < v.size(); i++)
      |                  ~~~~~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 3 ms 344 KB Output is correct
6 Correct 3 ms 344 KB Output is correct
7 Correct 3 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 46 ms 412 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 26 ms 412 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 45 ms 592 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -