Submission #767786

# Submission time Handle Problem Language Result Execution time Memory
767786 2023-06-27T07:30:00 Z minhcool Minerals (JOI19_minerals) C++17
0 / 100
1000 ms 336 KB
//#define local
#ifndef local
#include "minerals.h"
#endif
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
 
//#define int long long
#define fi first
#define se second
#define pb push_back
#define mp make_pair
 
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<ii, ii> iiii;
 
const int N = 3e5 + 5;
 
const int oo = 1e18 + 7, mod = 1e9 + 7;
 
mt19937 rng(1);
 
int rnd(int l, int r){
	int temp = rng() % (r - l + 1);
	return abs(temp) + l;
}
 
vector<int> fi, se;
 
#define index indexx
int index[N];
 
bool in[N];
 
void Solve(int N){
	int lst = 0;
	for(int i = 1; i <= 2 * N; i++){
		int temp = Query(i);
		in[i] = 1;
		if(temp == lst) se.pb(i);
		else fi.pb(i);
		lst = temp;
	}
	bool temp = 1;
	for(int i = 16; i >= 0; i--){
		for(int j = 0; j < fi.size(); i++){
			bool temp1 = in[fi[j]], temp2 = (j & (1LL << i));
			if(temp1 ^ temp2){
				lst = Query(fi[j]);
				in[fi[j]] ^= 1;
			}
		}
		for(auto it : se){
			int temp = Query(it);
			if(lst == temp) index[it] += (1LL << i);
			in[it] ^= 1;
			lst = temp;
		}
		//temp ^= 1;	
	}
	for(auto it : se) Answer(fi[index[it]], it);
}
 
#ifdef local
void process(){
 
}
 
signed main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int t;
	cin >> t;
	while(t--) process();
}
#endif

Compilation message

minerals.cpp:22:21: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
   22 | const int oo = 1e18 + 7, mod = 1e9 + 7;
      |                ~~~~~^~~
minerals.cpp: In function 'void Solve(int)':
minerals.cpp:49:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   49 |   for(int j = 0; j < fi.size(); i++){
      |                  ~~^~~~~~~~~~~
minerals.cpp:47:7: warning: unused variable 'temp' [-Wunused-variable]
   47 |  bool temp = 1;
      |       ^~~~
# Verdict Execution time Memory Grader output
1 Execution timed out 3053 ms 208 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3058 ms 336 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3053 ms 208 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3053 ms 208 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3053 ms 208 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3053 ms 208 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3053 ms 208 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3053 ms 208 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3053 ms 208 KB Time limit exceeded
2 Halted 0 ms 0 KB -