Submission #345373

#TimeUsernameProblemLanguageResultExecution timeMemory
345373_zheksenovMarriage questions (IZhO14_marriage)C++14
64 / 100
1598 ms2284 KiB
#include <bits/stdc++.h> using namespace std; signed main() { int n, m, k; cin >> n >> m >> k; vector<vector<int> > g; g.resize(n + 2); for (int i = 0; i < k; i++) { int u, v; cin >> u >> v; g[u].push_back(v); } int ans = 0; for (int l = 1; l <= n; l++) { set<int> s; int cnt = 0; for (int r = l; r <= n; r++) { for (auto to : g[r]) s.insert(to); if (g[r].empty()) cnt++; int length = r - l + 1; if (s.size() == m && s.size() <= length - cnt) { ans++; } } } cout << ans << "\n"; return 0; }

Compilation message (stderr)

marriage.cpp: In function 'int main()':
marriage.cpp:25:26: warning: comparison of integer expressions of different signedness: 'std::set<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   25 |             if (s.size() == m && s.size() <= length - cnt) {
      |                 ~~~~~~~~~^~~~
marriage.cpp:25:43: warning: comparison of integer expressions of different signedness: 'std::set<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   25 |             if (s.size() == m && s.size() <= length - cnt) {
      |                                  ~~~~~~~~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...