# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
888328 | 2023-12-17T01:29:42 Z | 1075508020060209tc | Paths (BOI18_paths) | C++14 | 116 ms | 23896 KB |
#pragma GCC optimize("O3") #include<bits/stdc++.h> using namespace std; #define int long long //const int mod=998244353; int n;int m;int K; int cr[500005]; int ar[500005]; int br[500005]; vector<int>e[500005]; int ans; void solve2(){ for(int i=1;i<=m;i++){ if(cr[ar[i]]!=cr[br[i]]){ans+=2;} } } void solve3(){ int ret=0; for(int nw=1;nw<=n;nw++){ vector<int>tbl(10,0); for(int i=0;i<e[nw].size();i++){ int v=e[nw][i]; for(int j=1;j<=5;j++){ if(j==cr[v]){continue;} if(j==cr[nw]){continue;} ret+=tbl[j]; } tbl[cr[v]]++; } } ret*=2; ans+=ret; } signed main(){ cin>>n>>m>>K; for(int i=1;i<=n;i++){ cin>>cr[i]; } for(int i=1;i<=m;i++){ cin>>ar[i]>>br[i]; } ans=n; solve2(); solve3(); cout<<ans<<"\n"; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 16984 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 116 ms | 23896 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 16984 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 16984 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |