Submission #1244993

#TimeUsernameProblemLanguageResultExecution timeMemory
1244993GabrielUnscrambling a Messy Bug (IOI16_messy)C++20
0 / 100
1 ms328 KiB
#include <bits/stdc++.h> #include "messy.h" using namespace std; vector<int> restore_permutation(int n, int w, int r){ string Primero = "01010101", Segundo = "00110011", Tercero = "00001111"; vector<int> Retorno(8); if(n == 8){ add_element(Primero); add_element(Segundo); add_element(Tercero); compile_set(); if(check_element(Primero)){ if(check_element(Segundo)){ if(check_element(Tercero)){ for(int i = 0; i < 8; i++) Retorno[i] = i; return Retorno; } else { for(int i = 0; i < 8; i++){ for(int j = i + 1; j < 8; j++){ if(Tercero[i] == Tercero[j]) continue; swap(Tercero[i], Tercero[j]); if(check_element(Tercero)){ for(int k = 0; k < 8; k++){ Retorno[k] = k; if(k == i) Retorno[k] = j; if(k == j) Retorno[k] = i; } return Retorno; } swap(Tercero[i], Tercero[j]); } } } } else { for(int i = 0; i < 8; i++){ for(int j = i + 1; j < 8; j++){ if(Segundo[i] == Segundo[j]) continue; swap(Segundo[i], Segundo[j]); if(check_element(Segundo)){ for(int k = 0; k < 8; k++){ Retorno[k] = k; if(k == i) Retorno[k] = j; if(k == j) Retorno[k] = i; } return Retorno; } swap(Segundo[i], Segundo[j]); } } } } else { for(int i = 0; i < 8; i++){ for(int j = i + 1; j < 8; j++){ if(Primero[i] == Primero[j]) continue; swap(Primero[i], Primero[j]); if(check_element(Primero)){ for(int k = 0; k < 8; k++){ Retorno[k] = k; if(k == i) Retorno[k] = j; if(k == j) Retorno[k] = i; } return Retorno; } swap(Primero[i], Primero[j]); } } } } }

Compilation message (stderr)

messy.cpp: In function 'std::vector<int> restore_permutation(int, int, int)':
messy.cpp:69:1: warning: control reaches end of non-void function [-Wreturn-type]
   69 | }
      | ^
messy.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
messy_c.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
#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...