Submission #337282

# Submission time Handle Problem Language Result Execution time Memory
337282 2020-12-19T08:59:51 Z boykut Marriage questions (IZhO14_marriage) C++14
32 / 100
5 ms 384 KB
#include <bits/stdc++.h>

using namespace std;

const int MAXN = 101, MAXM = 51;
const int MAXK = MAXN * MAXM;

int dp[MAXN][MAXM], a[MAXK], b[MAXK], n, m, k;

bool can (int l, int r) {
   int mas[m + 1];
   fill (mas, mas + 1 + m, 0);
   for (int i = l; i <= r; i++) {
      for (int j = 1; j <= m; j++) {
         mas[j] |= dp[i][j];
      }
   }
   if (count(mas, mas + 1 + m, 0) == 1) {
      //cout << "(" << l << ' ' << r << "), ";
      return true;
   } else return false;
}

signed main() {
   ios::sync_with_stdio(0);
   cin.tie(0);
   
   cin >> n >> m >> k;
   
   if (!(n <= 100 && m <= 50))
      return 0;
   
   for (int i = 0; i < k; i++) {
      cin >> a[i] >> b[i];
      dp[a[i]][b[i]] = 1;
   }
   
   int ans = 0;
   for (int l = 1; l <= n; l++) {
      for (int r = l + m - 1; r <= n; r++) {
         if (can(l, r)) 
            ans++;
      }
   }
   
   cout << ans << '\n';
   
   return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Incorrect 1 ms 364 KB Output isn't correct
3 Incorrect 1 ms 364 KB Output isn't correct
4 Incorrect 1 ms 364 KB Output isn't correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Incorrect 1 ms 364 KB Output isn't correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Incorrect 1 ms 364 KB Output isn't correct
15 Incorrect 1 ms 364 KB Output isn't correct
16 Incorrect 1 ms 364 KB Output isn't correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 1 ms 384 KB Output is correct
19 Correct 4 ms 364 KB Output is correct
20 Correct 4 ms 376 KB Output is correct
21 Correct 4 ms 364 KB Output is correct
22 Incorrect 5 ms 364 KB Output isn't correct
23 Correct 4 ms 364 KB Output is correct
24 Correct 4 ms 364 KB Output is correct
25 Incorrect 1 ms 368 KB Output isn't correct
26 Incorrect 1 ms 364 KB Output isn't correct
27 Incorrect 1 ms 364 KB Output isn't correct
28 Incorrect 1 ms 364 KB Output isn't correct
29 Incorrect 1 ms 364 KB Output isn't correct
30 Incorrect 1 ms 364 KB Output isn't correct
31 Incorrect 1 ms 364 KB Output isn't correct
32 Incorrect 1 ms 364 KB Output isn't correct
33 Incorrect 1 ms 364 KB Output isn't correct
34 Incorrect 1 ms 364 KB Output isn't correct
35 Incorrect 1 ms 384 KB Output isn't correct
36 Incorrect 1 ms 364 KB Output isn't correct
37 Incorrect 1 ms 364 KB Output isn't correct
38 Incorrect 1 ms 364 KB Output isn't correct
39 Incorrect 1 ms 364 KB Output isn't correct
40 Incorrect 1 ms 364 KB Output isn't correct
41 Incorrect 1 ms 364 KB Output isn't correct
42 Incorrect 1 ms 364 KB Output isn't correct
43 Incorrect 1 ms 364 KB Output isn't correct
44 Incorrect 1 ms 364 KB Output isn't correct
45 Incorrect 1 ms 364 KB Output isn't correct
46 Incorrect 1 ms 364 KB Output isn't correct
47 Incorrect 1 ms 364 KB Output isn't correct
48 Incorrect 1 ms 364 KB Output isn't correct
49 Incorrect 1 ms 364 KB Output isn't correct
50 Incorrect 1 ms 364 KB Output isn't correct