Submission #76650192


Source Code Expand

#include<iostream>
#include<cstring>
#include<vector>
#include<algorithm>
#define rep(i,l,r) for(int i=l;i<=r;i++)
constexpr int N=300005;
int rd(){
    int x=0,f=1;
    char c=getchar();
    for(;!isdigit(c);c=getchar())f=c==45?-1:f;
    for(;isdigit(c);c=getchar())x=x*10+c-48;
    return x*f;
}
using namespace std;
int n;
int t[N<<1];
void upd(int x,int c){
    while(x<=n)t[x]+=c,x+=x&-x;
}
int que(int x){
    int ret=0;
    while(x)ret+=t[x],x-=x&-x;
    return ret;
}
int cnt;
vector<int>cue[N];
signed main(){
    n=rd();
    rep(i,1,n){
        int x=rd(),y=rd();
        cue[x].emplace_back(y);
    }
    rep(x,1,n){
        for(int y:cue[x])if(que(y-1)==0)cnt++;
        for(int y:cue[x])upd(y,1);
    }
    cout<<cnt;
    return 0;
}

Submission Info

Submission Time
Task C - Not Covered Points
User Sayhere
Language C++23 (GCC 15.2.0)
Score 300
Code Size 784 Byte
Status AC
Exec Time 63 ms
Memory 21344 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 25
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_00.txt, 01_random_01.txt, 01_random_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
Case Name Status Exec Time Memory
00_sample_00.txt AC 2 ms 3484 KiB
00_sample_01.txt AC 2 ms 3412 KiB
00_sample_02.txt AC 2 ms 3412 KiB
01_random_00.txt AC 2 ms 3432 KiB
01_random_01.txt AC 34 ms 21052 KiB
01_random_02.txt AC 57 ms 21148 KiB
01_random_03.txt AC 34 ms 21040 KiB
01_random_04.txt AC 58 ms 21124 KiB
01_random_05.txt AC 39 ms 15328 KiB
01_random_06.txt AC 62 ms 21076 KiB
01_random_07.txt AC 32 ms 13156 KiB
01_random_08.txt AC 61 ms 21088 KiB
01_random_09.txt AC 35 ms 13712 KiB
01_random_10.txt AC 63 ms 21076 KiB
01_random_11.txt AC 18 ms 8980 KiB
01_random_12.txt AC 63 ms 21088 KiB
01_random_13.txt AC 61 ms 21084 KiB
01_random_14.txt AC 60 ms 21052 KiB
01_random_15.txt AC 61 ms 21096 KiB
01_random_16.txt AC 61 ms 21136 KiB
01_random_17.txt AC 60 ms 21092 KiB
01_random_18.txt AC 58 ms 21124 KiB
01_random_19.txt AC 58 ms 21052 KiB
01_random_20.txt AC 58 ms 21040 KiB
01_random_21.txt AC 58 ms 21344 KiB