QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#112912#6391. AirplaneLFCode0 18ms13480kbC++141.3kb2023-06-15 11:12:262023-06-15 11:12:27

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-06-15 11:12:27]
  • 评测
  • 测评结果:0
  • 用时:18ms
  • 内存:13480kb
  • [2023-06-15 11:12:26]
  • 提交

answer

#include<cstdio>
#include<queue>
using namespace std;
const int N=200086,M=400086,INF=2e9;
int n,m,tot=1,a[N],d[2][N],eu[M],ev[M],h[N];
struct edge{int v,nxt;}e[M<<1];
struct node{
	int no,dis;
	node(int n,int d){no=n;dis=d;}
	bool operator <(const node b)const{return b.dis>dis;}
};
priority_queue<node>q;
int Max(int a,int b){return a>b?a:b;}
int Min(int a,int b){return a<b?a:b;}
int read(){
	char ch=getchar();int nn=0,ssss=1;
	while(ch<'0'||ch>'9'){if(ch=='-')ssss*=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){nn=nn*10+(ch-'0');ch=getchar();}
	return nn*ssss;
}
bool add(int u,int v){e[++tot].v=v;e[tot].nxt=h[u];h[u]=tot;return true;}
bool dij(int s,int flr){
	for(int i=1;i<=n;i++)d[flr][i]=INF;
	while(!q.empty())q.pop();q.push(node(s,d[flr][s]=0));
	while(!q.empty()){
		node np=q.top();q.pop();if(np.dis!=d[flr][np.no])continue;
		for(int i=h[np.no];i;i=e[i].nxt){
			int nd=Max(d[flr][np.no]+1,a[e[i].v]);
			if(nd<d[flr][e[i].v])q.push(node(e[i].v,d[flr][e[i].v]=nd));
		}
	}
	return true;
}
int main(){
	n=read();m=read();for(int i=1;i<=n;i++)a[i]=read();
	for(int i=1;i<=m;i++){
		eu[i]=read();ev[i]=read();
		if(eu[i]>ev[i]){eu[i]+=ev[i];ev[i]=eu[i]-ev[i];eu[i]-=ev[i];}
		add(eu[i],ev[i]);add(ev[i],eu[i]);
	}
	dij(1,0);dij(n,1);int ans=INF;
	for(int i=2;i<n;i++)ans=Min(ans,d[0][i]+d[1][i]);
	printf("%d",ans);
}

详细

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 18ms
memory: 13480kb

input:

200000 199999
0 199 58 60 83 5 10 182 87 65 104 153 197 137 80 143 34 181 62 48 10 57 86 58 117 10 171 188 95 52 95 140 126 0 196 85 87 14 10 139 177 92 31 18 102 146 68 9 91 124 156 38 41 121 183 10 32 174 171 29 49 26 118 1 69 185 57 168 54 159 195 95 9 32 195 70 85 174 158 82 33 197 66 189 198 11...

output:

200298

result:

wrong answer 1st lines differ - expected: '200378', found: '200298'

Subtask #2:

score: 0
Wrong Answer

Test #8:

score: 0
Wrong Answer
time: 0ms
memory: 9148kb

input:

6 10
0 0 6 1 8 0
5 6
2 3
5 4
6 4
3 5
6 2
3 6
3 4
3 1
6 1

output:

3

result:

wrong answer 1st lines differ - expected: '1', found: '3'

Subtask #3:

score: 0
Skipped

Dependency #2:

0%

Subtask #4:

score: 0
Skipped

Dependency #1:

0%