Submission #609785

# Submission time Handle Problem Language Result Execution time Memory
609785 2022-07-27T21:54:47 Z sword060 Unscrambling a Messy Bug (IOI16_messy) C++17
0 / 100
1 ms 340 KB
#include "messy.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> restore_permutation(int x, int w, int r){
  vector<int> ans(x);for(int i=0;i<x;i++)ans[i]=x-i-1;
  string p="";
  for(int i=0;i<x;i++)p+='0';
  for(int i=0;i<x/2;i++){
    p[i]='1';p[i+x/2]='1';
    add_element(p);
    p[i]='0';p[i+x/2]='0';
  }
  compile_set();
  for(int i=0;i<x;i++)p[i]='0';
  for(int i=0;i<x/2;i++){
    p[i]='1';p[i+x/2]='1';
    bool f=check_element(p);
    if(f){p[i]='0';p[i+x/2]='0';continue;}
    p[i]='0';
    for(int j=0;j<x;j++){
      if(j==i+x/2)continue;
      p[j]='1';
      bool f2=check_element(p);
      if(!f2){p[j]='0';continue;}
      swap(ans[i],ans[j]);
      return ans;
    }
    p[i]='1';p[i+x/2]='0';
    for(int j=0;j<x;j++){
      if(j==i)continue;
      p[j]='1';
      bool f2=check_element(p);
      if(!f2){p[j]='0';continue;}
      swap(ans[i],ans[j]);
      return ans;
    }
  }
}

Compilation message

messy.cpp: In function 'std::vector<int> restore_permutation(int, int, int)':
messy.cpp:6:12: warning: control reaches end of non-void function [-Wreturn-type]
    6 |   string p="";
      |            ^~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB grader returned WA
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB grader returned WA
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB grader returned WA
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB grader returned WA
2 Halted 0 ms 0 KB -