Submission #61548559
Source Code Expand
Copy
#include<bits/stdc++.h>#define int long long#define For(i, a, b) for(int i = (a); i <= (b); i++)#define Rof(i, a, b) for(int i = (a); i >= (b); i--)using namespace std;const int N = 5e5 + 5;int n, ans, a[N];void Solve(){cin >> n;For(i, 1, n) cin >> a[i];int j = 0;For(i, 1, n){while(j < i && a[j + 1] * 2 <= a[i]) j++;ans += j;}cout << ans << '\n';}signed main(){cin.tie(0)->sync_with_stdio(0);int T = 1; //cin >> T;while(T--) Solve();
#include<bits/stdc++.h> #define int long long #define For(i, a, b) for(int i = (a); i <= (b); i++) #define Rof(i, a, b) for(int i = (a); i >= (b); i--) using namespace std; const int N = 5e5 + 5; int n, ans, a[N]; void Solve(){ cin >> n; For(i, 1, n) cin >> a[i]; int j = 0; For(i, 1, n){ while(j < i && a[j + 1] * 2 <= a[i]) j++; ans += j; } cout << ans << '\n'; } signed main(){ cin.tie(0)->sync_with_stdio(0); int T = 1; //cin >> T; while(T--) Solve(); return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Various Kagamimochi |
User | Anyees |
Language | C++ 20 (gcc 12.2) |
Score | 300 |
Code Size | 503 Byte |
Status | AC |
Exec Time | 29 ms |
Memory | 7532 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt |
All | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 01_random_16.txt, 01_random_17.txt, 01_random_18.txt, 01_random_19.txt, 01_random_20.txt, 01_random_21.txt, 01_random_22.txt, 02_handmade_23.txt, 02_handmade_24.txt, 02_handmade_25.txt, 02_handmade_26.txt, 02_handmade_27.txt, 02_handmade_28.txt, 02_handmade_29.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_sample_00.txt | AC | 1 ms | 3496 KB |
00_sample_01.txt | AC | 1 ms | 3552 KB |
00_sample_02.txt | AC | 1 ms | 3500 KB |
01_random_03.txt | AC | 29 ms | 7336 KB |
01_random_04.txt | AC | 29 ms | 7408 KB |
01_random_05.txt | AC | 29 ms | 7336 KB |
01_random_06.txt | AC | 29 ms | 7332 KB |
01_random_07.txt | AC | 29 ms | 7312 KB |
01_random_08.txt | AC | 29 ms | 7396 KB |
01_random_09.txt | AC | 29 ms | 7400 KB |
01_random_10.txt | AC | 15 ms | 5496 KB |
01_random_11.txt | AC | 10 ms | 4656 KB |
01_random_12.txt | AC | 5 ms | 4096 KB |
01_random_13.txt | AC | 22 ms | 7532 KB |
01_random_14.txt | AC | 21 ms | 7392 KB |
01_random_15.txt | AC | 21 ms | 7396 KB |
01_random_16.txt | AC | 26 ms | 7384 KB |
01_random_17.txt | AC | 27 ms | 7396 KB |
01_random_18.txt | AC | 26 ms | 7328 KB |
01_random_19.txt | AC | 1 ms | 3496 KB |
01_random_20.txt | AC | 1 ms | 3432 KB |
01_random_21.txt | AC | 1 ms | 3320 KB |
01_random_22.txt | AC | 1 ms | 3444 KB |
02_handmade_23.txt | AC | 21 ms | 7532 KB |
02_handmade_24.txt | AC | 8 ms | 4800 KB |
02_handmade_25.txt | AC | 18 ms | 6716 KB |
02_handmade_26.txt | AC | 3 ms | 3816 KB |
02_handmade_27.txt | AC | 24 ms | 7312 KB |
02_handmade_28.txt | AC | 26 ms | 7396 KB |
02_handmade_29.txt | AC | 15 ms | 7336 KB |