Submission #169945

#TimeUsernameProblemLanguageResultExecution timeMemory
169945nandonathanielVision Program (IOI19_vision)C++14
100 / 100
16 ms1908 KiB
#include "vision.h" #include "bits/stdc++.h" using namespace std; vector<int> prefix(vector<int> v){ vector<int> ret; ret.push_back(v[0]); for(int i=1;i<v.size();i++)ret.push_back(add_xor({ret[i-1],v[i]})); return ret; } vector<int> sum(vector<int> v,int x){ vector<int> simpan; for(int i=0;i<9;i++){ simpan.push_back(add_xor({v[i],x})); x=add_and({v[i],x}); } return simpan; } vector<int> jumlah(vector<int> v,vector<int> u){ vector<int> ret; ret.push_back(add_and({0,add_not(0)})); for(int i=1;i<=8;i++)ret.push_back(ret[0]); for(auto isi : v)ret=sum(ret,isi); for(auto isi : u)ret=sum(ret,isi); return ret; } vector<int> baris(int h,int w){ vector<int> ret; for(int i=0;i<h;i++){ vector<int> v; for(int j=0;j<w;j++)v.push_back(i*w+j); ret.push_back(add_xor(v)); } return ret; } vector<int> kolom(int h,int w){ vector<int> ret; for(int j=0;j<w;j++){ vector<int> v; for(int i=0;i<h;i++)v.push_back(i*w+j); ret.push_back(add_xor(v)); } return ret; } void sama(vector<int> v,int k){ for(int i=0;i<9;i++){ if(!((1<<i) & k))v[i]=add_not(v[i]); } add_and(v); } void construct_network(int H, int W, int K) { sama(jumlah(prefix(baris(H,W)),prefix(kolom(H,W))),K); }

Compilation message (stderr)

vision.cpp: In function 'std::vector<int> prefix(std::vector<int>)':
vision.cpp:8:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=1;i<v.size();i++)ret.push_back(add_xor({ret[i-1],v[i]}));
              ~^~~~~~~~~
#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...