Submission #1093819

# Submission time Handle Problem Language Result Execution time Memory
1093819 2024-09-27T15:13:31 Z 8pete8 A Game with Grundy (CCO20_day1problem1) C++17
25 / 25
92 ms 16464 KB
#include<iostream>
#include<stack>
#include<map>
#include<vector>
#include<string>
#include<cassert>
#include<unordered_map>
#include <queue>
#include <cstdint>
#include<cstring>
#include<limits.h>
#include<cmath>
#include<set>
#include<algorithm>
#include <iomanip>
#include<numeric>
#include<bitset>
using namespace std;
#define ll long long
#define f first
#define s second
#define pii pair<int,int>
#define ppii pair<int,pii>
#define vi vector<int>
#define pb push_back
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define F(n) for(int i=0;i<n;i++)
#define lb lower_bound
#define ub upper_bound
#define fastio ios::sync_with_stdio(false);cin.tie(NULL);
#pragma GCC optimize ("03,unroll-lopps")
#define int long long
#define double long double
using namespace std;
const int mod=998244353,mxn=2e5+5,inf=1e18,minf=-1e18,lg=30;
//#undef int
int n,k,m,q;
void setIO(string name){		
	ios_base::sync_with_stdio(0); cin.tie(0);		
	freopen((name+".in").c_str(),"r",stdin);		
	freopen((name+".out").c_str(),"w",stdout);	
}
struct line{
	double m,c;
	void init(int a,int b,int x){
		m=(a*1.0/b*1.0);
		c=(m*1.0*(-x)*1.0);
	}
};
int32_t main(){
    fastio
	cin>>n;
	int l,r,y;cin>>l>>r>>y;
	map<int,int>cnt;
	cnt[r+1]=0;
	for(int i=0;i<n;i++){
		int x,a,b;cin>>x>>a>>b;
		int w=(y*b-1)/a;
		cnt[max(l,x-w)]++;
		cnt[min(r+1,x+w+1)]--;
	}
	vector<int>ans(n+1,0);
	int curcnt=0,last=l;
	for(auto i:cnt){
		ans[curcnt]+=(i.f-last);
		curcnt+=i.s;
		last=i.f;
	}
	for(int i=0;i<=n;i++){
		if(i)ans[i]+=ans[i-1];
		cout<<ans[i]<<'\n';
	}
}
/*
*/

Compilation message

Main.cpp:32:40: warning: bad option '-funroll-lopps' to pragma 'optimize' [-Wpragmas]
   32 | #pragma GCC optimize ("03,unroll-lopps")
      |                                        ^
Main.cpp:39:23: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
   39 | void setIO(string name){
      |                       ^
Main.cpp:46:29: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
   46 |  void init(int a,int b,int x){
      |                             ^
Main.cpp:51:14: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
   51 | int32_t main(){
      |              ^
Main.cpp: In function 'void setIO(std::string)':
Main.cpp:41:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   41 |  freopen((name+".in").c_str(),"r",stdin);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:42:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   42 |  freopen((name+".out").c_str(),"w",stdout);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 62 ms 9268 KB Output is correct
4 Correct 71 ms 13896 KB Output is correct
5 Correct 79 ms 13648 KB Output is correct
6 Correct 21 ms 3160 KB Output is correct
7 Correct 30 ms 7072 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 62 ms 9268 KB Output is correct
4 Correct 71 ms 13896 KB Output is correct
5 Correct 79 ms 13648 KB Output is correct
6 Correct 21 ms 3160 KB Output is correct
7 Correct 30 ms 7072 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 77 ms 16268 KB Output is correct
10 Correct 79 ms 16464 KB Output is correct
11 Correct 76 ms 16208 KB Output is correct
12 Correct 92 ms 15952 KB Output is correct
13 Correct 37 ms 10576 KB Output is correct