답안 #871133

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
871133 2023-11-10T02:03:12 Z NeroZein 새 집 (APIO18_new_home) C++17
0 / 100
5000 ms 19516 KB
#include "bits/stdc++.h"
#define int long long
using namespace std;

#ifdef Nero
#include "Deb.h"
#else
#define deb(...)
#endif

signed main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, k, q;
  cin >> n >> k >> q;
  vector<bool> on(k); 
  vector<long long> x(n), tp(n), l(n), r(n); 
  for (int i = 0; i < n; ++i) {
    cin >> x[i] >> tp[i] >> l[i] >> r[i]; 
    --tp[i]; 
  }
  while (q--) {
    long long y, t;
    cin >> y >> t;
    long long ans = 0; 
    vector<int> to_turn_off; 
    for (int i = 0; i < n; ++i) {
      if (l[i] <= t && t <= r[i]) {
        ans = max(ans, abs(y - x[i])); 
        if (!on[tp[i]]) {
          on[tp[i]] = true; 
          to_turn_off.push_back(tp[i]); 
        }
      }
    }
    if (to_turn_off.size() != k) {
      cout << -1 << '\n'; 
    } else {
      cout << ans << '\n';      
    }
    for (int i : to_turn_off) {
      on[i] = false; 
    }
  }
  return 0;
}

Compilation message

new_home.cpp: In function 'int main()':
new_home.cpp:36:28: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   36 |     if (to_turn_off.size() != k) {
      |         ~~~~~~~~~~~~~~~~~~~^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Incorrect 0 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Incorrect 0 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 5081 ms 19516 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 5052 ms 17748 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Incorrect 0 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Incorrect 0 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -