QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#163779#7119. Longest TripCrysflyCompile Error//C++171.7kb2023-09-04 15:06:522024-04-28 08:13:50

Judging History

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

  • [2024-04-28 08:13:50]
  • 管理员手动重测本题所有提交记录
  • [2023-09-04 15:06:52]
  • 评测
  • [2023-09-04 15:06:52]
  • 提交

answer

// what is matter? never mind. 
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,sse4,popcnt,abm,mmx,avx,avx2") 
#include"trip.h"
#include<bits/stdc++.h>
#define For(i,a,b) for(int i=(a);i<=(b);++i)
#define Rep(i,a,b) for(int i=(a);i>=(b);--i)
#define ll long long
//#define int long long
#define ull unsigned long long
using namespace std;
inline int read()
{
	char c=getchar();int x=0;bool f=0;
	for(;!isdigit(c);c=getchar())f^=!(c^45);
	for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+(c^48);
	if(f)x=-x;return x;
}

#define fi first
#define se second
#define pb push_back
#define mkp make_pair
typedef pair<int,int>pii;
typedef vector<int>vi;

#define maxn 200005
#define inf 0x3f3f3f3f

int n;
int mp[260][260];

int Q(int i,int j){
	if(mp[i][j]!=-1)return mp[i][j];
	return mp[i][j]=mp[j][i]=are_connected({i},{j});
}
int Q(vi a,vi b){
	return are_connected(a,b);
}
void operator +=(vi&a,vi&b){
	for(int x:b) a.pb(x);
}

vi longest_trip(int N,int D)
{
	n=N;
	For(i,0,n-1)For(j,0,n-1)mp[i][j]=(i==j?0:-1);
	vi a,b; a.pb(0);
	For(i,1,n-1){
		if(Q(i,a.back())) a.pb(i);
		else if(b.size() && Q(i,b.back())) b.pb(i);
		else reverse(b.begin(),b.end()),a+=b,b.clear();
	}
	if(!b.size())return a;
	if(!Q(a,b))return a.size()>b.size()?a:b;
	if(Q(a[0],b[0])) return reverse(a.begin(),a.end()),a+=b,a;
	if(Q(a.back(),b[0])) return a+=b,a;
	if(Q(a[0],b.back())) return b+=a,b;
	if(Q(a.back(),b.back())) return reverse(a.begin(),a.end()),b+=a,b;
	For(i,0,(int)a.size()-1)
		For(j,0,(int)b.size()-1){
			if(Q(a[i],b[j])){
				rotate(a.begin(),a.begin()+i,a.end());
				rotate(b.begin(),b.begin()+j+1,b.end());
				return a+=b,a;
			}
		}
	assert(0);
}

詳細信息

answer.code:5:9: fatal error: trip.h: No such file or directory
    5 | #include"trip.h"
      |         ^~~~~~~~
compilation terminated.