제출 #1303841

#제출 시각아이디문제언어결과실행 시간메모리
1303841ByeWorldVision Program (IOI19_vision)C++20
0 / 100
4 ms1092 KiB
#include "vision.h" #include <bits/stdc++.h> #pragma GCC optimize("O3", "Ofast") #define ll long long #define se second #define fi first #define pb push_back #define lf (id<<1) #define rg ((id<<1)|1) #define md ((l+r)>>1) using namespace std; typedef pair<int,int> pii; typedef pair<pii,pii> ipii; const int MAXN = 5e5+100; const int MAXA = 2e5+10; const int SQRT = 450; const ll INF = 2e9; const int MOD = 998244353; const int LOG = 60; ll sum(auto a, auto b){ ll te = a+MOD+b; for(; te >= MOD; ) te -= MOD; return te; } void chsum(int &a, auto b){ a = sum(a,b); } ll mul(auto a, auto b){ return 1ll*a*b%MOD; } void chmul(auto &a, auto b){ a = mul(a,b); } void chmn(auto &a, auto b){ a = min(a, b); } void chmx(auto &a, auto b){ a = max(a, b); } int h, w, k; int row, col, r[MAXN],c[MAXN]; void construct_network(int H, int W, int K) { h = H; w = W; k = K; // bikin per row, jarak row row = h*w; for(int i=0; i<h; i++){ vector<int> vec; for(int j=0; j<w; j++) vec.pb(i*w+j); add_or(vec); } for(int jar=1; jar<=min(h-1, k); jar++){ vector<int> mas; for(int j=0; j+jar<h; j++){ vector<int> vec = {row+j, row+j+jar}; // gabungan row mas.pb(add_and(vec)); } r[jar] = add_or(mas); // hasil jaraknya di sini } { vector<int> rows; for(int jar=1; jar<=k; jar++) rows.pb(r[jar]); int las = add_and(rows); r[0] = add_not(las); } // per col, jarak colnya col = -1; for(int i=0; i<w; i++){ vector<int> vec; for(int j=0; j<h; j++) vec.pb(j*w+i); int las = add_or(vec); if(col == -1) col = las; } for(int jar=1; jar<=min(w-1, k); jar++){ vector<int> mas; for(int j=0; j+jar<w; j++){ vector<int> vec = {col+j, col+j+jar}; // ambil gabungan col mas.pb(add_and(vec)); } c[jar] = add_or(mas); // hasil jaraknya di sini } { vector<int> cols; for(int jar=1; jar<=k; jar++) cols.pb(c[jar]); int las = add_and(cols); c[0] = add_not(las); } // add jadi k ga vector<int> idx; for(int i=0; i<=k; i++){ vector<int> vec = {r[i], c[k-i]}; idx.pb(add_and(vec)); } add_or(idx); }
#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...