Submission #795629

#TimeUsernameProblemLanguageResultExecution timeMemory
795629AbdullahMohammedAhmadMinerals (JOI19_minerals)C++14
40 / 100
21 ms4436 KiB
#include "minerals.h" #include <bits/stdc++.h> using namespace std; deque<int> m; void clear_queue() { while(!m.empty()) { Query(m.back()); m.pop_back(); } } void Solve(int N) { vector<vector<int>> prev1(1); vector<vector<int>> prev2(1); for(int i = 1; i <= 2*N; i++) { m.push_back(i); if(Query(i) != m.size()) { prev2[0].push_back(i); Query(i); m.pop_back(); } else { prev1[0].push_back(i); } } clear_queue(); while(prev1.size() < N) { vector<vector<int>> now1; vector<vector<int>> now2; for(int i = 0; i < prev1.size(); i++) { //ONE if(prev1[i].size() == 1) { now1.push_back(prev1[i]); now2.push_back(prev2[i]); continue; } now1.push_back(vector<int>()); now1.push_back(vector<int>()); now2.push_back(vector<int>()); now2.push_back(vector<int>()); for(int j = 0; j < prev1[i].size(); j++) { if(j%2 == 0) { now1[now1.size()-2].push_back(prev1[i][j]); m.push_back(prev1[i][j]); Query(prev1[i][j]); } else { now1[now1.size()-1].push_back(prev1[i][j]); } } for(int j = 0; j < prev2[i].size(); j++) { m.push_back(prev2[i][j]); if(Query(prev2[i][j]) == m.size()) { now2[now2.size()-1].push_back(prev2[i][j]); Query(prev2[i][j]); m.pop_back(); } else { now2[now2.size()-2].push_back(prev2[i][j]); Query(prev2[i][j]); m.pop_back(); } } clear_queue(); } prev1 = now1; prev2 = now2; } for(int i = 0; i < N; i++) { Answer(prev1[i][0], prev2[i][0]); } }

Compilation message (stderr)

minerals.cpp: In function 'void Solve(int)':
minerals.cpp:22:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::deque<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |         if(Query(i) != m.size())
      |            ~~~~~~~~~^~~~~~~~~~~
minerals.cpp:34:24: warning: comparison of integer expressions of different signedness: 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   34 |     while(prev1.size() < N)
      |           ~~~~~~~~~~~~~^~~
minerals.cpp:38:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |         for(int i = 0; i < prev1.size(); i++)
      |                        ~~^~~~~~~~~~~~~~
minerals.cpp:51:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   51 |             for(int j = 0; j < prev1[i].size(); j++)
      |                            ~~^~~~~~~~~~~~~~~~~
minerals.cpp:64:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   64 |             for(int j = 0; j < prev2[i].size(); j++)
      |                            ~~^~~~~~~~~~~~~~~~~
minerals.cpp:67:39: warning: comparison of integer expressions of different signedness: 'int' and 'std::deque<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   67 |                 if(Query(prev2[i][j]) == m.size())
      |                    ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
#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...