Submission #241710

# Submission time Handle Problem Language Result Execution time Memory
241710 2020-06-25T10:07:14 Z abacaba Vision Program (IOI19_vision) C++14
100 / 100
68 ms 6260 KB
#include <iostream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include "vision.h"
#include <chrono>
#include <vector>
#include <map>
#include <random>
#include <set>
#include <algorithm>
#include <math.h>
#include <cstdio>
#include <stdio.h>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <deque>
#include <cassert>
#include <stack>
using namespace std;
 
#define mp make_pair
#define f first
#define se second
#define pb push_back
#define ppb pop_back
#define emb emplace_back
#define ll long long
#define ull unsigned long long
#define cntbit(x) __builtin_popcount(x)
#define endl '\n'
#define uset unordered_set
#define umap unordered_map
#define pii pair<int, int>
#define ld long double
#define pll pair<long long, long long>
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
template <typename T> inline T range(T l, T r) {
    return uniform_int_distribution<T>(l, r)(rng);
}
 
inline void setin(string s) {
    freopen(s.c_str(), "r", stdin);
}
 
inline void setout(string s) {
    freopen(s.c_str(), "w", stdout);
}
 
template <typename T> void Min(T &a, T b) {
    a = min(a, b);
}
 
template <typename T> void Max(T &a, T b) {
    a = max(a, b);
}
 
const int inf = 2e9;
const int mod = 998244353;
const int N = 3e5 + 15;
 
int n, m, k;
 
inline int ind(int i, int j, int W) {
    return i * W + j;
}
 
inline bool lie(int l, int x, int r) {
    return l <= x && x <= r;
}
 
int check(vector <int> a, int k) {
    vector <int> tmp = {};
    for(int i = 0; i + k - 1 < a.size(); ++i) {
        vector <int> now = {};
        for(int j = i; j < i + k; ++j)
            now.pb(a[j]);
        tmp.pb(add_xor({add_or(now), add_xor(now)}));
    }
    return add_or({add_xor(a), add_or(tmp)});
}
 
int consider(vector <int> a, vector <int> b, int k) {
  	assert(k + 1 <= a.size());
    int res = add_xor({check(a, k + 1), check(a, k)});
    return add_and({res, check(b, k + 1)});
}
 
void construct_network(int H, int W, int K) {
    vector <int> a, b;
    n = H, m = W, k = K;
    for(int d = 0; d <= n + m - 2; ++d) {
        vector <int> now = {};
        for(int i = 0; i < n; ++i) {
            int j = d - i;
            if(lie(0, j, m - 1))
                now.pb(ind(i, j, m));
        }
        a.pb(add_or(now));
    }
    for(int d = -m + 1; d <= n - 1; ++d) {
        vector <int> now = {};
        for(int i = 0; i < n; ++i) {
            int j = i - d;
            if(lie(0, j, m - 1))
                now.pb(ind(i, j, m));
        }
        b.pb(add_or(now));
    }
    add_or({consider(a, b, k), consider(b, a, k)});
}

Compilation message

vision.cpp: In function 'int check(std::vector<int>, int)':
vision.cpp:78:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = 0; i + k - 1 < a.size(); ++i) {
                    ~~~~~~~~~~^~~~~~~~~~
In file included from /usr/include/c++/7/cassert:44:0,
                 from vision.cpp:20:
vision.cpp: In function 'int consider(std::vector<int>, std::vector<int>, int)':
vision.cpp:88:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    assert(k + 1 <= a.size());
           ~~~~~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Correct 4 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 5 ms 384 KB Output is correct
12 Correct 5 ms 384 KB Output is correct
13 Correct 5 ms 384 KB Output is correct
14 Correct 5 ms 384 KB Output is correct
15 Correct 5 ms 384 KB Output is correct
16 Correct 5 ms 256 KB Output is correct
17 Correct 5 ms 256 KB Output is correct
18 Correct 5 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Correct 4 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 5 ms 384 KB Output is correct
12 Correct 5 ms 384 KB Output is correct
13 Correct 5 ms 384 KB Output is correct
14 Correct 5 ms 384 KB Output is correct
15 Correct 5 ms 384 KB Output is correct
16 Correct 5 ms 256 KB Output is correct
17 Correct 5 ms 256 KB Output is correct
18 Correct 5 ms 384 KB Output is correct
19 Correct 5 ms 384 KB Output is correct
20 Correct 5 ms 384 KB Output is correct
21 Correct 5 ms 384 KB Output is correct
22 Correct 5 ms 384 KB Output is correct
23 Correct 5 ms 384 KB Output is correct
24 Correct 5 ms 384 KB Output is correct
25 Correct 5 ms 384 KB Output is correct
26 Correct 5 ms 384 KB Output is correct
27 Correct 5 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Correct 4 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 5 ms 384 KB Output is correct
12 Correct 5 ms 384 KB Output is correct
13 Correct 5 ms 384 KB Output is correct
14 Correct 5 ms 384 KB Output is correct
15 Correct 5 ms 384 KB Output is correct
16 Correct 5 ms 256 KB Output is correct
17 Correct 5 ms 256 KB Output is correct
18 Correct 5 ms 384 KB Output is correct
19 Correct 5 ms 384 KB Output is correct
20 Correct 5 ms 384 KB Output is correct
21 Correct 5 ms 384 KB Output is correct
22 Correct 5 ms 384 KB Output is correct
23 Correct 5 ms 384 KB Output is correct
24 Correct 5 ms 384 KB Output is correct
25 Correct 5 ms 384 KB Output is correct
26 Correct 5 ms 384 KB Output is correct
27 Correct 5 ms 384 KB Output is correct
28 Correct 6 ms 512 KB Output is correct
29 Correct 6 ms 384 KB Output is correct
30 Correct 5 ms 384 KB Output is correct
31 Correct 5 ms 384 KB Output is correct
32 Correct 6 ms 384 KB Output is correct
33 Correct 6 ms 512 KB Output is correct
34 Correct 6 ms 512 KB Output is correct
35 Correct 6 ms 512 KB Output is correct
36 Correct 6 ms 512 KB Output is correct
37 Correct 5 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Correct 4 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 5 ms 384 KB Output is correct
12 Correct 5 ms 384 KB Output is correct
13 Correct 5 ms 384 KB Output is correct
14 Correct 5 ms 384 KB Output is correct
15 Correct 5 ms 384 KB Output is correct
16 Correct 5 ms 256 KB Output is correct
17 Correct 5 ms 256 KB Output is correct
18 Correct 5 ms 384 KB Output is correct
19 Correct 5 ms 384 KB Output is correct
20 Correct 5 ms 384 KB Output is correct
21 Correct 5 ms 384 KB Output is correct
22 Correct 5 ms 384 KB Output is correct
23 Correct 5 ms 384 KB Output is correct
24 Correct 5 ms 384 KB Output is correct
25 Correct 5 ms 384 KB Output is correct
26 Correct 5 ms 384 KB Output is correct
27 Correct 5 ms 384 KB Output is correct
28 Correct 6 ms 512 KB Output is correct
29 Correct 6 ms 384 KB Output is correct
30 Correct 5 ms 384 KB Output is correct
31 Correct 5 ms 384 KB Output is correct
32 Correct 6 ms 384 KB Output is correct
33 Correct 6 ms 512 KB Output is correct
34 Correct 6 ms 512 KB Output is correct
35 Correct 6 ms 512 KB Output is correct
36 Correct 6 ms 512 KB Output is correct
37 Correct 5 ms 384 KB Output is correct
38 Correct 19 ms 1664 KB Output is correct
39 Correct 8 ms 640 KB Output is correct
40 Correct 8 ms 512 KB Output is correct
41 Correct 9 ms 640 KB Output is correct
42 Correct 7 ms 512 KB Output is correct
43 Correct 9 ms 768 KB Output is correct
44 Correct 21 ms 1664 KB Output is correct
45 Correct 20 ms 1952 KB Output is correct
46 Correct 18 ms 1536 KB Output is correct
47 Correct 8 ms 512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 640 KB Output is correct
2 Correct 17 ms 1408 KB Output is correct
3 Correct 17 ms 1408 KB Output is correct
4 Correct 6 ms 384 KB Output is correct
5 Correct 8 ms 640 KB Output is correct
6 Correct 16 ms 1408 KB Output is correct
7 Correct 16 ms 1280 KB Output is correct
8 Correct 6 ms 384 KB Output is correct
9 Correct 7 ms 640 KB Output is correct
10 Correct 16 ms 1280 KB Output is correct
11 Correct 19 ms 1536 KB Output is correct
12 Correct 17 ms 1536 KB Output is correct
13 Correct 14 ms 1152 KB Output is correct
14 Correct 5 ms 384 KB Output is correct
15 Correct 7 ms 640 KB Output is correct
16 Correct 16 ms 1280 KB Output is correct
17 Correct 18 ms 1536 KB Output is correct
18 Correct 17 ms 1536 KB Output is correct
19 Correct 14 ms 1152 KB Output is correct
20 Correct 5 ms 384 KB Output is correct
21 Correct 5 ms 256 KB Output is correct
22 Correct 5 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 7 ms 640 KB Output is correct
4 Correct 11 ms 896 KB Output is correct
5 Correct 11 ms 896 KB Output is correct
6 Correct 10 ms 768 KB Output is correct
7 Correct 6 ms 384 KB Output is correct
8 Correct 8 ms 768 KB Output is correct
9 Correct 15 ms 1280 KB Output is correct
10 Correct 18 ms 1408 KB Output is correct
11 Correct 14 ms 1152 KB Output is correct
12 Correct 7 ms 640 KB Output is correct
13 Correct 7 ms 640 KB Output is correct
14 Correct 16 ms 1408 KB Output is correct
15 Correct 15 ms 1280 KB Output is correct
16 Correct 5 ms 384 KB Output is correct
17 Correct 8 ms 640 KB Output is correct
18 Correct 18 ms 1408 KB Output is correct
19 Correct 6 ms 384 KB Output is correct
20 Correct 13 ms 1148 KB Output is correct
21 Correct 36 ms 3444 KB Output is correct
22 Correct 35 ms 3320 KB Output is correct
23 Correct 10 ms 768 KB Output is correct
24 Correct 14 ms 1148 KB Output is correct
25 Correct 38 ms 3704 KB Output is correct
26 Correct 10 ms 768 KB Output is correct
27 Correct 18 ms 1788 KB Output is correct
28 Correct 55 ms 5108 KB Output is correct
29 Correct 64 ms 6220 KB Output is correct
30 Correct 51 ms 4860 KB Output is correct
31 Correct 15 ms 1280 KB Output is correct
32 Correct 5 ms 384 KB Output is correct
33 Correct 5 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 18 ms 1788 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 7 ms 640 KB Output is correct
4 Correct 8 ms 768 KB Output is correct
5 Correct 7 ms 640 KB Output is correct
6 Correct 7 ms 640 KB Output is correct
7 Correct 12 ms 1276 KB Output is correct
8 Correct 13 ms 1148 KB Output is correct
9 Correct 18 ms 1788 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 5 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Correct 4 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 5 ms 384 KB Output is correct
12 Correct 5 ms 384 KB Output is correct
13 Correct 5 ms 384 KB Output is correct
14 Correct 5 ms 384 KB Output is correct
15 Correct 5 ms 384 KB Output is correct
16 Correct 5 ms 256 KB Output is correct
17 Correct 5 ms 256 KB Output is correct
18 Correct 5 ms 384 KB Output is correct
19 Correct 5 ms 384 KB Output is correct
20 Correct 5 ms 384 KB Output is correct
21 Correct 5 ms 384 KB Output is correct
22 Correct 5 ms 384 KB Output is correct
23 Correct 5 ms 384 KB Output is correct
24 Correct 5 ms 384 KB Output is correct
25 Correct 5 ms 384 KB Output is correct
26 Correct 5 ms 384 KB Output is correct
27 Correct 5 ms 384 KB Output is correct
28 Correct 6 ms 512 KB Output is correct
29 Correct 6 ms 384 KB Output is correct
30 Correct 5 ms 384 KB Output is correct
31 Correct 5 ms 384 KB Output is correct
32 Correct 6 ms 384 KB Output is correct
33 Correct 6 ms 512 KB Output is correct
34 Correct 6 ms 512 KB Output is correct
35 Correct 6 ms 512 KB Output is correct
36 Correct 6 ms 512 KB Output is correct
37 Correct 5 ms 384 KB Output is correct
38 Correct 19 ms 1664 KB Output is correct
39 Correct 8 ms 640 KB Output is correct
40 Correct 8 ms 512 KB Output is correct
41 Correct 9 ms 640 KB Output is correct
42 Correct 7 ms 512 KB Output is correct
43 Correct 9 ms 768 KB Output is correct
44 Correct 21 ms 1664 KB Output is correct
45 Correct 20 ms 1952 KB Output is correct
46 Correct 18 ms 1536 KB Output is correct
47 Correct 8 ms 512 KB Output is correct
48 Correct 7 ms 640 KB Output is correct
49 Correct 17 ms 1408 KB Output is correct
50 Correct 17 ms 1408 KB Output is correct
51 Correct 6 ms 384 KB Output is correct
52 Correct 8 ms 640 KB Output is correct
53 Correct 16 ms 1408 KB Output is correct
54 Correct 16 ms 1280 KB Output is correct
55 Correct 6 ms 384 KB Output is correct
56 Correct 7 ms 640 KB Output is correct
57 Correct 16 ms 1280 KB Output is correct
58 Correct 19 ms 1536 KB Output is correct
59 Correct 17 ms 1536 KB Output is correct
60 Correct 14 ms 1152 KB Output is correct
61 Correct 5 ms 384 KB Output is correct
62 Correct 7 ms 640 KB Output is correct
63 Correct 16 ms 1280 KB Output is correct
64 Correct 18 ms 1536 KB Output is correct
65 Correct 17 ms 1536 KB Output is correct
66 Correct 14 ms 1152 KB Output is correct
67 Correct 5 ms 384 KB Output is correct
68 Correct 5 ms 256 KB Output is correct
69 Correct 5 ms 384 KB Output is correct
70 Correct 5 ms 256 KB Output is correct
71 Correct 5 ms 256 KB Output is correct
72 Correct 7 ms 640 KB Output is correct
73 Correct 11 ms 896 KB Output is correct
74 Correct 11 ms 896 KB Output is correct
75 Correct 10 ms 768 KB Output is correct
76 Correct 6 ms 384 KB Output is correct
77 Correct 8 ms 768 KB Output is correct
78 Correct 15 ms 1280 KB Output is correct
79 Correct 18 ms 1408 KB Output is correct
80 Correct 14 ms 1152 KB Output is correct
81 Correct 7 ms 640 KB Output is correct
82 Correct 7 ms 640 KB Output is correct
83 Correct 16 ms 1408 KB Output is correct
84 Correct 15 ms 1280 KB Output is correct
85 Correct 5 ms 384 KB Output is correct
86 Correct 8 ms 640 KB Output is correct
87 Correct 18 ms 1408 KB Output is correct
88 Correct 6 ms 384 KB Output is correct
89 Correct 13 ms 1148 KB Output is correct
90 Correct 36 ms 3444 KB Output is correct
91 Correct 35 ms 3320 KB Output is correct
92 Correct 10 ms 768 KB Output is correct
93 Correct 14 ms 1148 KB Output is correct
94 Correct 38 ms 3704 KB Output is correct
95 Correct 10 ms 768 KB Output is correct
96 Correct 18 ms 1788 KB Output is correct
97 Correct 55 ms 5108 KB Output is correct
98 Correct 64 ms 6220 KB Output is correct
99 Correct 51 ms 4860 KB Output is correct
100 Correct 15 ms 1280 KB Output is correct
101 Correct 5 ms 384 KB Output is correct
102 Correct 5 ms 384 KB Output is correct
103 Correct 18 ms 1788 KB Output is correct
104 Correct 5 ms 384 KB Output is correct
105 Correct 7 ms 640 KB Output is correct
106 Correct 8 ms 768 KB Output is correct
107 Correct 7 ms 640 KB Output is correct
108 Correct 7 ms 640 KB Output is correct
109 Correct 12 ms 1276 KB Output is correct
110 Correct 13 ms 1148 KB Output is correct
111 Correct 18 ms 1788 KB Output is correct
112 Correct 5 ms 384 KB Output is correct
113 Correct 5 ms 256 KB Output is correct
114 Correct 60 ms 5112 KB Output is correct
115 Correct 6 ms 384 KB Output is correct
116 Correct 8 ms 640 KB Output is correct
117 Correct 26 ms 2304 KB Output is correct
118 Correct 28 ms 2552 KB Output is correct
119 Correct 66 ms 6136 KB Output is correct
120 Correct 64 ms 6132 KB Output is correct
121 Correct 64 ms 6132 KB Output is correct
122 Correct 68 ms 6132 KB Output is correct
123 Correct 18 ms 1788 KB Output is correct
124 Correct 54 ms 5104 KB Output is correct
125 Correct 65 ms 6260 KB Output is correct
126 Correct 65 ms 6132 KB Output is correct
127 Correct 51 ms 4856 KB Output is correct
128 Correct 14 ms 1280 KB Output is correct