Submission #776474

# Submission time Handle Problem Language Result Execution time Memory
776474 2023-07-08T01:43:17 Z jamezzz Fish (IOI08_fish) C++17
0 / 100
3000 ms 13828 KB
#include <bits/stdc++.h>
using namespace std;

#define sf scanf
#define pf printf
#define fi first
#define se second
#define pb push_back
#define sz(x) ((int)x.size())
#define all(x) x.begin(),x.end()
#define LINF 1023456789123456789
typedef long long ll;
typedef pair<int,int> ii;
typedef pair<ll,int> li;

#define maxn 500005

int n,k,m,cnt[maxn],bad[maxn];
vector<ii> v;

int main(){
	sf("%d%d%d",&n,&k,&m);
	for(int i=0;i<n;++i){
		int l,c;
		sf("%d%d",&l,&c);
		v.pb({l,c});
		++cnt[c];
	}
	sort(all(v));
	int ptr=n-1;
	int ans=0;
	for(int i=n-1;i>=0;--i){
		if(bad[v[i].se])continue;
		while(ptr>=0&&v[i].fi<2*v[ptr].fi){
			--cnt[v[ptr].se];
			--ptr;
		}
		int add=1;
		for(int i=1;i<=k;++i){
			if(!bad[i]){
				add=add*(cnt[i]+1)%m;
			}
		}
		bad[v[i].se]=1;
		ans+=add;
		ans%=m;
	}
	pf("%d\n",ans);
}

Compilation message

fish.cpp: In function 'int main()':
fish.cpp:22:4: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   22 |  sf("%d%d%d",&n,&k,&m);
      |    ^
fish.cpp:25:5: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   25 |   sf("%d%d",&l,&c);
      |     ^
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 312 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 312 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Incorrect 1 ms 340 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Incorrect 113 ms 10488 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 46 ms 4412 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 12 ms 408 KB Output is correct
2 Correct 4 ms 468 KB Output is correct
3 Incorrect 9 ms 460 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 76 ms 8220 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 128 ms 10468 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 107 ms 8460 KB Output is correct
2 Incorrect 243 ms 11356 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 515 ms 10320 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1094 ms 11856 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3067 ms 9956 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3055 ms 12376 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3051 ms 10204 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3044 ms 13828 KB Time limit exceeded
2 Halted 0 ms 0 KB -