QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#518561#7517. Flying Ship StoryKLPP#Compile Error//C++172.0kb2024-08-13 22:06:312024-08-13 22:06:31

Judging History

你现在查看的是最新测评结果

  • [2024-08-13 22:06:31]
  • 评测
  • [2024-08-13 22:06:31]
  • 提交

answer

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
typedef long long int lld;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define trav(a,v) for(auto a:v)
map<lld,int> deg;
void solve(){
	lld last=0;
	int q;
	cin>>q;
	map<pair<lld,lld>,lld> m;
	while(q--){
		int type;
		cin>>type;
		if(type==1){
			lld x,y,w;
			cin>>x>>y>>w;
			x^=last;
			y^=last;
			w^=last;
			if(m.find({x,y})!=m.end())m[{x,y}]=max(m[{x,y}],w);
			else m[{x,y}]=w;
			bool change=true;
			while(change){
				change=false;
				deg.clear();
				trav(a,m){
					deg[a.first.first]++;
				}
				lld X=-1;
				trav(a,deg){
					if(a.second>=3){
						X=a.first;
					}
				}
				if(X>=0){
					change=true;
					pair<lld,lld> el={1e18,-1};
					trav(a,m){
						if(a.first.first==X){
							el=min(el,{a.second,a.first.second});
						}
					}
					m.erase({X,el.second});
				}
			}
			change=true;
			while(change){
				change=false;
				deg.clear();
				trav(a,m){
					deg[a.first.second]++;
				}
				lld Y=-1;
				trav(a,deg){
					if(a.second>=3){
						Y=a.first;
					}
				}
				if(Y>=0){
					change=true;
					pair<lld,lld> el={1e18,-1};
					trav(a,m){
						if(a.first.second==Y){
							el=min(el,{a.second,a.first.first});
						}
					}
					m.erase({el.second,Y});
				}
			}
			while(m.size()>10){
				pair<lld,pair<lld,lld> >p={1e18,{-1,-1}};
				trav(a,m){
					p=min(p,{a.second,a.first});
				}
				m.erase(p.second);
			}
		}else{
			lld x,y;
			cin>>x>>y;
			x^=last;
			y^=last;
			lld ans=0;
			trav(a,m){
				if(a.first.first!=x && a.first.second!=y)ans=max(ans,a.second);
			}
			cout<<ans<<"\n";
			last=ans;
		}
	}
}

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int tt=1;
	//cin>>tt;
	while(tt--){
		solve();
	}
}

Details

answer.code: In function ‘void solve()’:
answer.code:77:72: error: narrowing conversion of ‘1.0e+18’ from ‘double’ to ‘long long int’ [-Wnarrowing]
   77 |                                 pair<lld,pair<lld,lld> >p={1e18,{-1,-1}};
      |                                                                        ^