답안 #374757

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
374757 2021-03-08T05:53:03 Z Mamnoon_Siam 청소 (JOI20_sweeping) C++17
1 / 100
18000 ms 15800 KB
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;
#define all(v) begin(v), end(v)
#define sz(v) (int)(v).size()
#define fi first
#define se second

const int N = 5e3 + 5;

int n, m, q;
vector<ii> v;

int main(int argc, char const *argv[])
{
#ifdef LOCAL
  freopen("in", "r", stdin);
#endif
  scanf("%d %d %d", &n, &m, &q);
  for(int i = 0; i < m; ++i) {
    int x, y;
    scanf("%d %d", &x, &y);
    v.emplace_back(x, y);
  }
  while(q--) {
    int t; scanf("%d", &t);
    if(t == 1) {
      int i; scanf("%d", &i);
      printf("%d %d\n", v[i-1].fi, v[i-1].se);
    } else if(t == 2) { // horizontal
      int l; scanf("%d", &l);
      for(auto &[x, y] : v) {
        if(y <= l) {
          x = max(x, n-l);
        }
      }
    } else if(t == 3) { // vertical
      int l; scanf("%d", &l);
      for(auto &[x, y] : v) {
        if(x <= l) {
          y = max(y, n-l);
        }
      }
    } else {
      int x, y; scanf("%d %d", &x, &y);
      v.emplace_back(x, y);
    }
  }
  return 0;
}
/*
* use std::array instead of std::vector, if u can
* overflow?
* array bounds
*/

Compilation message

sweeping.cpp: In function 'int main(int, const char**)':
sweeping.cpp:22:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   22 |   scanf("%d %d %d", &n, &m, &q);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
sweeping.cpp:25:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   25 |     scanf("%d %d", &x, &y);
      |     ~~~~~^~~~~~~~~~~~~~~~~
sweeping.cpp:29:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   29 |     int t; scanf("%d", &t);
      |            ~~~~~^~~~~~~~~~
sweeping.cpp:31:19: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   31 |       int i; scanf("%d", &i);
      |              ~~~~~^~~~~~~~~~
sweeping.cpp:34:19: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   34 |       int l; scanf("%d", &l);
      |              ~~~~~^~~~~~~~~~
sweeping.cpp:41:19: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   41 |       int l; scanf("%d", &l);
      |              ~~~~~^~~~~~~~~~
sweeping.cpp:48:22: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   48 |       int x, y; scanf("%d %d", &x, &y);
      |                 ~~~~~^~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 492 KB Output is correct
2 Correct 5 ms 492 KB Output is correct
3 Correct 3 ms 492 KB Output is correct
4 Correct 11 ms 492 KB Output is correct
5 Correct 26 ms 364 KB Output is correct
6 Correct 7 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 18079 ms 15228 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 18069 ms 15800 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 18069 ms 15800 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 492 KB Output is correct
2 Correct 5 ms 492 KB Output is correct
3 Correct 3 ms 492 KB Output is correct
4 Correct 11 ms 492 KB Output is correct
5 Correct 26 ms 364 KB Output is correct
6 Correct 7 ms 364 KB Output is correct
7 Execution timed out 18079 ms 15228 KB Time limit exceeded
8 Halted 0 ms 0 KB -