Submission #1280675

#TimeUsernameProblemLanguageResultExecution timeMemory
1280675baktrrAddk (eJOI21_addk)C++20
36 / 100
2095 ms4556 KiB
/** III U U N N DDDD EEEEE RRRR SSSS TTTTT AAAAA N N DDDD I TTTTT N N OOO W W I U U NN N D D E R R S T A A NN N D D I T NN N O O W W I U U N N N D D EEEE RRRR SSSS T AAAAA N N N D D I T N N N O O W W W I U U N NN D D E R R S T A A N NN D D I T N NN O O WW WW III UUUUU N N DDDD EEEEE R R SSSS T A A N N DDDD I T N N OOO W W **/ //18.09.25 #include <bits/stdc++.h> // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> using namespace std; // using namespace __gnu_pbds; #define ent '\n' #define F first #define S second #define in insert #define no "NO\n" #define yes "YES\n" #define pb push_back #define sz(w) w.size() #define int long long #define pii pair <int, int> #define all(w) w.begin(), w.end() #define rall(w) w.rbegin(), w.rend() #define BakTR ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); const int MOD = 998244353, N = 2e5 + 7 , inf = 1e9 + 7, INF = 2e18, LOG = 18 , mod = 1e9 + 7 ; // template <typename T> // using ordered_set = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>; // mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); int p[N] , a[N] ; void accepted() { int n , k ; cin >> n >> k ; for(int i = 1 ; i <= n ; i++) { cin >> a[i] ; p[i] = p[ i- 1] + a[i] ; } int q; cin >> q ; while(q -- ) { int t ; cin >> t ; if(t == 2) { int l , r , m ; cin >> l >> r >> m ; int ans = 0 ; for(int i = l ; i + m - 1 <= r ; i++) { ans += p[i + m - 1] - p[i - 1] ; } cout << ans << ent ; } else { int x ; cin >> x ; } } } signed main() { BakTR //PLS NeverGiveUp // freopen("diamond.in", "r", stdin) ; // freopen("diamond.out", "w", stdout) ; int T = 1 ; // cin >> T ; while (T--) { accepted(); cout << ent; } } /** baktr **/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...