Submission #1093819

#TimeUsernameProblemLanguageResultExecution timeMemory
10938198pete8A Game with Grundy (CCO20_day1problem1)C++17
25 / 25
92 ms16464 KiB
#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 (stderr)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...