Submission #10311625


Source Code Expand

#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
typedef long long ll;
typedef long double ld;
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF (1LL<<60)
#define MOD1 1000000007

void swap(ll *a, ll *b){ll c;c=*b;*b=*a;*a=c;}/*swap 交換*/
ll max2(ll a,ll b){return a>=b?a:b;}/*2つのうち大きい数を返す*/ 
ll min2(ll a,ll b){return a>=b?b:a;}/*2つのうち小さい数を返す*/ 
ll ABS(ll a){return a>=0?a:(-a);}/*絶対値*/ 
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}

typedef struct{
    ll aa;
    ll bb;
}frequent;

int main(void){
    ll n,m,ans=0;
    scanf("%lld%lld",&n,&m);
    ll x[m],y[m],box[n],ball[n];
    rep(i,0,n) box[i]=1;
    rep(i,0,n) ball[i]=i==0?1:0;
    rep(i,0,m){
        scanf("%lld%lld",&x[i],&y[i]);
    }
    rep(i,0,m){
        box[x[i]-1]--;
        box[y[i]-1]++;
        if(ball[x[i]-1]==1){
            if(box[x[i]-1]==0){
                ball[x[i]-1]=0;
            }
            ball[y[i]-1]=1;
        }
    }
    rep(i,0,n){
        if(ball[i]==1) ans++;
    }
    printf("%lld\n",ans);
    return 0;
}

Submission Info

Submission Time
Task B - Box and Ball
User siumai
Language C (GCC 5.4.1)
Score 400
Code Size 1421 Byte
Status AC
Exec Time 19 ms
Memory 3328 KB

Compile Error

./Main.c: In function ‘main’:
./Main.c:28:5: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld%lld",&n,&m);
     ^
./Main.c:33:9: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld%lld",&x[i],&y[i]);
         ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 3
AC × 27
Set Name Test Cases
Sample 0_00.txt, 0_01.txt, 0_02.txt
All 0_00.txt, 0_01.txt, 0_02.txt, 1_00.txt, 1_01.txt, 1_02.txt, 1_03.txt, 1_04.txt, 1_05.txt, 1_06.txt, 1_07.txt, 1_08.txt, 1_09.txt, 1_10.txt, 1_11.txt, 1_12.txt, 1_13.txt, 1_14.txt, 1_15.txt, 1_16.txt, 1_17.txt, 1_18.txt, 1_19.txt, 1_20.txt, 1_21.txt, 1_22.txt, 1_23.txt
Case Name Status Exec Time Memory
0_00.txt AC 1 ms 128 KB
0_01.txt AC 1 ms 128 KB
0_02.txt AC 1 ms 128 KB
1_00.txt AC 1 ms 128 KB
1_01.txt AC 1 ms 128 KB
1_02.txt AC 0 ms 128 KB
1_03.txt AC 1 ms 128 KB
1_04.txt AC 16 ms 3328 KB
1_05.txt AC 18 ms 3328 KB
1_06.txt AC 16 ms 2560 KB
1_07.txt AC 18 ms 2560 KB
1_08.txt AC 12 ms 1664 KB
1_09.txt AC 13 ms 2432 KB
1_10.txt AC 4 ms 1536 KB
1_11.txt AC 7 ms 1024 KB
1_12.txt AC 2 ms 1664 KB
1_13.txt AC 16 ms 2432 KB
1_14.txt AC 9 ms 1152 KB
1_15.txt AC 15 ms 1664 KB
1_16.txt AC 1 ms 1024 KB
1_17.txt AC 19 ms 3200 KB
1_18.txt AC 17 ms 2176 KB
1_19.txt AC 19 ms 2048 KB
1_20.txt AC 18 ms 1920 KB
1_21.txt AC 15 ms 2048 KB
1_22.txt AC 19 ms 2688 KB
1_23.txt AC 6 ms 1664 KB