Submission #916538

#TimeUsernameProblemLanguageResultExecution timeMemory
916538panCurtains (NOI23_curtains)C++17
24 / 100
1185 ms21172 KiB
#include <bits/stdc++.h> //#include "bits_stdc++.h" #include <stdio.h> #include <algorithm> #include <memory.h> #define f first #define s second #define mp make_pair #define pb push_back #define lb lower_bound #define ub upper_bound #define input(x) scanf("%lld", &x); #define print(x, y) printf("%lld%c", x, y); #define show(x) cerr << #x << " is " << x << endl; #define show2(x,y) cerr << #x << " is " << x << " " << #y << " is " << y << endl; #define show3(x,y,z) cerr << #x << " is " << x << " " << #y << " is " << y << " " << #z << " is " << z << endl; using namespace std; typedef long long ll; typedef long double ld; typedef pair<ld, ll> pd; typedef pair<string, ll> psl; typedef pair<ll, ll> pi; vector<vector<ll> > leftt; vector<ll> pointer; bool dp[2005][2005]; int main() { ll n, m, q, l ,r; input(n); input(m); input(q); leftt.resize(n+1); pointer.assign(n+1, 0); for (ll i=0; i<m; ++i) { input(l); input(r); leftt[r].pb(l); } for (ll i=1; i<=n; ++i) sort(leftt[i].begin(), leftt[i].end()); for (ll i= 1; i<=n; ++i) { ll last = i; for (ll j=i; j<=n; ++j) { //show2(i, j); //show(pointer[j]); if (leftt[j].empty()) {dp[i][j] = false; continue;} while (pointer[j]<leftt[j].size()-1 && leftt[j][pointer[j]]<i) {pointer[j]++;} //show(leftt[j][pointer[j]]); if (leftt[j].size() && leftt[j][pointer[j]]>=i && leftt[j][pointer[j]]<=last) {last = j+1; dp[i][j] = true;} else dp[i][j] = false; } } while (q--) { input(l); input(r); if (dp[l][r]) cout << "YES" << endl; else cout << "NO" << endl; } return 0; }

Compilation message (stderr)

curtains.cpp: In function 'int main()':
curtains.cpp:47:21: warning: comparison of integer expressions of different signedness: '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   47 |    while (pointer[j]<leftt[j].size()-1 && leftt[j][pointer[j]]<i) {pointer[j]++;}
curtains.cpp:12:23: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 | #define input(x) scanf("%lld", &x);
      |                  ~~~~~^~~~~~~~~~~~
curtains.cpp:30:2: note: in expansion of macro 'input'
   30 |  input(n); input(m); input(q);
      |  ^~~~~
curtains.cpp:12:23: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 | #define input(x) scanf("%lld", &x);
      |                  ~~~~~^~~~~~~~~~~~
curtains.cpp:30:12: note: in expansion of macro 'input'
   30 |  input(n); input(m); input(q);
      |            ^~~~~
curtains.cpp:12:23: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 | #define input(x) scanf("%lld", &x);
      |                  ~~~~~^~~~~~~~~~~~
curtains.cpp:30:22: note: in expansion of macro 'input'
   30 |  input(n); input(m); input(q);
      |                      ^~~~~
curtains.cpp:12:23: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 | #define input(x) scanf("%lld", &x);
      |                  ~~~~~^~~~~~~~~~~~
curtains.cpp:35:3: note: in expansion of macro 'input'
   35 |   input(l); input(r);
      |   ^~~~~
curtains.cpp:12:23: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 | #define input(x) scanf("%lld", &x);
      |                  ~~~~~^~~~~~~~~~~~
curtains.cpp:35:13: note: in expansion of macro 'input'
   35 |   input(l); input(r);
      |             ^~~~~
curtains.cpp:12:23: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 | #define input(x) scanf("%lld", &x);
      |                  ~~~~~^~~~~~~~~~~~
curtains.cpp:56:3: note: in expansion of macro 'input'
   56 |   input(l); input(r);
      |   ^~~~~
curtains.cpp:12:23: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 | #define input(x) scanf("%lld", &x);
      |                  ~~~~~^~~~~~~~~~~~
curtains.cpp:56:13: note: in expansion of macro 'input'
   56 |   input(l); input(r);
      |             ^~~~~
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...