# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
416070 | 2021-06-01T22:01:13 Z | Pichon5 | Paths (BOI18_paths) | C++17 | 364 ms | 14140 KB |
#include<bits/stdc++.h> #define ll long long int #define pb push_back #define vi vector<int> #define vll vector<ll> #define ff first #define ss second #define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); //"\n" __builtin_popcount using namespace std; #pragma GCC target ("avx2") #pragma GCC optimization ("O3") #pragma GCC optimization ("unroll-loops") const int tam=300005; ll G[tam][3]; ll C[tam]; int main(){ ll n,m,k,x,a,b; cin>>n>>m>>k; for(int i=1;i<=n;i++){ cin>>x; C[i]=x-1; } ll res=0; for(int i=0;i<m;i++){ cin>>a>>b; if(C[a]!=C[b])res+=2; G[a][C[b]]++; G[b][C[a]]++; } for(int i=1;i<=n;i++){ if(C[i]==0)res+=2*G[i][1]*G[i][2]; if(C[i]==1)res+=2*G[i][0]*G[i][2]; if(C[i]==2)res+=2*G[i][0]*G[i][1]; } cout<<res<<endl; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 300 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 192 ms | 1468 KB | Output is correct |
2 | Correct | 157 ms | 824 KB | Output is correct |
3 | Correct | 345 ms | 12092 KB | Output is correct |
4 | Correct | 207 ms | 2500 KB | Output is correct |
5 | Correct | 224 ms | 2436 KB | Output is correct |
6 | Correct | 295 ms | 8524 KB | Output is correct |
7 | Correct | 333 ms | 14136 KB | Output is correct |
8 | Correct | 364 ms | 14140 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 300 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Incorrect | 52 ms | 764 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |