답안 #962046

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
962046 2024-04-13T05:44:03 Z cnn008 드문 곤충 (IOI22_insects) C++17
컴파일 오류
0 ms 0 KB
#include "bits/stdc++.h"
using namespace std;

#ifdef N_N_C
#include "debug.h"
#else
#define cebug(...) "Arya"
#endif

#define int long long

const int N=2005;
const int mod=1e9+7;

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
int rand(int l, int r){
    assert(l<=r);
    return uniform_int_distribution<int> (l,r)(rng);
}
set <int> s;
int f=1;
int n,T[N];
void move_inside(int i){
	s.insert(T[i]);
	if(s.find(T[i])!=s.end()) f=2;
}
void move_outside(int i){
	s.erase(s.find(T[i]));
	f=1;
}
int press_buton(){
	return f;
}
int min_cardinality(int n){
	int type=0;
	for(int i=0; i<n; i++){
		move_inside(i);
		press_buton();
		if(press_buton()==1){
			type++;
			move_outside(i);
		}
	}
	return rand(1,n/type);
}
void sol(){
	cin>>n;
	for(int i=0; i<n; i++) cin>>T[i];
	cout<<min_cardinality(n);
}
signed main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen(".inp", "r", stdin);
    //freopen(".out", "w", stdout);
    int tt=1;
    //cin>>tt; 
    while(tt--){
    	sol();
    }
    cerr << "\nTime elapsed: " << 1000.0 * clock() / CLOCKS_PER_SEC << " ms.\n";
    return 0;
}
/**  /\_/\
*   (= ._.)
*   / >💖 \>💕
**/

Compilation message

insects.cpp:64:9: warning: "/*" within comment [-Wcomment]
   64 | /**  /\_/\
      |          
/usr/bin/ld: /tmp/ccFVJJXc.o: in function `main':
stub.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccWIh4oc.o:insects.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccFVJJXc.o: in function `main':
stub.cpp:(.text.startup+0x61): undefined reference to `min_cardinality(int)'
collect2: error: ld returned 1 exit status