結果
問題 |
No.880 Yet Another Segment Tree Problem
|
ユーザー |
![]() |
提出日時 | 2019-09-06 23:44:03 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 811 bytes |
コンパイル時間 | 2,822 ms |
コンパイル使用メモリ | 215,084 KB |
最終ジャッジ日時 | 2025-01-07 17:03:23 |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 10 TLE * 27 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:18:15: warning: format ‘%lld’ expects argument of type ‘long long int*’, but argument 2 has type ‘int*’ [-Wformat=] 18 | scanf("%lld", &A[i]); | ~~~^ ~~~~~ | | | | | int* | long long int* | %d main.cpp:16:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 16 | scanf("%d %d", &N, &Q); | ~~~~~^~~~~~~~~~~~~~~~~ main.cpp:18:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 18 | scanf("%lld", &A[i]); | ~~~~~^~~~~~~~~~~~~~~ main.cpp:22:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 22 | scanf("%d %d %d", &a, &b, &c); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ main.cpp:25:12: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 25 | scanf("%d", &d); | ~~~~~^~~~~~~~~~ main.cpp:28:12: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 28 | scanf("%d", &d); | ~~~~~^~~~~~~~~~
ソースコード
// とおってー! #pragma GCC optimize ("O3") #pragma GCC target ("avx") #include <bits/stdc++.h> using namespace std; using int64 = long long; int main() { int N, Q; int A[100000]; scanf("%d %d", &N, &Q); for(int i = 0; i < N; i++) { scanf("%lld", &A[i]); } for(int i = 0; i < Q; i++) { int a, b, c, d; scanf("%d %d %d", &a, &b, &c); --b; if(a == 1) { scanf("%d", &d); for(int j = b; j < c; j++) A[j] = d; } else if(a == 2) { scanf("%d", &d); for(int j = b; j < c; j++) A[j] = __gcd(A[j], d); } else if(a == 3) { int ret = 0; for(int j = b; j < c; j++) ret = max(ret, A[j]); printf("%d\n", ret); } else { int64 ret = 0; for(int j = b; j < c; j++) ret += A[j]; printf("%lld\n", ret); } } }