Submission #1103025

# Submission time Handle Problem Language Result Execution time Memory
1103025 2024-10-19T11:59:11 Z _rain_ Fish (IOI08_fish) C++14
0 / 100
109 ms 14724 KB
#include<bits/stdc++.h>
using namespace std;

typedef long long ll;

const int N = (int)5e5;
int f,MOD,k,l[N+2],da[N+2];
bool ex[N+2],id[N+2],used[N+2];
struct CTDL{
	int l,da;
	bool operator < (const CTDL& other) const{
		return l<other.l;
	}
} p[N+2];
int add(int a,int b){
	return a+b>=MOD?a+b-MOD:a+b;
}
int sub(int a,int b){
	return a-b<0?a-b+MOD:a-b;
}
int mul(int a,int b){
	return (ll)a*b%MOD;
}
int power(int a,int b){
	int res=1;
	for (;b;b>>=1,a=mul(a,a)){
		if (b&1) res=mul(res,a);
	}
	return res;
}

#define name "main"
int32_t main(){
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);

	cin>>f>>k>>MOD;
	for (int i = 1; i <= f; ++i){
		cin>>p[i].l>>p[i].da;
	}
	sort(p+1,p+f+1);
	for (int i = f; i >= 1; --i){
		if (!used[p[i].da]){
			used[p[i].da]=true;
			id[i]=true;
		}
	}
	memset(used,0,sizeof used);
	int cnt=0,ans=0,l=1;
	for (int i = 1; i <= f; ++i){
		while (l<=i&&p[l].l*2<=p[i].l){
			if (!used[p[l].da]){
				used[p[l].da]=true;
				++cnt;
			}
			++l;
		}
		if (id[i]){
			ans=add(ans,power(2,cnt));
		}
	}
	cout<<ans;
	exit(0);	
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2900 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2900 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2644 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2644 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2900 KB Output is correct
2 Incorrect 2 ms 2900 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2900 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2900 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2784 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 34 ms 7416 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2812 KB Output is correct
2 Correct 2 ms 2900 KB Output is correct
3 Incorrect 2 ms 2916 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 60 ms 10828 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 67 ms 12796 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 55 ms 11084 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 91 ms 12876 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 94 ms 14156 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 59 ms 12916 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 96 ms 13688 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 72 ms 11852 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 109 ms 14724 KB Output isn't correct
2 Halted 0 ms 0 KB -