QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#205146#7558. Abstractucup-team1134#WA 513ms3836kbC++171.3kb2023-10-07 15:00:062023-10-07 15:00:07

Judging History

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

  • [2023-10-07 15:00:07]
  • 评测
  • 测评结果:WA
  • 用时:513ms
  • 内存:3836kb
  • [2023-10-07 15:00:06]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=998244353,MAX=300005,INF=1<<30;

#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")

ll A[10005],B[10005];

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N,M;cin>>N>>M;
    for(int i=0;i<N;i++) cin>>A[i];
    
    vector<pair<int,int>> E(M);
    vector<int> deg(N);
    
    for(int i=0;i<M;i++){
        int a,b;cin>>a>>b;a--;b--;
        E[i]=mp(a,b);
        deg[a]++;
    }
    
    int x=-1;
    for(int i=0;i<N;i++) if(deg[i]==0) x=i;
    
    for(int t=0;;t++){
        int cn=0;
        for(int i=0;i<N;i++) if(A[i]) cn++;
        if(cn==0){
            cout<<t<<endl;
            return 0;
        }
        
        for(auto [a,b]:E){
            B[b]+=A[a];
        }
        B[x]+=A[x]/2;
        for(int i=0;i<N;i++){
            A[i]=B[i];
            B[i]=0;
        }
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3484kb

input:

3 2
1 1 1
1 2
2 3

output:

3

result:

ok 1 number(s): "3"

Test #2:

score: 0
Accepted
time: 0ms
memory: 3444kb

input:

6 8
1 1 4 5 1 4
1 4
1 5
2 3
2 5
3 4
4 5
4 6
5 6

output:

8

result:

ok 1 number(s): "8"

Test #3:

score: 0
Accepted
time: 0ms
memory: 3420kb

input:

5 6
7 2 3 6 6
1 2
1 4
2 3
3 4
3 5
4 5

output:

9

result:

ok 1 number(s): "9"

Test #4:

score: -100
Wrong Answer
time: 513ms
memory: 3836kb

input:

7286 80481
637288250 628935175 588324396 766398783 663989874 865498593 695497968 630237220 19939888 448367842 412696777 111291257 304805809 585852799 58270069 391993802 606944382 827515045 389862501 643981354 160381074 324288921 257053597 980043955 417281046 870855665 360154617 60327683 966755927 55...

output:

7336

result:

wrong answer 1st numbers differ - expected: '7344', found: '7336'