if(p2.color==p1.color),ans++。
#include<cstdio> #include<iostream> #include<cstring> using namespace std; struct s { int a,b,c; }s[2000005]; int main() { int n,k,p; int ans=0; int tmp=0; scanf( for(int i=1;i<=n;i++) { int co,h; scanf( if(h<=p) tmp=i; if(tmp>=s[co].a) s[co].c=s[co].b; s[co].a=i; ans+=s[co].c; s[co].b++; } printf( }
Comments NOTHING