제출 #104760

#제출 시각아이디문제언어결과실행 시간메모리
104760mzhaoBitaro, who Leaps through Time (JOI19_timeleap)C++11
4 / 100
3068 ms8728 KiB
#include <bits/stdc++.h> using namespace std; #ifdef DEBUG #define D(x...) printf(x) #else #define D(x...) #endif #define MN 300009 #define ll long long int N, Q, L[MN], R[MN]; int main() { scanf("%d%d", &N, &Q); for (int i = 1; i < N; i++) { scanf("%d%d", &L[i], &R[i]); } for (int _ = 0, T, A, B, C, D; _ < Q; _++) { scanf("%d", &T); if (T == 1) { scanf("%d%d%d", &A, &B, &C); L[A] = B; R[A] = C; } else { scanf("%d%d%d%d", &A, &B, &C, &D); ll cur = 0; if (A <= C) { for (int i = A; i < C; i++) { B = max(B, L[i]); if (B >= R[i]) { cur += B-R[i]+1; B = R[i]-1; } B++; } if (B > D) cur += B-D; } else { for (int i = A-1; i >= C; i--) { B = max(B, L[i]); if (B >= R[i]) { cur += B-R[i]+1; B = R[i]-1; } B++; } if (B > D) cur += B-D; } printf("%lld\n", cur); } } }

컴파일 시 표준 에러 (stderr) 메시지

timeleap.cpp: In function 'int main()':
timeleap.cpp:16:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d", &N, &Q);
  ~~~~~^~~~~~~~~~~~~~~~
timeleap.cpp:18:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d", &L[i], &R[i]);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~
timeleap.cpp:21:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &T);
   ~~~~~^~~~~~~~~~
timeleap.cpp:23:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    scanf("%d%d%d", &A, &B, &C);
    ~~~~~^~~~~~~~~~~~~~~~~~~~~~
timeleap.cpp:26:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    scanf("%d%d%d%d", &A, &B, &C, &D);
    ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...