QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#650724 | #9431. The Quest for El Dorado | UESTC_Snow_Halation# | WA | 38ms | 34820kb | C++14 | 2.1kb | 2024-10-18 16:15:38 | 2024-10-18 16:15:39 |
Judging History
answer
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>
#define FOR() ll le=e[u].size();for(ll i=0;i<le;i++)
#define QWQ cout<<"QwQ\n";
#define ll long long
#include <vector>
#include <queue>
#include <map>
using namespace std;
const ll N=501010;
const ll qwq=303030;
const ll inf=0x3f3f3f3f;
inline ll read() {
ll sum = 0, ff = 1; char c = getchar();
while(c<'0' || c>'9') { if(c=='-') ff = -1; c = getchar(); }
while(c>='0'&&c<='9') { sum = sum * 10 + c - '0'; c = getchar(); }
return sum * ff;
}
ll T;
ll n,m,K;
struct E{
ll to,we,cl;
};
vector <E> e[N];
struct D{
ll id,di;
};
inline bool operator < (D A,D B) { return A.di > B.di; }
priority_queue <D> q[N];
ll vis[N];
void chushihua() {
for(ll i=1;i<=n;i++) e[i].clear(), vis[i] = 0;
for(ll i=1;i<=m;i++) while(!q[i].empty()) q[i].pop();
}
int main() {
ll x,y,z,cl;
T = read();
while(T--) {
chushihua();
n = read(); m = read(); K = read();
for(ll i=1;i<=m;i++) {
x = read(); y = read(); cl = read(); z = read();
e[x].push_back({y,z,cl});
e[y].push_back({x,z,cl});
}
vis[1] = 1;
for(E vv : e[1]) {
ll v = vv.to, w = vv.we, cl = vv.cl;
q[cl].push({v,w});
}
for(ll i=1;i<=K;i++) {
cl = read(); z = read();
while(!q[cl].empty()) {
D now = q[cl].top();
if(now.di > z) break;
q[cl].pop();
ll u = now.id;
if(vis[u]) continue;
vis[u] = 1;
for(E vv : e[u]) {
ll v = vv.to, w = vv.we, c = vv.cl;
if(c==cl) {
q[c].push({v,now.di+w});
}
else {
q[c].push({v,w});
}
}
}
}
for(ll i=1;i<=n;i++) cout<<vis[i];
cout<<"\n";
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 4ms
memory: 31796kb
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 100
result:
ok 2 lines
Test #2:
score: -100
Wrong Answer
time: 38ms
memory: 34820kb
input:
1110 46 80 30 44 23 5 46 10 28 1 64 32 34 3 40 9 36 1 26 15 14 5 95 38 19 2 34 2 17 4 183 10 38 2 81 5 15 2 83 31 38 3 100 40 30 1 53 41 10 1 193 29 20 5 18 14 41 3 78 8 16 5 74 46 13 3 78 44 28 3 45 1 40 3 133 5 32 1 108 22 26 2 83 10 38 1 77 11 40 1 11 17 21 2 66 41 46 3 98 9 36 2 25 40 18 1 19 27...
output:
1000110011110111110010100001010100100101000000 1000000010101001011011000000001000000100001000 1000000000000000000000000000000000000000000000 1011000000000000000100000010000000000000000010 1000000000000000000000001000010000001001000001 1001100010100000100001100000000011001110110 100010000000000000010...
result:
wrong answer 2nd lines differ - expected: '1100010010111011011011000000011000001100001000', found: '1000000010101001011011000000001000000100001000'