# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
416040 |
2021-06-01T20:45:21 Z |
Pichon5 |
Paths (BOI18_paths) |
C++17 |
|
3000 ms |
13704 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;
vi G[tam];
int C[tam];
ll res=0;
void dfs(int nodo, int mask){
if(__builtin_popcount(mask)==4)return;
for(auto it : G[nodo]){
if(mask&(1<<C[it]))continue;
res++;
dfs(it,mask|(1<<C[it]));
}
}
int main(){
int n,m,k,x,a,b;
cin>>n>>m>>k;
for(int i=1;i<=n;i++){
cin>>x;
C[i]=x-1;
}
for(int i=0;i<m;i++){
cin>>a>>b;
G[a].pb(b);
G[b].pb(a);
}
for(int i=1;i<=n;i++){
dfs(i,(1<<C[i]));
}
cout<<res<<endl;
return 0;
}
Compilation message
paths.cpp:12: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
12 | #pragma GCC optimization ("O3")
|
paths.cpp:13: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
13 | #pragma GCC optimization ("unroll-loops")
|
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
7244 KB |
Output is correct |
2 |
Correct |
5 ms |
7344 KB |
Output is correct |
3 |
Correct |
5 ms |
7260 KB |
Output is correct |
4 |
Correct |
12 ms |
7304 KB |
Output is correct |
5 |
Correct |
7 ms |
7244 KB |
Output is correct |
6 |
Correct |
6 ms |
7344 KB |
Output is correct |
7 |
Correct |
5 ms |
7244 KB |
Output is correct |
8 |
Correct |
5 ms |
7244 KB |
Output is correct |
9 |
Correct |
6 ms |
7244 KB |
Output is correct |
10 |
Correct |
6 ms |
7344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3086 ms |
13704 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
7244 KB |
Output is correct |
2 |
Correct |
5 ms |
7344 KB |
Output is correct |
3 |
Correct |
5 ms |
7260 KB |
Output is correct |
4 |
Correct |
12 ms |
7304 KB |
Output is correct |
5 |
Correct |
7 ms |
7244 KB |
Output is correct |
6 |
Correct |
6 ms |
7344 KB |
Output is correct |
7 |
Correct |
5 ms |
7244 KB |
Output is correct |
8 |
Correct |
5 ms |
7244 KB |
Output is correct |
9 |
Correct |
6 ms |
7244 KB |
Output is correct |
10 |
Correct |
6 ms |
7344 KB |
Output is correct |
11 |
Execution timed out |
3086 ms |
13704 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
7348 KB |
Output is correct |
2 |
Execution timed out |
3059 ms |
9148 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |