Submission #93414

#TimeUsernameProblemLanguageResultExecution timeMemory
93414inomMarriage questions (IZhO14_marriage)C++14
36 / 100
1582 ms2808 KiB
#include<bits/stdc++.h> #define fi first #define se second #define pb push_back #define int long long #define sz(c) (int)(c).size() #define all(c) (c).begin(), (c).end() #define rall(c) (c).rbegin(), (c).rend() using namespace std; const int N = 30030; int TN = 1; int n, m, k; int cnt, ans; int us[N][55]; bool flag = false; vector<int> verr[N]; void rec(int a, int b, int cnt, int pos) { if (a > b) { if (cnt >= m) { flag = true; return; } else { return; } } if (cnt >= m) { flag = true; return; } for (int i: verr[a]) { if (!us[pos][i]) { us[pos][i] = 1; rec(a + 1, b, cnt + 1, pos); us[pos][i] = 0; } } rec(a + 1, b, cnt, pos); } void solve() { scanf("%lld %lld %lld", &n, &m, &k); for (int i = 1; i <= k; i++) { int x, y; scanf("%lld %lld", &x, &y); verr[x].push_back(y); } for (int l = 1; l <= n; l++) { for (int r = l + m - 1; r <= n; r++) { flag = false; cnt = 0; rec(l, r, cnt, ans + 1); ans += flag; if (flag) { ans += (n - r); break; } } } printf("%lld\n", ans); return; } signed main() { // in; out; // cin >> TN; while (TN--) { solve(); } return 0; }

Compilation message (stderr)

marriage.cpp: In function 'void solve()':
marriage.cpp:45:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld %lld %lld", &n, &m, &k);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
marriage.cpp:48:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld %lld", &x, &y); verr[x].push_back(y);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...