Submission #943160

# Submission time Handle Problem Language Result Execution time Memory
943160 2024-03-11T08:53:05 Z MilosMilutinovic Chameleon's Love (JOI20_chameleon) C++14
4 / 100
7 ms 596 KB
#include "chameleon.h"
#include<bits/stdc++.h>

#define pb push_back
#define mp make_pair
#define fi first
#define se second

using namespace std;

namespace {

int variable_example = 1;

}  // namespace

void Solve(int n){
	vector<int> v;
	vector<pair<int,int>> res;
	for(int i=1;i<=2*n;i++){
		v.pb(i);
		if(Query(v)!=v.size()){
			v.pop_back();
			int l=0,r=(int)v.size()-1,p=0;
			while(l<=r){
				int mid=(l+r)/2;
				vector<int> qv(1,i);
				for(int j=mid;j<v.size();j++) qv.pb(v[j]);
				if(Query(qv)!=qv.size()) p=mid,l=mid+1;
				else r=mid-1;
			}
			res.pb(mp(i,v[p]));
			vector<int> nv;
			for(int j=0;j<v.size();j++) if(j!=p) nv.pb(v[j]);
			v=nv;
		}
	}
	for(auto&p:res) Answer(p.fi,p.se);
}

Compilation message

chameleon.cpp: In function 'void Solve(int)':
chameleon.cpp:22:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |   if(Query(v)!=v.size()){
      |      ~~~~~~~~^~~~~~~~~~
chameleon.cpp:28:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |     for(int j=mid;j<v.size();j++) qv.pb(v[j]);
      |                   ~^~~~~~~~~
chameleon.cpp:29:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |     if(Query(qv)!=qv.size()) p=mid,l=mid+1;
      |        ~~~~~~~~~^~~~~~~~~~~
chameleon.cpp:34:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |    for(int j=0;j<v.size();j++) if(j!=p) nv.pb(v[j]);
      |                ~^~~~~~~~~
chameleon.cpp: At global scope:
chameleon.cpp:13:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
   13 | int variable_example = 1;
      |     ^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 7 ms 344 KB Output is correct
4 Correct 7 ms 344 KB Output is correct
5 Correct 7 ms 344 KB Output is correct
6 Correct 7 ms 456 KB Output is correct
7 Correct 7 ms 344 KB Output is correct
8 Correct 7 ms 344 KB Output is correct
9 Correct 7 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 344 KB Wrong Answer [6]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 344 KB Wrong Answer [6]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 596 KB Output is correct
2 Incorrect 0 ms 344 KB Wrong Answer [6]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 7 ms 344 KB Output is correct
4 Correct 7 ms 344 KB Output is correct
5 Correct 7 ms 344 KB Output is correct
6 Correct 7 ms 456 KB Output is correct
7 Correct 7 ms 344 KB Output is correct
8 Correct 7 ms 344 KB Output is correct
9 Correct 7 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Incorrect 0 ms 344 KB Wrong Answer [6]
12 Halted 0 ms 0 KB -