QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#758214#9431. The Quest for El DoradoxiaofangerWA 0ms3556kbC++171.4kb2024-11-17 16:49:572024-11-17 16:49:57

Judging History

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

  • [2024-11-17 16:49:57]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3556kb
  • [2024-11-17 16:49:57]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double

const int N = 5e5 + 10;

void solve() {
	
	int n , m , k; cin >> n >> m >> k;
	
	vector<priority_queue<pair<int , int> , vector<pair<int , int>> , greater<pair<int , int>>>> q(m + 1);
	vector<vector<array<int , 3>>> e(n + 1);
	for(int i = 1 ; i <= m ; i++){
		int u , v , c , l; cin >> u >> v >> c >> l;
		
		e[u].push_back({v , c , l});
		e[v].push_back({u , c , l});
	}
	
	for(auto [v , c , l] : e[1]){
		q[c].push({l , v});
	}

	vector<int> vis(n + 1 , 0);
	vis[1] = 1;
	for(int i = 1 ; i <= n ; i++){
		int a , b; cin >> a >> b;
		priority_queue<pair<int , int> , vector<pair<int , int>> , greater<pair<int , int>>> cur;
	
		while(q[a].size() && q[a].top().first <= b){
			auto [w , v] = q[a].top();
			cur.push({w , v});
			q[a].pop();
		}		
		
		while(cur.size()){
			auto [w , u] = cur.top(); cur.pop();
			
			if(vis[u]) continue;
			vis[u] = 1;
			
			for(auto [v , c , l] : e[u]){
				
				if(c == a && w + l <= b){
					cur.push({w + l , v});
				}
				else {
					q[c].push({l , v});
				}
			}
		}
	}
	
	for(int i = 1 ; i <= n ; i++) cout << vis[i];
	cout << '\n';
	
}

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








 

详细

Test #1:

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

input:

2
5 6 4
1 2 1 30
2 3 1 50
2 5 5 50
3 4 6 10
2 4 5 30
2 5 1 40
1 70
6 100
5 40
1 30
3 1 1
2 3 1 10
1 100

output:

11011
1

result:

wrong answer 2nd lines differ - expected: '100', found: '1'