Submission #880290

# Submission time Handle Problem Language Result Execution time Memory
880290 2023-11-29T06:10:11 Z Mr_Husanboy Wall (IOI14_wall) C++17
24 / 100
499 ms 40516 KB
#include "wall.h"
#include <bits/stdc++.h>

using namespace std;
const int inf = 1e9;

void buildWall(int n, int k, int op[], int left[], int right[], int height[], int ans[]){
    vector<vector<int>> rig(n + 1), lef(n + 1);
    for(int i = 0; i < k; i ++){
      if(op[i] == 1) rig[right[i]].push_back(height[i]), lef[left[i]].push_back(height[i]);
    }
    multiset<int> st;

    for(int i = 0; i < n; i ++){
      for(auto h : lef[i]){
        st.insert(h);
      }
      ans[i] = (st.empty() ? 0 : *st.rbegin());
      for(auto h : rig[i]) st.erase(st.find(h));//, cout << h << endl;; 
    }


    rig.clear(); lef.clear();
    rig.resize(n); lef.resize(n);
    for(int i = 0; i < k; i ++){
      if(op[i] == 2) rig[right[i]].push_back(height[i]), lef[left[i]].push_back(height[i]);
    }

    for(int i = 0; i < n; i ++){
      for(auto h : lef[i]){
        st.insert(h);
      }
      ans[i] = min(ans[i], (st.empty() ? inf : *st.begin()));
      for(auto h : rig[i]) st.erase(st.find(h)); 
    }
}

# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Incorrect 2 ms 604 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 393 ms 29140 KB Output is correct
3 Correct 148 ms 15460 KB Output is correct
4 Correct 499 ms 40516 KB Output is correct
5 Correct 190 ms 31828 KB Output is correct
6 Correct 175 ms 26512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Incorrect 2 ms 604 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 2 ms 604 KB Output isn't correct
3 Halted 0 ms 0 KB -