Submission #909916

#TimeUsernameProblemLanguageResultExecution timeMemory
909916biankVision Program (IOI19_vision)C++14
0 / 100
16 ms3028 KiB
#include "vision.h" #include <bits/stdc++.h> using namespace std; #define SIZE(x) (int)x.size() #define forsn(i,s,n) for(int i=int(s);i<int(n);i++) #define forn(i,n) for(int i=0;i<int(n);i++) #define pb push_back typedef vector<int> vi; pair<vi,vi> process(vector<vi> diag) { int SZ=SIZE(diag); vi one(SZ), two(SZ); forn(i,SZ) { assert(!diag.empty()); one[i] = add_or(diag[i]); two[i] = add_and({one[i], add_not(add_xor(diag[i]))}); } return {one,two}; } int join(vi one, vi two, int K) { if(K==0) return add_and({0, add_not(0)}); vi instructions=two; int SZ=SIZE(one); forn(i,SZ-1) { vi group; forsn(j,i,min(SZ,i+K+1)) group.pb(one[i]); instructions.pb(add_and({add_or(group), add_not(add_xor(group))})); } return add_or(instructions); } void construct_network(int H, int W, int K) { int SZ=H+W-1; vector<vi> diagA(SZ), diagB(SZ); forn(i,H) forn(j,W) { diagA[i+j].pb(i*W+j); diagB[i-j+W-1].pb(i*W+j); } auto [oneA, twoA] = process(diagA); auto [oneB, twoB] = process(diagB); int aux1 = add_and({join(oneA, twoA, K), join(oneB, twoB, K)}); int aux2 = add_and({join(oneA, twoA, K-1), join(oneB, twoB, K-1)}); add_and({aux1, add_not(aux2)}); }

Compilation message (stderr)

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:41:10: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   41 |     auto [oneA, twoA] = process(diagA);
      |          ^
vision.cpp:42:10: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   42 |     auto [oneB, twoB] = process(diagB);
      |          ^
#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...