Submission #887413

# Submission time Handle Problem Language Result Execution time Memory
887413 2023-12-14T13:13:39 Z pcc Nice sequence (IZhO18_sequence) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>using namespace std; #pragma GCC optimize("O3,unroll-loops")#pragma GCC target("avx2,popcnt") #define ll long long#define pll pair<ll,ll>#define pii pair<int,int>#define fs first#define sc second#define tlll tuple<ll,ll,ll> const int mxn = 4e5+10;int n,m;vector<int> paths[mxn];int deg[mxn];queue<int> q;int arr[mxn];map<pii,int> mp; inline bool check(int tar){	for(int i = 0;i+n<=tar;i++){		paths[i+n].push_back(i);		deg[i]++;	}	for(int i = 0;i+m<=tar;i++){		paths[i].push_back(i+m);		deg[i+m]++;	}	for(int i = 0;i<=tar;i++){		if(!deg[i])q.push(i);	}	int p = 0;	while(!q.empty()){		auto now = q.front();		arr[now] = ++p;		q.pop();		for(auto nxt:paths[now]){			deg[nxt]--;			if(!deg[nxt])q.push(nxt);		}	}	for(int i = 0;i<=tar;i++){		paths[i].clear();		deg[i] = 0;	}	//cout<<tar<<":"<<p<<endl;	return p == tar+1;} inline void solve(){	cin>>n>>m;	int l = 0,r = max(n,m)*2;	if(mp.find({n,m}) != mp.end()){		l = r = mp[make_pair(n,m)];	}    l = r = n+m-__gcd(n,m)-1;	while(l != r){		int mid = (l+r+1)>>1;		if(check(mid))l = mid;		else r = mid-1;	}	check(l);	cout<<l<<endl;    return;	//for(int i = 1;i<=l;i++)cout<<arr[i]<<' ';cout<<endl;	mp[make_pair(n,m)] = l;	for(int i  =1;i<=l;i++)cout<<arr[i]-arr[i-1]<<' ';cout<<'\n';	return;} int main(){	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);	int t;cin>>t;	while(t--)solve();}

Compilation message

sequence.cpp:1:31: warning: extra tokens at end of #include directive
    1 | #include <bits/stdc++.h>using namespace std; #pragma GCC optimize("O3,unroll-loops")#pragma GCC target("avx2,popcnt") #define ll long long#define pll pair<ll,ll>#define pii pair<int,int>#define fs first#define sc second#define tlll tuple<ll,ll,ll> const int mxn = 4e5+10;int n,m;vector<int> paths[mxn];int deg[mxn];queue<int> q;int arr[mxn];map<pii,int> mp; inline bool check(int tar){ for(int i = 0;i+n<=tar;i++){  paths[i+n].push_back(i);  deg[i]++; } for(int i = 0;i+m<=tar;i++){  paths[i].push_back(i+m);  deg[i+m]++; } for(int i = 0;i<=tar;i++){  if(!deg[i])q.push(i); } int p = 0; while(!q.empty()){  auto now = q.front();  arr[now] = ++p;  q.pop();  for(auto nxt:paths[now]){   deg[nxt]--;   if(!deg[nxt])q.push(nxt);  } } for(int i = 0;i<=tar;i++){  paths[i].clear();  deg[i] = 0; } //cout<<tar<<":"<<p<<endl; return p == tar+1;} inline void solve(){ cin>>n>>m; int l = 0,r = max(n,m)*2; if(mp.find({n,m}) != mp.end()){  l = r = mp[make_pair(n,m)]; }    l = r = n+m-__gcd(n,m)-1; while(l != r){  int mid = (l+r+1)>>1;  if(check(mid))l = mid;  else r = mid-1; } check(l); cout<<l<<endl;    return; //for(int i = 1;i<=l;i++)cout<<arr[i]<<' ';cout<<endl; mp[make_pair(n,m)] = l; for(int i  =1;i<=l;i++)cout<<arr[i]-arr[i-1]<<' ';cout<<'\n'; return;} int main(){ ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); int t;cin>>t; while(t--)solve();}
      |                               ^~~~~~~~~
sequence.cpp:1:10: fatal error: bits/stdc++.h>usin: No such file or directory
    1 | #include <bits/stdc++.h>using namespace std; #pragma GCC optimize("O3,unroll-loops")#pragma GCC target("avx2,popcnt") #define ll long long#define pll pair<ll,ll>#define pii pair<int,int>#define fs first#define sc second#define tlll tuple<ll,ll,ll> const int mxn = 4e5+10;int n,m;vector<int> paths[mxn];int deg[mxn];queue<int> q;int arr[mxn];map<pii,int> mp; inline bool check(int tar){ for(int i = 0;i+n<=tar;i++){  paths[i+n].push_back(i);  deg[i]++; } for(int i = 0;i+m<=tar;i++){  paths[i].push_back(i+m);  deg[i+m]++; } for(int i = 0;i<=tar;i++){  if(!deg[i])q.push(i); } int p = 0; while(!q.empty()){  auto now = q.front();  arr[now] = ++p;  q.pop();  for(auto nxt:paths[now]){   deg[nxt]--;   if(!deg[nxt])q.push(nxt);  } } for(int i = 0;i<=tar;i++){  paths[i].clear();  deg[i] = 0; } //cout<<tar<<":"<<p<<endl; return p == tar+1;} inline void solve(){ cin>>n>>m; int l = 0,r = max(n,m)*2; if(mp.find({n,m}) != mp.end()){  l = r = mp[make_pair(n,m)]; }    l = r = n+m-__gcd(n,m)-1; while(l != r){  int mid = (l+r+1)>>1;  if(check(mid))l = mid;  else r = mid-1; } check(l); cout<<l<<endl;    return; //for(int i = 1;i<=l;i++)cout<<arr[i]<<' ';cout<<endl; mp[make_pair(n,m)] = l; for(int i  =1;i<=l;i++)cout<<arr[i]-arr[i-1]<<' ';cout<<'\n'; return;} int main(){ ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); int t;cin>>t; while(t--)solve();}
      |          ^~~~~~~~~~~~~~~~~~~~
compilation terminated.