Submission #2798138


Source Code Expand

//set many funcs template
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
#include<time.h>
#define inf 1072114514
#define llinf 4154118101919364364
#define mod 1000000007
#define pi 3.1415926535897932384

int max(int a,int b){if(a>b){return a;}return b;}
int min(int a,int b){if(a<b){return a;}return b;}
int zt(int a,int b){return max(a,b)-min(a,b);}
int round(int a,int b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
int ceil(int a,int b){if(a%b==0){return a/b;}return (a/b)+1;}
int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}
int nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
int nHr(int a,int b){return nCr(a+b-1,b);}
int fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
int pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
int dsum(int x){int r=0;while(x){r+=(x%10);x/=10;}return r;}
int dsumb(int x,int b){int r=0;while(x){r+=(x%b);x/=b;}return r;}
int sankaku(int x){return ((1+x)*x)/2;}
long long llmax(long long a,long long b){if(a>b){return a;}return b;}
long long llmin(long long a,long long b){if(a<b){return a;}return b;}
long long llzt(long long a,long long b){return llmax(a,b)-llmin(a,b);}
long long llround(long long a,long long b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
long long llceil(long long a,long long b){if(a%b==0){return a/b;}return (a/b)+1;}
long long llgcd(long long a,long long b){long long c;while(b!=0){c=a%b;a=b;b=c;}return a;}
long long lllcm(long long a,long long b){long long c=llgcd(a,b);a/=c;return a*b;}
long long llnCr(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
long long llnHr(long long a,long long b){return llnCr(a+b-1,b);}
long long llfact(long long a){long long i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
long long llpow(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
long long lldsum(long long x){long long r=0;while(x){r+=(x%10);x/=10;}return r;}
long long lldsumb(long long x,long long b){long long r=0;while(x){r+=(x%b);x/=b;}return r;}
long long llsankaku(long long x){return ((1+x)*x)/2;}
double dbmax(double a,double b){if(a>b){return a;}return b;}
double dbmin(double a,double b){if(a<b){return a;}return b;}
double dbzt(double a,double b){return dbmax(a,b)-dbmin(a,b);}
int sortfncsj(const void *a,const void *b){if(*(int *)a>*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int sortfnckj(const void *a,const void *b){if(*(int *)a<*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int llsortfncsj(const void *a,const void *b){if(*(long long *)a>*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int llsortfnckj(const void *a,const void *b){if(*(long long *)a<*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int dbsortfncsj(const void *a,const void *b){if(*(double *)a>*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}
int dbsortfnckj(const void *a,const void *b){if(*(double *)a<*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}
int strsortfncsj(const void *a,const void *b){return strcmp((char *)a,(char *)b);}
int strsortfnckj(const void *a,const void *b){return strcmp((char *)b,(char *)a);}

void shuffledget(int x[],int n){
    srand(time(0));
    int i,b[524288],p,c;
    for(i=0;i<n;i++){
        b[i]=i;
    }
    for(i=n;i>=1;i--){
        p=rand()%i;
        c=b[i-1];b[i-1]=b[p];b[p]=c;
    }
    for(i=0;i<n;i++){
        scanf("%d",&x[b[i]]);
    }
}

int main(void){
    int i,j,m,n,k,a[128][128],b[128]={0},c,w,r=0,l,t;
    double d;
    char s[524288];
    scanf("%d%d",&m,&n);
    //l=strlen(s);
    for(i=0;i<m;i++){
        for(j=0;j<n;j++){scanf("%d",&a[i][j]);
            if(i){a[i][j]=1-a[i][j];}
        }
    }
    for(i=0;i<m;i++){c=0;
        for(j=0;j<=n;j++){w=0;
            for(k=0;k<n;k++){b[k]=a[i][k];}
            for(k=0;k<j;k++){
                if(b[k]==1){w++;}
                b[k+1]=1-b[k+1];
            }
            for(k=n-1;k>=j;k--){
                if(b[k]==1){w++;}
                if(k>0){b[k-1]=1-b[k-1];}
            }
            //printf("<%d>\n",w);
            c=max(c,w);
        }
        r+=c;
    }
    //shuffledget(a,n);
    //qsort(a,n,sizeof(int),sortfncsj);
    printf("%d\n",r);
    return 0;
}

Submission Info

Submission Time
Task C - チョコレート
User physics0523
Language C (GCC 5.4.1)
Score 250
Code Size 4505 Byte
Status AC
Exec Time 4 ms
Memory 256 KB

Compile Error

./Main.c:15:5: warning: conflicting types for built-in function ‘round’
 int round(int a,int b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
     ^
./Main.c:16:5: warning: conflicting types for built-in function ‘ceil’
 int ceil(int a,int b){if(a%b==0){return a/b;}return (a/b)+1;}
     ^
./Main.c:22:5: warning: conflicting types for built-in function ‘pow’
 int pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
     ^
./Main.c:29:11: warning: conflicting types for built-in function ‘llround’
 long long llround(long long a,long long b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
           ^
./Main.c: In function ‘shuffledget’:
./Main.c:63:9: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",&x[b[i]]);
         ^
./Main.c: In function ‘main’:
./Main.c:71:5: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d",&m,&n);
     ^
./Main.c:74:26: warning: i...

Judge Result

Set Name All
Score / Max Score 250 / 250
Status
AC × 76
Set Name Test Cases
All 00_min_00.txt, 00_min_01.txt, 00_teuchi_01.txt, 00_teuchi_02.txt, 01_or_12.txt, 01_or_13.txt, 01_or_14.txt, 01_or_15.txt, 01_or_16.txt, 01_or_17.txt, 01_or_18.txt, 01_or_19.txt, 01_or_20.txt, 01_or_21.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, 01_random_22.txt, 01_random_23.txt, 01_random_24.txt, 01_random_25.txt, 01_random_26.txt, 01_random_27.txt, 01_random_28.txt, 01_random_29.txt, 01_random_30.txt, 01_random_31.txt, 02_oc_22.txt, 02_oc_23.txt, 02_oc_24.txt, 02_oc_25.txt, 02_oc_26.txt, 02_oc_27.txt, 02_oc_28.txt, 02_oc_29.txt, 02_oc_30.txt, 02_oc_31.txt, 03_random_02.txt, 03_random_03.txt, 03_random_04.txt, 03_random_05.txt, 03_random_06.txt, 03_random_07.txt, 03_random_08.txt, 03_random_09.txt, 03_random_10.txt, 03_random_11.txt, 10_asi_24.txt, 10_random_00.txt, 10_random_01.txt, 10_random_02.txt, 10_random_03.txt, 10_random_04.txt, 10_random_05.txt, 10_random_06.txt, 10_random_07.txt, 10_random_08.txt
Case Name Status Exec Time Memory
00_min_00.txt AC 0 ms 128 KB
00_min_01.txt AC 0 ms 128 KB
00_teuchi_01.txt AC 0 ms 128 KB
00_teuchi_02.txt AC 0 ms 128 KB
01_or_12.txt AC 1 ms 128 KB
01_or_13.txt AC 0 ms 128 KB
01_or_14.txt AC 1 ms 128 KB
01_or_15.txt AC 0 ms 128 KB
01_or_16.txt AC 1 ms 128 KB
01_or_17.txt AC 3 ms 256 KB
01_or_18.txt AC 1 ms 128 KB
01_or_19.txt AC 1 ms 128 KB
01_or_20.txt AC 1 ms 128 KB
01_or_21.txt AC 1 ms 128 KB
01_random_00.txt AC 0 ms 128 KB
01_random_01.txt AC 0 ms 128 KB
01_random_02.txt AC 4 ms 256 KB
01_random_03.txt AC 4 ms 256 KB
01_random_04.txt AC 4 ms 256 KB
01_random_05.txt AC 4 ms 256 KB
01_random_06.txt AC 4 ms 256 KB
01_random_07.txt AC 4 ms 256 KB
01_random_08.txt AC 4 ms 256 KB
01_random_09.txt AC 4 ms 256 KB
01_random_10.txt AC 4 ms 256 KB
01_random_11.txt AC 4 ms 256 KB
01_random_12.txt AC 1 ms 128 KB
01_random_13.txt AC 0 ms 128 KB
01_random_14.txt AC 1 ms 128 KB
01_random_15.txt AC 0 ms 128 KB
01_random_16.txt AC 1 ms 128 KB
01_random_17.txt AC 1 ms 128 KB
01_random_18.txt AC 1 ms 128 KB
01_random_19.txt AC 1 ms 128 KB
01_random_20.txt AC 1 ms 128 KB
01_random_21.txt AC 1 ms 128 KB
01_random_22.txt AC 1 ms 128 KB
01_random_23.txt AC 1 ms 256 KB
01_random_24.txt AC 1 ms 256 KB
01_random_25.txt AC 1 ms 128 KB
01_random_26.txt AC 1 ms 256 KB
01_random_27.txt AC 1 ms 256 KB
01_random_28.txt AC 1 ms 256 KB
01_random_29.txt AC 1 ms 128 KB
01_random_30.txt AC 1 ms 256 KB
01_random_31.txt AC 1 ms 256 KB
02_oc_22.txt AC 1 ms 128 KB
02_oc_23.txt AC 1 ms 128 KB
02_oc_24.txt AC 1 ms 256 KB
02_oc_25.txt AC 1 ms 128 KB
02_oc_26.txt AC 1 ms 256 KB
02_oc_27.txt AC 1 ms 256 KB
02_oc_28.txt AC 1 ms 256 KB
02_oc_29.txt AC 1 ms 128 KB
02_oc_30.txt AC 1 ms 256 KB
02_oc_31.txt AC 1 ms 128 KB
03_random_02.txt AC 4 ms 256 KB
03_random_03.txt AC 4 ms 256 KB
03_random_04.txt AC 4 ms 256 KB
03_random_05.txt AC 4 ms 256 KB
03_random_06.txt AC 4 ms 256 KB
03_random_07.txt AC 4 ms 256 KB
03_random_08.txt AC 4 ms 256 KB
03_random_09.txt AC 4 ms 256 KB
03_random_10.txt AC 4 ms 256 KB
03_random_11.txt AC 4 ms 256 KB
10_asi_24.txt AC 3 ms 256 KB
10_random_00.txt AC 0 ms 128 KB
10_random_01.txt AC 3 ms 256 KB
10_random_02.txt AC 0 ms 128 KB
10_random_03.txt AC 0 ms 128 KB
10_random_04.txt AC 0 ms 128 KB
10_random_05.txt AC 0 ms 128 KB
10_random_06.txt AC 0 ms 128 KB
10_random_07.txt AC 1 ms 128 KB
10_random_08.txt AC 0 ms 128 KB