Submission #1084720

#TimeUsernameProblemLanguageResultExecution timeMemory
1084720KasymKBridges (APIO19_bridges)C++17
16 / 100
862 ms3468 KiB
#include "bits/stdc++.h" using namespace std; #define ff first #define ss second #define all(v) v.begin(), v.end() #define ll long long #define pb push_back #define pii pair<int, int> #define pli pair<ll, int> #define pll pair<ll, ll> #define tr(i, c) for(auto i = c.begin(); i != c.end(); ++i) #define wr puts("----------------") template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;} template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;} const int N = 5e4+5; int v[N]; int main(){ // freopen("file.txt", "r", stdin); int n, m; scanf("%d%d", &n, &m); for(int i = 1; i <= m; ++i){ int a, b, x; scanf("%d%d%d", &a, &b, &x); v[i]=x; } int q; scanf("%d", &q); while(q--){ int op; scanf("%d", &op); if(op == 1){ int b, r; scanf("%d%d", &b, &r); v[b] = r; continue; } int s, w; scanf("%d%d", &s, &w); int ans = 1, ans1 = m+1; for(int i = s-1; i >= 1; --i) if(v[i] < w){ ans = i+1; break; } for(int i = s; i <= m; ++i) if(v[i] < w){ ans1 = i; break; } int answer = ans1-ans+1; printf("%d\n", answer); } return 0; }

Compilation message (stderr)

bridges.cpp: In function 'int main()':
bridges.cpp:21:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   21 |     scanf("%d%d", &n, &m);
      |     ~~~~~^~~~~~~~~~~~~~~~
bridges.cpp:24:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |         scanf("%d%d%d", &a, &b, &x);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~
bridges.cpp:28:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   28 |     scanf("%d", &q);
      |     ~~~~~^~~~~~~~~~
bridges.cpp:31:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   31 |         scanf("%d", &op);
      |         ~~~~~^~~~~~~~~~~
bridges.cpp:34:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   34 |             scanf("%d%d", &b, &r);
      |             ~~~~~^~~~~~~~~~~~~~~~
bridges.cpp:39:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   39 |         scanf("%d%d", &s, &w);
      |         ~~~~~^~~~~~~~~~~~~~~~
#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...