Submission #374757

#TimeUsernameProblemLanguageResultExecution timeMemory
374757Mamnoon_SiamSweeping (JOI20_sweeping)C++17
1 / 100
18079 ms15800 KiB
#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 (stderr)

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);
      |                 ~~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...