Submission #337283

# Submission time Handle Problem Language Result Execution time Memory
337283 2020-12-19T09:01:20 Z boykut Marriage questions (IZhO14_marriage) C++14
32 / 100
1500 ms 1772 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 0 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 0 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 364 KB Output is correct
19 Correct 5 ms 364 KB Output is correct
20 Correct 4 ms 364 KB Output is correct
21 Correct 4 ms 364 KB Output is correct
22 Incorrect 4 ms 384 KB Output isn't correct
23 Correct 4 ms 364 KB Output is correct
24 Correct 4 ms 364 KB Output is correct
25 Runtime error 1 ms 620 KB Execution killed with signal 11 (could be triggered by violating memory limits)
26 Runtime error 2 ms 620 KB Execution killed with signal 11 (could be triggered by violating memory limits)
27 Runtime error 1 ms 620 KB Execution killed with signal 11 (could be triggered by violating memory limits)
28 Incorrect 1288 ms 416 KB Output isn't correct
29 Runtime error 1 ms 620 KB Execution killed with signal 11 (could be triggered by violating memory limits)
30 Runtime error 1 ms 620 KB Execution killed with signal 11 (could be triggered by violating memory limits)
31 Runtime error 1 ms 748 KB Execution killed with signal 11 (could be triggered by violating memory limits)
32 Execution timed out 1584 ms 492 KB Time limit exceeded
33 Execution timed out 1586 ms 492 KB Time limit exceeded
34 Execution timed out 1589 ms 364 KB Time limit exceeded
35 Runtime error 1 ms 620 KB Execution killed with signal 11 (could be triggered by violating memory limits)
36 Runtime error 1 ms 620 KB Execution killed with signal 11 (could be triggered by violating memory limits)
37 Runtime error 1 ms 492 KB Execution killed with signal 11 (could be triggered by violating memory limits)
38 Runtime error 2 ms 1772 KB Execution killed with signal 11 (could be triggered by violating memory limits)
39 Runtime error 1 ms 492 KB Execution killed with signal 11 (could be triggered by violating memory limits)
40 Runtime error 1 ms 492 KB Execution killed with signal 11 (could be triggered by violating memory limits)
41 Runtime error 1 ms 492 KB Execution killed with signal 11 (could be triggered by violating memory limits)
42 Runtime error 2 ms 748 KB Execution killed with signal 11 (could be triggered by violating memory limits)
43 Runtime error 2 ms 492 KB Execution killed with signal 11 (could be triggered by violating memory limits)
44 Runtime error 1 ms 492 KB Execution killed with signal 11 (could be triggered by violating memory limits)
45 Runtime error 1 ms 492 KB Execution killed with signal 11 (could be triggered by violating memory limits)
46 Runtime error 1 ms 492 KB Execution killed with signal 11 (could be triggered by violating memory limits)
47 Runtime error 1 ms 492 KB Execution killed with signal 11 (could be triggered by violating memory limits)
48 Runtime error 1 ms 492 KB Execution killed with signal 11 (could be triggered by violating memory limits)
49 Runtime error 1 ms 492 KB Execution killed with signal 11 (could be triggered by violating memory limits)
50 Runtime error 1 ms 492 KB Execution killed with signal 11 (could be triggered by violating memory limits)