Submission #980823

#TimeUsernameProblemLanguageResultExecution timeMemory
980823UnforgettableplDuathlon (APIO18_duathlon)C++17
5 / 100
1053 ms600 KiB
#include <bits/stdc++.h> using namespace std; #define int long long int adj[11][11]; bool ans[11][11][11]; void calc(const vector<int>& path){ if(path.size()<3)return; for(int i=1;i<path.size();i++){ if(!adj[path[i]][path[i-1]])return; for(int k=1;k<i;k++)ans[path[0]][path[k]][path[i]]=true; } } int32_t main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); int n,m; cin >> n >> m; for(int i=1;i<=m;i++){ int a,b;cin>>a>>b; adj[a][b]=adj[b][a]=true; } vector<int> path(n);iota(path.begin(), path.end(),1); do { calc(path); } while(next_permutation(path.begin(), path.end())); int curr = 0; for(int i=1;i<=n;i++)for(int j=1;j<=n;j++)for(int k=1;k<=n;k++)if(ans[i][j][k])curr++; cout << curr << '\n'; }

Compilation message (stderr)

count_triplets.cpp: In function 'void calc(const std::vector<long long int>&)':
count_triplets.cpp:11:18: 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]
   11 |     for(int i=1;i<path.size();i++){
      |                 ~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...