Submission #241703

#TimeUsernameProblemLanguageResultExecution timeMemory
241703abacabaVision Program (IOI19_vision)C++14
26 / 100
25 ms1788 KiB
#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(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 (stderr)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...