Submission #602844

#TimeUsernameProblemLanguageResultExecution timeMemory
602844MeGustaElArroz23Vision Program (IOI19_vision)C++14
100 / 100
51 ms2900 KiB
#include "vision.h" #include<bits/stdc++.h> using namespace std; #define vi vector<int> #define vvi vector<vi> #define pb push_back void construct_network(int H, int W, int K) { //W width H height //diagonales |_ //distancia K vi diagonales; for (int i=0;i<H+W-1;i++){ vi acdiagonal(0); for (int h=0;h<H;h++){ if (i-h<W && i-h>=0) acdiagonal.pb((i-h)+W*h); } diagonales.pb(add_or(acdiagonal)); } vi comparaciones; for (int i=0;i+K<diagonales.size();i++) comparaciones.pb(add_and(vi{diagonales[i],diagonales[i+K]})); int distancia_K_1=add_or(comparaciones); //distancia <=K diagonales=vi(0); for (int i=0;i<H+W-1;i++){ vi acdiagonal(0); for (int h=0;h<H;h++){ if (i-h<W && i-h>=0) acdiagonal.pb((i-h)+W*h); } diagonales.pb(add_or(acdiagonal)); } comparaciones=vi(0); for (int i=0;i+K<diagonales.size();i++){ vi porcomparar(0); for (int j=i;j<=i+K;j++) porcomparar.pb(diagonales[j]); comparaciones.pb(add_or(porcomparar)); } int res=comparaciones[0]; for (int i=1;i<comparaciones.size();i++) res=add_xor(vi{res, add_and(vi{add_not(comparaciones[i-1]),comparaciones[i]}) }); int distancia_less_K_1=res; //diagonales _| //distancia K diagonales=vi(0); for (int i=0;i<H+W-1;i++){ vi acdiagonal(0); for (int h=0;h<H;h++){ if (i-h<W && i-h>=0) acdiagonal.pb((W-(i-h)-1)+W*h); } diagonales.pb(add_or(acdiagonal)); } comparaciones=vi(0); for (int i=0;i+K<diagonales.size();i++) comparaciones.pb(add_and(vi{diagonales[i],diagonales[i+K]})); int distancia_K_2=add_or(comparaciones); //distancia <=K diagonales=vi(0); for (int i=0;i<H+W-1;i++){ vi acdiagonal(0); for (int h=0;h<H;h++){ if (i-h<W && i-h>=0) acdiagonal.pb((W-(i-h)-1)+W*h); } diagonales.pb(add_or(acdiagonal)); } comparaciones=vi(0); for (int i=0;i+K<diagonales.size();i++){ vi porcomparar(0); for (int j=i;j<=i+K;j++) porcomparar.pb(diagonales[j]); comparaciones.pb(add_or(porcomparar)); } res=comparaciones[0]; for (int i=1;i<comparaciones.size();i++) res=add_xor(vi{res, add_and(vi{add_not(comparaciones[i-1]),comparaciones[i]}) }); int distancia_less_K_2=res; //FINAL add_or(vi{ add_and(vi{distancia_K_1,distancia_less_K_2}), add_and(vi{distancia_K_2,distancia_less_K_1}) }); }

Compilation message (stderr)

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:28:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |  for (int i=0;i+K<diagonales.size();i++)
      |               ~~~^~~~~~~~~~~~~~~~~~
vision.cpp:45:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   45 |  for (int i=0;i+K<diagonales.size();i++){
      |               ~~~^~~~~~~~~~~~~~~~~~
vision.cpp:52:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   52 |  for (int i=1;i<comparaciones.size();i++)
      |               ~^~~~~~~~~~~~~~~~~~~~~
vision.cpp:73:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   73 |  for (int i=0;i+K<diagonales.size();i++)
      |               ~~~^~~~~~~~~~~~~~~~~~
vision.cpp:90:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   90 |  for (int i=0;i+K<diagonales.size();i++){
      |               ~~~^~~~~~~~~~~~~~~~~~
vision.cpp:97:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   97 |  for (int i=1;i<comparaciones.size();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...