Submission #1090758

# Submission time Handle Problem Language Result Execution time Memory
1090758 2024-09-18T16:53:55 Z noyancanturk popa (BOI18_popa) C++17
100 / 100
67 ms 676 KB
#include<bits/stdc++.h>
using namespace std;

int query(int a, int b, int c, int d);

int solve(int n, int* l, int* r){
  for(int i=0;i<n;i++)l[i]=r[i]=-1;
  vector<int>chain{0};
  for(int i=1;i<n;i++){
    int last=-1;
    while(chain.size()){
      int res=query(chain.back(),chain.back(),chain.back(),i);
      if(res==1){
        r[chain.back()]=i;
        break;
      }else{
        last=chain.back();
        chain.pop_back();
      }
    }
    l[i]=last;
    chain.push_back(i);
  }
  return chain[0];
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 344 KB Output is correct
2 Correct 6 ms 344 KB Output is correct
3 Correct 5 ms 344 KB Output is correct
4 Correct 6 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 66 ms 428 KB Output is correct
2 Correct 63 ms 428 KB Output is correct
3 Correct 43 ms 596 KB Output is correct
4 Correct 55 ms 676 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 64 ms 672 KB Output is correct
2 Correct 44 ms 676 KB Output is correct
3 Correct 38 ms 676 KB Output is correct
4 Correct 67 ms 668 KB Output is correct