QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#532775#9220. Bus Analysisucup-team1231#Compile Error//Python31.7kb2024-08-25 11:36:072024-08-25 11:36:07

Judging History

你现在查看的是最新测评结果

  • [2024-08-25 11:36:07]
  • 评测
  • [2024-08-25 11:36:07]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define SZ 200055
typedef pair<int,int> pii;
#define fi first
#define se second
#define pb push_back
typedef long long ll;
#define lg lg__
pii lg[SZ];
int n,d,L,sm[SZ];
const int S=400;
vector<int> g[SZ],GT;
#define all(s) s.begin(),s.end()
int qs[SZ],pf[SZ],ms[SZ];
#define sz(s) (int)(s).size()
ll ans=0;
void large(int x) {
    auto&G=g[x];
    for(int i=0;i<=L;++i) qs[i]=0;
    if(G.size()<2) ms[x]=-1;
    else {
        ms[x]=G.back()+G[sz(G)-2]+20*(sz(G)-2);
    }
    for(int j=0;j<G.size();++j) {
        ++qs[G[j]];
        --qs[min(G[j]+(j+1)*20,L+1)];
    }
    for(int i=1;i<=L;++i) if(i>=20) qs[i]+=qs[i-20];
    static int anx[SZ],cge[SZ];
    anx[L+1]=L+1; cge[L+1]=0;
    for(int i=L;i>=0;--i)
        if(qs[i]) anx[i]=i;
        else anx[i]=anx[i+1];
    for(int i:GT) if(i!=x) ++cge[sm[i]];
    for(int i=L;i>=0;--i) cge[i]+=cge[i+1];
    for(int i:GT) if(i!=x) {
        int nx;
        if(lg[i].se==1) {
            nx=anx[lg[i].fi];
        }
        else {
            if(ms[x]>=lg[i].fi) nx=0;
            else nx=anx[0];
        }
        ans+=cge[nx];
        ans-=sm[i]>=nx;
    }
}
int main() {
    scanf("%d%d%d",&n,&d,&L);
    for(int i=1;i<=n;++i) {
        int x,y;
        scanf("%d%d",&x,&y);
        g[x].push_back(y);
    }
    for(int i=1;i<=d;++i) if(g[i].size()) GT.push_back(i);
    for(int i:GT) {
        sort(all(g[i]));
        if(g[i].size()>=3) lg[i]=pii(0,2);
        else if(g[i].size()>=2) lg[i]=pii(g[i][0]+g[i][1],2);
        else lg[i]=pii(g[i][0],1);
        sm[i]=min(g[i].back()+(sz(g[i])-1)*20,L);
    }
    for(int i:GT) {
        if(1) {
            large(i);
        }
    }
    cout<<ans<<"\n";
}

Details

  File "answer.code", line 2
    using namespace std;
          ^^^^^^^^^
SyntaxError: invalid syntax