Submission #1041764

#TimeUsernameProblemLanguageResultExecution timeMemory
1041764Dan4LifeVision Program (IOI19_vision)C++17
58 / 100
171 ms37580 KiB
#include "vision.h" #include <bits/stdc++.h> using namespace std; #define pb push_back void construct_network(int H, int W, int K) { if(K==1) { vector<int> ROW, COL; ROW.clear(), COL.clear(); for(int i = 0; i < H; i++) { vector<int> rows; rows.clear(); for(int j = 0; j < W; j++) rows.pb(i*W+j); ROW.pb(add_xor(rows)); } for(int i = 0; i < W; i++) { vector<int> cols; cols.clear(); for(int j = 0; j < H; j++) cols.pb(j*W+i); COL.pb(add_xor(cols)); } int x = add_or(ROW), y = add_or(COL); vector<int> t; t.clear(), t.pb(x), t.pb(add_not(y)); int option1f = add_and(t); t.clear(), t.pb(y), t.pb(add_not(x)); int option2f = add_and(t); vector<int> row_pair, col_pair; row_pair.clear(), col_pair.clear(); for(int i = H*W; i < H*W+H-1; i++) { t.clear(); t.pb(i), t.pb(i+1); row_pair.pb(add_and(t)); } for(int i = H*W+H; i < H*W+H+W-1; i++) { t.clear(); t.pb(i), t.pb(i+1); col_pair.pb(add_and(t)); } int option1s=-1, option2s=-1; if(!row_pair.empty()) option1s = add_or(row_pair); if(!col_pair.empty()) option2s = add_or(col_pair); t.clear(), t.pb(option1f); if(option1s!=-1) t.pb(option1s); int option1 = add_and(t); t.clear(), t.pb(option2f); if(option2s!=-1) t.pb(option2s); int option2 = add_and(t); t.clear(), t.pb(option1), t.pb(option2); add_or(t); } else{ set<pair<int,int> > S; S.clear(); vector<int> v; v.clear(); for(int i = 0; i < H; i++) { for(int j = 0; j < W; j++) { vector<int> w; w.clear(); for(int k = i; k < H; k++) { for(int l = 0; l < W; l++) { if(abs(i-k)+abs(j-l)!=K or S.count({i*W+j, k*W+l})) continue; S.insert({i*W+j, k*W+l}), S.insert({k*W+l, i*W+j}); w.push_back(k*W+l); } } if(w.empty())continue; int x = add_or(w); vector<int> t; t.clear(); t.push_back(x), t.push_back(i*W+j); v.push_back(add_and(t)); } } add_or(v); } }
#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...