QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#650704#9431. The Quest for El DoradoUESTC_Snow_Halation#WA 26ms33960kbC++142.1kb2024-10-18 16:12:032024-10-18 16:12:04

Judging History

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

  • [2024-10-18 16:12:04]
  • 评测
  • 测评结果:WA
  • 用时:26ms
  • 内存:33960kb
  • [2024-10-18 16:12:03]
  • 提交

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(); q[cl].pop();
                ll u = now.id;
                if(now.di > z) continue;
                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: 0ms
memory: 32484kb

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: 26ms
memory: 33960kb

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:

1000000000000100000010000000000100000100000000
1000000000000001000000000000000000000000000000
1000000000000000000000000000000000000000000000
1000000000000000000000000010000000000000000000
1000000000000000000000000000000000000000000000
1001100010000000000000000000000001000000010
100000000000000000000...

result:

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