Submission #795900

#TimeUsernameProblemLanguageResultExecution timeMemory
795900prefixorsuuffiixxExamination (JOI19_examination)C++14
100 / 100
1408 ms6488 KiB
#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 (stderr)

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