Submission #472274

#TimeUsernameProblemLanguageResultExecution timeMemory
472274elgamalsalmanPolitical Development (BOI17_politicaldevelopment)C++14
16 / 100
67 ms4516 KiB
#include <bits/stdc++.h> using namespace std; #define fi first #define se second typedef long long ll; typedef pair<ll, ll> ii; typedef vector<ll> vi; typedef vector<vi> vvi; typedef vector<ii> vii; typedef vector<vii> vvii; int n, k; bool foundTriple = 0, foundDouble = 0; vvi adj; bitset<5005> adjMatrix[5005]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> n >> k; adj.assign(n + 20, vi()); for (int i = 0; i < n; i++) { int d; cin >> d; while (d--) { foundDouble = 1; int v; cin >> v; adj[i].push_back(v); adj[v].push_back(i); adjMatrix[i][v] = 1; adjMatrix[v][i] = 1; } } for (int i = 0; !foundTriple && i < n; i++) { for (int j = 0; !foundTriple && j < adj[i].size(); j++) { for (int k = j + 1; !foundTriple && k < adj[i].size(); k++) { int jj = adj[i][j]; int kk = adj[i][k]; if (adjMatrix[jj][kk]) { foundTriple = 1; //cerr << "// " << i << ", " << jj << ", " << kk << "\n"; } } } } if (foundTriple) cout << "3\n"; else if (foundDouble) cout << "2\n"; else cout << "1\n"; }

Compilation message (stderr)

politicaldevelopment.cpp: In function 'int main()':
politicaldevelopment.cpp:39:39: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |     for (int j = 0; !foundTriple && j < adj[i].size(); j++) {
      |                                     ~~^~~~~~~~~~~~~~~
politicaldevelopment.cpp:40:45: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |       for (int k = j + 1; !foundTriple && k < adj[i].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...
#Verdict Execution timeMemoryGrader output
Fetching results...