Submission #532195

#TimeUsernameProblemLanguageResultExecution timeMemory
532195fabijan_cikacMinerals (JOI19_minerals)C++17
0 / 100
1 ms584 KiB
#include <bits/stdc++.h> using namespace std; #include "minerals.h" const int MAXN = (1 << 17); #define F first #define S second #define pp pair<int, int> vector<pp> sol; int now = -1; int query(int x){ return now = Query(x); } void find_par(vector<int> a, vector<int> b){ if (a.size() == 1){ sol.push_back({a[0], b[0]}); return; } vector<int> v[2][2]; for (int i = 0; i < a.size(); ++i){ if (i < a.size() / 2) v[0][0].push_back(a[i]); else v[1][0].push_back(a[i]); } for (int i = 0; i < b.size(); ++i){ int kop = now; if (kop == query(b[i])) v[0][1].push_back(b[i]); else v[1][1].push_back(b[i]); query(b[i]); } find_par(v[0][0], v[0][1]); find_par(v[1][0], v[1][1]); } void Solve(int N){ ios_base::sync_with_stdio(false); cin.tie(NULL); vector<int> a, b; int num = -1; for (int i = 1; i <= 2 * N; ++i){ if (num == -1 || num != query(i)) a.push_back(i); else{ b.push_back(i); query(i); } } for (int i = 0; i < a.size(); ++i) query(a[i]); find_par(a, b); for (int i = 0; i < N; ++i) Answer(sol[i].F + 1, sol[i].S + 1); }

Compilation message (stderr)

minerals.cpp: In function 'void find_par(std::vector<int>, std::vector<int>)':
minerals.cpp:26:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |     for (int i = 0; i < a.size(); ++i){
      |                     ~~^~~~~~~~~~
minerals.cpp:27:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |         if (i < a.size() / 2)
      |             ~~^~~~~~~~~~~~~~
minerals.cpp:31:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |     for (int i = 0; i < b.size(); ++i){
      |                     ~~^~~~~~~~~~
minerals.cpp: In function 'void Solve(int)':
minerals.cpp:53:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   53 |     for (int i = 0; i < a.size(); ++i)
      |                     ~~^~~~~~~~~~
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...