답안 #892539

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
892539 2023-12-25T13:22:24 Z Minbaev Super Dango Maker (JOI22_dango3) C++17
컴파일 오류
0 ms 0 KB
#include "dango3.h"
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimize("Ofast,unroll-loops")
#define pii pair<int,int>
using namespace __gnu_pbds;
using namespace std;
#define pb push_back
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define int long long
#define f first
#define s second
#define pii pair<int,int>
template<class T>bool umax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<class T>bool umin(T &a,T b){if(b<a){a=b;return true;}return false;}
typedef tree<int, null_type, less_equal<int>, rb_tree_tag,
	tree_order_statistics_node_update> ordered_set;
const int mod= 1e9 +7;
const int N=1e5*4;


void Solve(int n,int m){
	
	int cnt = m;	
	
	while(cnt>0){
		
		int l = 1,r = n*m,ans = 0;
		vector<int>vis(n*m+1);
		while(l<=r){
			int mid = (l+r) >> 1;
			
			vector<int>vs;
			for(int i = 1;i<=mid;i++){
				if(!vis[i])
				vs.pb(i);
			}
			vector<int>ans1(vs.size());
			for(auto &to:vs)ans1.pb(to);
			int x = Query(ans1);
			
			if(x>1){
				r = mid - 1;
			}
			else if(x==1){
				ans = mid;
				break;
			}
			else l = mid + 1;
		}
		
		vector<int>vs;
		
		for(int i = 1;i<=ans;i++){
			if(!vis[i])
			vs.pb(i);
			vis[i] = 1;
		}
		
		vector<int>ans1(vs.size());
		
		for(auto &to:vs)ans1.pb(to);
		
		Answer(ans1);
		
		
		
		
	}
	
	
	
	
	
	
	
	
}

























Compilation message

dango3.cpp: In function 'void Solve(long long int, long long int)':
dango3.cpp:43:18: error: invalid initialization of reference of type 'const std::vector<int>&' from expression of type 'std::vector<long long int>'
   43 |    int x = Query(ans1);
      |                  ^~~~
In file included from dango3.cpp:1:
dango3.h:5:35: note: in passing argument 1 of 'int Query(const std::vector<int>&)'
    5 | int Query(const std::vector<int> &x);
      |           ~~~~~~~~~~~~~~~~~~~~~~~~^
dango3.cpp:67:10: error: invalid initialization of reference of type 'const std::vector<int>&' from expression of type 'std::vector<long long int>'
   67 |   Answer(ans1);
      |          ^~~~
In file included from dango3.cpp:1:
dango3.h:6:37: note: in passing argument 1 of 'void Answer(const std::vector<int>&)'
    6 | void Answer(const std::vector<int> &a);
      |             ~~~~~~~~~~~~~~~~~~~~~~~~^