結果

問題 No.2170 Left Addition Machine
ユーザー 👑 rin204rin204
提出日時 2022-11-28 22:09:37
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 640 bytes
コンパイル時間 3,432 ms
コンパイル使用メモリ 219,704 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-04-29 05:16:41
合計ジャッジ時間 13,529 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
10,752 KB
testcase_01 AC 3 ms
5,376 KB
testcase_02 AC 3 ms
5,376 KB
testcase_03 AC 88 ms
5,376 KB
testcase_04 AC 45 ms
5,376 KB
testcase_05 AC 51 ms
5,376 KB
testcase_06 AC 55 ms
5,376 KB
testcase_07 AC 82 ms
5,376 KB
testcase_08 AC 15 ms
5,376 KB
testcase_09 AC 85 ms
5,376 KB
testcase_10 AC 12 ms
5,376 KB
testcase_11 AC 39 ms
5,376 KB
testcase_12 AC 107 ms
5,376 KB
testcase_13 AC 92 ms
5,376 KB
testcase_14 AC 88 ms
5,376 KB
testcase_15 AC 90 ms
5,376 KB
testcase_16 AC 90 ms
5,376 KB
testcase_17 AC 90 ms
5,376 KB
testcase_18 AC 88 ms
5,376 KB
testcase_19 AC 90 ms
5,376 KB
testcase_20 AC 89 ms
5,376 KB
testcase_21 AC 50 ms
5,376 KB
testcase_22 AC 52 ms
5,376 KB
testcase_23 AC 51 ms
5,376 KB
testcase_24 AC 51 ms
5,376 KB
testcase_25 AC 51 ms
5,376 KB
testcase_26 AC 51 ms
5,376 KB
testcase_27 AC 51 ms
5,376 KB
testcase_28 AC 51 ms
5,376 KB
testcase_29 AC 50 ms
5,376 KB
testcase_30 TLE -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
testcase_53 -- -
testcase_54 -- -
testcase_55 -- -
testcase_56 -- -
testcase_57 -- -
testcase_58 -- -
testcase_59 -- -
testcase_60 -- -
testcase_61 -- -
testcase_62 -- -
testcase_63 -- -
testcase_64 -- -
testcase_65 -- -
testcase_66 -- -
testcase_67 -- -
testcase_68 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

// TLE O(NQ)

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <atcoder/modint>
using namespace std;
using namespace atcoder;
using mint = modint998244353;
using ll = long long;

int main(){
	cin.tie(0)->sync_with_stdio(0);
	int n, Q;
	cin >> n >> Q;
	vector<long long> A(n + 1);
	A[0] = 1 << 30;
	for(int i = 1; i < n + 1; i++) cin >> A[i];
	int l, r;
	while(Q--){
		cin >> l >> r;
		mint ans = 0;
		for(int i = r; i >= l; i--){
			if(i == l || A[i - 1] >= A[i]){
				ans += A[i];
				break;
			}
			ans *= 2;
			ans += A[i];
		}
		cout << ans.val() << "\n";
	}
}
0