Submission #579749

#TimeUsernameProblemLanguageResultExecution timeMemory
579749HeyYouNotYouYouPaths (BOI18_paths)C++14
0 / 100
3076 ms42636 KiB
#include <bits/stdc++.h> #define int long long #define endl '\n' using namespace std; const int N = 300001,INF=1e12; int n , m , k , x , vis[N]; vector<int>col[4]; vector<set<int>>edges(N); int ans=0; int32_t main() { //freopen("abc.in", "r", stdin); cin >> n >> m >> k ; for(int i = 1 ; i <= n ; i ++){ cin >> x; col[x].push_back(i); } for(int i = 0 ; i < m ; i ++) { int u , v ; cin >> u >> v; edges[u].insert(v); edges[v].insert(u); } vector<vector<int>>v; v.push_back({1,2,3}); v.push_back({1,3,2}); v.push_back({2,1,3}); int ans=0; for(int i = 0 ; i < v.size() ; i ++){ for(int j = 0 ; j < col[v[i][0]].size() ; j ++){ for(int p = 0 ; p < col[v[i][1]].size() ; p ++){ if(edges[col[v[i][0]][j]].count(col[v[i][1]][p])){ ans++; for(int k = 0 ; k < col[v[i][2]].size() ; k ++){ if(edges[col[v[i][1]][p]].count(col[v[i][2]][k])){ ans+=3; } } } } } } cout<<ans<<endl; }

Compilation message (stderr)

paths.cpp: In function 'int32_t main()':
paths.cpp:30:21: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::vector<long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |   for(int i = 0 ; i < v.size() ; i ++){
      |                   ~~^~~~~~~~~~
paths.cpp:31:23: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |     for(int j = 0 ; j < col[v[i][0]].size() ; j ++){
      |                     ~~^~~~~~~~~~~~~~~~~~~~~
paths.cpp:32:25: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |       for(int p = 0 ; p < col[v[i][1]].size() ; p ++){
      |                       ~~^~~~~~~~~~~~~~~~~~~~~
paths.cpp:35:29: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |           for(int k = 0 ; k < col[v[i][2]].size() ; k ++){
      |                           ~~^~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...