Submission #61548520
Source Code Expand
Copy
#include<bits/stdc++.h>#define int long long#define f(i,j,n) for(int i=j;i<=n;i++)#define F(i,n,j) for(int i=n;i>=j;i--)#define updmax(a,b) a=max(a,b)#define updmin(a,b) a=min(a,b)#define pb push_back#define XQZusing namespace std;namespace fsd{#define gc() (p1==p2&&(p2=(p1=buf)+fread(buf,1,MAXSIZE,stdin),p1==p2)?EOF:*p1++)const int MAXSIZE=1<<20;char buf[MAXSIZE],*p1,*p2;inline int read(){int ak=0,ioi=1;char c=gc();while(!isdigit(c)){if(c=='-')ioi=-1;c=gc();}while(isdigit(c))ak=ak*10+(c^48),c=gc();return ak*ioi;}inline string reads(){string o="";
#include<bits/stdc++.h> #define int long long #define f(i,j,n) for(int i=j;i<=n;i++) #define F(i,n,j) for(int i=n;i>=j;i--) #define updmax(a,b) a=max(a,b) #define updmin(a,b) a=min(a,b) #define pb push_back #define XQZ using namespace std; namespace fsd{ #define gc() (p1==p2&&(p2=(p1=buf)+fread(buf,1,MAXSIZE,stdin),p1==p2)?EOF:*p1++) const int MAXSIZE=1<<20; char buf[MAXSIZE],*p1,*p2; inline int read(){ int ak=0,ioi=1;char c=gc(); while(!isdigit(c)){if(c=='-')ioi=-1;c=gc();} while(isdigit(c))ak=ak*10+(c^48),c=gc(); return ak*ioi; } inline string reads(){ string o=""; char p=gc(); while(p>'z'||p<'a'){p=gc();} while(p<='z'&&p>='a'){o+=p;p=gc();} return o; } inline char readc(){ char p=gc(); while(!((p<='z'&&p>='a')||(p<='Z'&&p>='A'))){p=gc();} return p; } inline long double readd(){ long double ak=0;int ioi=1;char c=gc(); while(!isdigit(c)){if(c=='-')ioi=-1;c=gc();} while(isdigit(c))ak*=10,ak+=c-'0',c=gc(); c=gc(); long double q=0.1; while(isdigit(c))ak+=(c-'0')*q,q*=0.1,c=gc(); return ak*ioi; } } using namespace fsd; int n,d; int a[600010]; void gs(){ cin>>n; f(i,1,n)cin>>a[i]; int ans=0; f(i,1,n){ int x=lower_bound(a+1,a+1+n,a[i]*2)-a; ans+=max(0ll,n-max(x,i+1)+1); } cout<<ans<<endl; } signed main(){ #ifndef XQZ freopen(".in","r",stdin); freopen(".out","w",stdout); #endif #ifdef NXD int t=0;cin>>t;while(t--) #endif gs(); return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Various Kagamimochi |
User | xiangqizhen |
Language | C++ 17 (Clang 16.0.6) |
Score | 300 |
Code Size | 1482 Byte |
Status | AC |
Exec Time | 137 ms |
Memory | 7540 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 | 3408 KB |
00_sample_01.txt | AC | 1 ms | 3520 KB |
00_sample_02.txt | AC | 1 ms | 3484 KB |
01_random_03.txt | AC | 137 ms | 7412 KB |
01_random_04.txt | AC | 137 ms | 7368 KB |
01_random_05.txt | AC | 136 ms | 7428 KB |
01_random_06.txt | AC | 137 ms | 7392 KB |
01_random_07.txt | AC | 136 ms | 7476 KB |
01_random_08.txt | AC | 136 ms | 7416 KB |
01_random_09.txt | AC | 136 ms | 7404 KB |
01_random_10.txt | AC | 73 ms | 5516 KB |
01_random_11.txt | AC | 44 ms | 4880 KB |
01_random_12.txt | AC | 23 ms | 3996 KB |
01_random_13.txt | AC | 85 ms | 7344 KB |
01_random_14.txt | AC | 86 ms | 7392 KB |
01_random_15.txt | AC | 86 ms | 7468 KB |
01_random_16.txt | AC | 113 ms | 7348 KB |
01_random_17.txt | AC | 112 ms | 7392 KB |
01_random_18.txt | AC | 113 ms | 7396 KB |
01_random_19.txt | AC | 1 ms | 3492 KB |
01_random_20.txt | AC | 1 ms | 3448 KB |
01_random_21.txt | AC | 1 ms | 3576 KB |
01_random_22.txt | AC | 1 ms | 3500 KB |
02_handmade_23.txt | AC | 98 ms | 7476 KB |
02_handmade_24.txt | AC | 35 ms | 4848 KB |
02_handmade_25.txt | AC | 78 ms | 6696 KB |
02_handmade_26.txt | AC | 10 ms | 3916 KB |
02_handmade_27.txt | AC | 103 ms | 7372 KB |
02_handmade_28.txt | AC | 126 ms | 7540 KB |
02_handmade_29.txt | AC | 50 ms | 7480 KB |