QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#842654#9960. Baggageucup-team055#WA 1ms3632kbC++202.5kb2025-01-04 13:51:202025-01-04 13:51:30

Judging History

This is the latest submission verdict.

  • [2025-01-04 13:51:30]
  • Judged
  • Verdict: WA
  • Time: 1ms
  • Memory: 3632kb
  • [2025-01-04 13:51:20]
  • Submitted

answer

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
const ll ILL=167167167167167167;
const int INF=2100000000;
#define rep(i,a,b) for (int i=(int)(a);i<(int)(b);i++)
#define all(p) p.begin(),p.end()
template<class T> using _pq = priority_queue<T, vector<T>, greater<T>>;
template<class T> ll LB(vector<T> &v,T a){return lower_bound(v.begin(),v.end(),a)-v.begin();}
template<class T> ll UB(vector<T> &v,T a){return upper_bound(v.begin(),v.end(),a)-v.begin();}
template<class T> bool chmin(T &a,T b){if(b<a){a=b;return 1;}else return 0;}
template<class T> bool chmax(T &a,T b){if(a<b){a=b;return 1;}else return 0;}
template<class T> void So(vector<T> &v) {sort(v.begin(),v.end());}
template<class T> void Sore(vector<T> &v) {sort(v.begin(),v.end(),[](T x,T y){return x>y;});}
bool yneos(bool a,bool upp=0){if(a){cout<<(upp?"YES\n":"Yes\n");}else{cout<<(upp?"NO\n":"No\n");}return a;}
template<class T> void vec_out(vector<T> &p,int ty=0){
    if(ty==2){cout<<'{';for(int i=0;i<(int)p.size();i++){if(i){cout<<",";}cout<<'"'<<p[i]<<'"';}cout<<"}\n";}
    else{if(ty==1){cout<<p.size()<<"\n";}for(int i=0;i<(int)(p.size());i++){if(i) cout<<" ";cout<<p[i];}cout<<"\n";}}
template<class T> T vec_min(vector<T> &a){assert(!a.empty());T ans=a[0];for(auto &x:a) chmin(ans,x);return ans;}
template<class T> T vec_max(vector<T> &a){assert(!a.empty());T ans=a[0];for(auto &x:a) chmax(ans,x);return ans;}
template<class T> T vec_sum(vector<T> &a){T ans=T(0);for(auto &x:a) ans+=x;return ans;}
int pop_count(long long a){int res=0;while(a){res+=(a&1),a>>=1;}return res;}



void solve();
// CITRUS CURIO CITY / FREDERIC
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int t = 1;
    // cin >> t;
    rep(i, 0, t) solve();
}

void solve(){
    int N, M;
    cin >> N >> M;
    vector G(3, vector(N, vector<ll>(N, ILL)));
    rep(i, 0, 3) rep(j, 0, N) G[i][j][j] = 0;
    rep(i, 0, M){
        int a, b, d;
        ll c;
        cin >> a >> b >> c >> d;
        a--, b--;
        rep(k, 0, d + 1){
            chmin(G[k][a][b], c);
        }
    }
    rep(a, 0, 3) rep(j, 0, N) rep(i, 0, N) rep(k, 0, N){
        chmin(G[a][i][k], G[a][i][j] + G[a][j][k]);
    }
    rep(x, 0, N) rep(y, 0, N){
        ll ans = ILL;
        rep(z, 0, N){
            chmin(ans, G[2][x][z] + G[1][z][y] * 2ll + G[0][y][z]);
        }
        if (ans == ILL) ans = -1;
        cout << ans;
        if (y + 1 == N) cout << "\n";
        else cout << " ";
    }
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3632kb

input:

5 7
1 2 500 2
2 3 100 1
3 5 20 2
5 4 5 1
4 2 1 0
3 4 40 2
5 4 77 1

output:

0 500 726 751 746
-1 0 226 251 246
-1 -1 0 40 20
-1 -1 -1 0 -1
-1 -1 -1 131 0

result:

ok 25 numbers

Test #2:

score: -100
Wrong Answer
time: 1ms
memory: 3552kb

input:

30 5000
1 15 15034 0
1 15 15034 0
24 28 14745 2
1 15 15034 0
16 25 13210 0
16 22 26942 0
24 20 5423 1
4 12 636 0
16 12 19327 0
1 15 15034 0
1 15 15034 0
3 28 18940 2
1 15 15034 0
15 9 6468 0
20 3 6233 2
19 4 10829 2
1 15 15034 0
26 6 20998 0
1 15 15034 0
1 15 15034 0
1 15 15034 0
4 14 20515 2
1 15 1...

output:

0 868 1159 2954 3001 1108 1557 3972 596 1521 5089 1332 3230 871 2010 2145 1610 783 2677 1490 2120 3440 2627 4515 228 1088 2630 4394 3681 2618
2534 0 291 3106 3753 3127 4053 4838 3130 2387 4580 464 4486 1719 2784 2818 2476 3317 2343 777 2777 3121 1759 5381 2762 1354 5164 6928 3603 3370
2243 3111 0 28...

result:

wrong answer 4th numbers differ - expected: '2449', found: '2954'