답안 #795900

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
795900 2023-07-27T21:08:18 Z prefixorsuuffiixx Examination (JOI19_examination) C++14
100 / 100
1408 ms 6488 KB
 #include <bits/stdc++.h>
    #pragma GCC target ("avx2")
    #pragma GCC optimize("O3")
    #pragma GCC optimize("Ofast,unroll-loops")


    using namespace std;
    static struct FastInput {
  static constexpr int BUF_SIZE = 1 << 20;
  char buf[BUF_SIZE];
  size_t chars_read = 0;
  size_t buf_pos = 0;
  FILE *in = stdin;
  char cur = 0;

  inline char get_char() {
    if (buf_pos >= chars_read) {
      chars_read = fread(buf, 1, BUF_SIZE, in);
      buf_pos = 0;
      buf[0] = (chars_read == 0 ? -1 : buf[0]);
    }
    return cur = buf[buf_pos++];
  }

  inline void tie(int) {}

  inline explicit operator bool() {
    return cur != -1;
  }

  inline static bool is_blank(char c) {
    return c <= ' ';
  }

  inline bool skip_blanks() {
    while (is_blank(cur) && cur != -1) {
      get_char();
    }
    return cur != -1;
  }

  inline FastInput& operator>>(char& c) {
    skip_blanks();
    c = cur;
    return *this;
  }

  inline FastInput& operator>>(string& s) {
    if (skip_blanks()) {
      s.clear();
      do {
        s += cur;
      } while (!is_blank(get_char()));
    }
    return *this;
  }

  template <typename T>
  inline FastInput& read_integer(T& n) {
    // unsafe, doesn't check that characters are actually digits
    n = 0;
    if (skip_blanks()) {
      int sign = +1;
      if (cur == '-') {
        sign = -1;
        get_char();
      }
      do {
        n += n + (n << 3) + cur - '0';
      } while (!is_blank(get_char()));
      n *= sign;
    }
    return *this;
  }

  template <typename T>
  inline typename enable_if<is_integral<T>::value, FastInput&>::type operator>>(T& n) {
    return read_integer(n);
  }

  #if !defined(_WIN32) || defined(_WIN64)
  inline FastInput& operator>>(__int128& n) {
    return read_integer(n);
  }
  #endif

  template <typename T>
  inline typename enable_if<is_floating_point<T>::value, FastInput&>::type operator>>(T& n) {
    // not sure if really fast, for compatibility only
    n = 0;
    if (skip_blanks()) {
      string s;
      (*this) >> s;
      sscanf(s.c_str(), "%lf", &n);
    }
    return *this;
  }
} fast_input;

#define cin fast_input

    int ans;
    int x,y,z;
    int n,m;

    int main() {
        ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
        int a[100001],b[100001];
        scanf("%d %d" , &n , &m);
        for (int i = 0;i<n;i++)scanf("%d %d" , &a[i] , &b[i]);
        for(int i = 0 ; i < m ; i++){
            ans = 0;
            scanf("%d %d %d" , &x , &y , &z);
            for (int i = 0; i < n; i++)ans += (a[i] >= x & b[i] >= y & a[i]+b[i]>=z);
            printf("%d\n" , ans);
        }
    }

Compilation message

examination.cpp: In function 'int main()':
examination.cpp:114:53: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
  114 |             for (int i = 0; i < n; i++)ans += (a[i] >= x & b[i] >= y & a[i]+b[i]>=z);
      |                                                ~~~~~^~~~
examination.cpp:114:81: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
  114 |             for (int i = 0; i < n; i++)ans += (a[i] >= x & b[i] >= y & a[i]+b[i]>=z);
      |                                                                        ~~~~~~~~~^~~
examination.cpp:109:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
  109 |         scanf("%d %d" , &n , &m);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~
examination.cpp:110:37: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
  110 |         for (int i = 0;i<n;i++)scanf("%d %d" , &a[i] , &b[i]);
      |                                ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
examination.cpp:113:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
  113 |             scanf("%d %d %d" , &x , &y , &z);
      |             ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1108 KB Output is correct
2 Correct 1 ms 980 KB Output is correct
3 Correct 1 ms 1108 KB Output is correct
4 Correct 1 ms 1108 KB Output is correct
5 Correct 1 ms 980 KB Output is correct
6 Correct 1 ms 1108 KB Output is correct
7 Correct 4 ms 1236 KB Output is correct
8 Correct 4 ms 1236 KB Output is correct
9 Correct 3 ms 1236 KB Output is correct
10 Correct 3 ms 1196 KB Output is correct
11 Correct 3 ms 1108 KB Output is correct
12 Correct 3 ms 1108 KB Output is correct
13 Correct 4 ms 1224 KB Output is correct
14 Correct 3 ms 1236 KB Output is correct
15 Correct 3 ms 1120 KB Output is correct
16 Correct 3 ms 1108 KB Output is correct
17 Correct 4 ms 1120 KB Output is correct
18 Correct 3 ms 1116 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1312 ms 4020 KB Output is correct
2 Correct 1316 ms 4212 KB Output is correct
3 Correct 1342 ms 4092 KB Output is correct
4 Correct 1332 ms 3388 KB Output is correct
5 Correct 1347 ms 3484 KB Output is correct
6 Correct 1348 ms 2656 KB Output is correct
7 Correct 1345 ms 4004 KB Output is correct
8 Correct 1313 ms 3976 KB Output is correct
9 Correct 1283 ms 3924 KB Output is correct
10 Correct 1295 ms 3272 KB Output is correct
11 Correct 1266 ms 3208 KB Output is correct
12 Correct 1255 ms 2336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1312 ms 4020 KB Output is correct
2 Correct 1316 ms 4212 KB Output is correct
3 Correct 1342 ms 4092 KB Output is correct
4 Correct 1332 ms 3388 KB Output is correct
5 Correct 1347 ms 3484 KB Output is correct
6 Correct 1348 ms 2656 KB Output is correct
7 Correct 1345 ms 4004 KB Output is correct
8 Correct 1313 ms 3976 KB Output is correct
9 Correct 1283 ms 3924 KB Output is correct
10 Correct 1295 ms 3272 KB Output is correct
11 Correct 1266 ms 3208 KB Output is correct
12 Correct 1255 ms 2336 KB Output is correct
13 Correct 1314 ms 4620 KB Output is correct
14 Correct 1289 ms 4552 KB Output is correct
15 Correct 1336 ms 4056 KB Output is correct
16 Correct 1331 ms 3780 KB Output is correct
17 Correct 1335 ms 3676 KB Output is correct
18 Correct 1313 ms 2716 KB Output is correct
19 Correct 1281 ms 4492 KB Output is correct
20 Correct 1408 ms 4540 KB Output is correct
21 Correct 1282 ms 4560 KB Output is correct
22 Correct 1312 ms 3276 KB Output is correct
23 Correct 1307 ms 3228 KB Output is correct
24 Correct 1319 ms 2176 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1108 KB Output is correct
2 Correct 1 ms 980 KB Output is correct
3 Correct 1 ms 1108 KB Output is correct
4 Correct 1 ms 1108 KB Output is correct
5 Correct 1 ms 980 KB Output is correct
6 Correct 1 ms 1108 KB Output is correct
7 Correct 4 ms 1236 KB Output is correct
8 Correct 4 ms 1236 KB Output is correct
9 Correct 3 ms 1236 KB Output is correct
10 Correct 3 ms 1196 KB Output is correct
11 Correct 3 ms 1108 KB Output is correct
12 Correct 3 ms 1108 KB Output is correct
13 Correct 4 ms 1224 KB Output is correct
14 Correct 3 ms 1236 KB Output is correct
15 Correct 3 ms 1120 KB Output is correct
16 Correct 3 ms 1108 KB Output is correct
17 Correct 4 ms 1120 KB Output is correct
18 Correct 3 ms 1116 KB Output is correct
19 Correct 1312 ms 4020 KB Output is correct
20 Correct 1316 ms 4212 KB Output is correct
21 Correct 1342 ms 4092 KB Output is correct
22 Correct 1332 ms 3388 KB Output is correct
23 Correct 1347 ms 3484 KB Output is correct
24 Correct 1348 ms 2656 KB Output is correct
25 Correct 1345 ms 4004 KB Output is correct
26 Correct 1313 ms 3976 KB Output is correct
27 Correct 1283 ms 3924 KB Output is correct
28 Correct 1295 ms 3272 KB Output is correct
29 Correct 1266 ms 3208 KB Output is correct
30 Correct 1255 ms 2336 KB Output is correct
31 Correct 1314 ms 4620 KB Output is correct
32 Correct 1289 ms 4552 KB Output is correct
33 Correct 1336 ms 4056 KB Output is correct
34 Correct 1331 ms 3780 KB Output is correct
35 Correct 1335 ms 3676 KB Output is correct
36 Correct 1313 ms 2716 KB Output is correct
37 Correct 1281 ms 4492 KB Output is correct
38 Correct 1408 ms 4540 KB Output is correct
39 Correct 1282 ms 4560 KB Output is correct
40 Correct 1312 ms 3276 KB Output is correct
41 Correct 1307 ms 3228 KB Output is correct
42 Correct 1319 ms 2176 KB Output is correct
43 Correct 1308 ms 6396 KB Output is correct
44 Correct 1246 ms 6488 KB Output is correct
45 Correct 1287 ms 6440 KB Output is correct
46 Correct 1285 ms 4884 KB Output is correct
47 Correct 1291 ms 4920 KB Output is correct
48 Correct 1300 ms 2640 KB Output is correct
49 Correct 1274 ms 6360 KB Output is correct
50 Correct 1297 ms 6472 KB Output is correct
51 Correct 1332 ms 6208 KB Output is correct
52 Correct 1340 ms 4756 KB Output is correct
53 Correct 1319 ms 3948 KB Output is correct