1. 1.
    -1
    alin ipneler

    8. include <iostream>
    9. include <cstdio>
    10. include <algorithm>
    11. include <limits>
    12. define MAXAR 2000100
    13. define ll long long
    14. define INF 40000000000LL
    using namespace std;

    FILE *in,*out;
    struct node{
    int t,d,c;
    }ar[500100];
    int N,IN,CIK,ST,MAXD=0;
    bool operator < (node p,node q)
    {
    if(p.t!=q.t) return p.t>q.t;
    return p.d>q.d;
    }

    class KDtree{
    ll DEG,*ar;
    int ILK,SON,NER;
    ll ver(int root,int ilk,int son)
    {
    if(ILK<=ilk && son<=SON) return ar[root];
    if(ILK>=son || SON<=ilk) return -INF;
    return max(ver(root*2+1,ilk,(ilk+son)/2),ver(root*2+2,(ilk+son)/2,son));
    }
    ll ekle(int root,int ilk,int son)
    {
    if(NER<ilk || NER>=son) return ar[root];
    if(NER

    ilk && ilk

    son-1){ar[root]=DEG;return ar[root];}
    ar[root]=max(ekle(root*2+1,ilk,(ilk+son)/2),ekle(root*2+2,(ilk+son)/2,son));
    return ar[root];
    }
    public:ll start(ll *AR)
    {
    int t,z,v;
    for(t=0;t<=MAXAR;t++)
    AR[t]=-INF;
    return 1;
    }
    public:ll giveMAX(ll *AR,int ilk,int son)
    {
    ar=AR;
    ILK=ilk;
    SON=son;
    return ver(0,0,MAXD+1);
    }
    public:ll add(ll *AR,int ner,ll deg)
    {
    ar=AR;
    NER=ner;
    DEG=deg;
    return ekle(0,0,MAXD+1);
    }
    };

    KDtree compile;
    ll ar_sol[MAXAR+2];
    ll ar_sag[MAXAR+2];
    ll ar_solx[MAXAR+2];
    ll ar_sagx[MAXAR+2];
    ll ar_soly[MAXAR+2];
    ll ar_sagy[MAXAR+2];

    int read()
    {
    int t,z,v;
    fscanf(in,"%d %d %d %d",&N,&IN,&CIK,&ST);
    for(t=0;t<N;t++)
    {
    fscanf(in,"%d %d %d",&ar[t].t,&ar[t].d,&ar[t].c);
    MAXD=max(MAXD,ar[t].d);
    }
    MAXD++;
    sort(ar,ar+N);
    }

    inline ll hes(int ilk,int son)
    {
    if(ilk<son) return ((ll)son-ilk)*CIK;
    return ((ll)ilk-son)*IN;
    }

    int pre()
    {
    compile. start(ar_sol);
    compile. start(ar_sag);
    compile. start(ar_solx);
    compile. start(ar_sagx);
    compile. start(ar_soly);
    compile. start(ar_sagy);
    }

    int make_60()
    {
    int t,z,v,ilk,son;
    ll gmax;
    for(t=0;t<N;t++)
    {
    gmax=-hes(ar[t].d,ST);
    gmax=max(gmax, compile.giveMAX(ar_sol,ar[t].d+1,MAXD)+hes(0,ar[t].d));
    gmax=max(gmax, compile.giveMAX(ar_sag,0,ar[t].d)+hes(MAXD,ar[t].d));
    // printf("%lldn",gmax+ar[t].c);
    compile.add(ar_sol,ar[t].d,(gmax+ar[t].c)-hes(0,ar[t].d));
    compile.add(ar_sag,ar[t].d,(gmax+ar[t].c)-hes(MAXD,ar[t].d));
    }
    gmax=0;
    gmax=max(gmax, compile.giveMAX(ar_sol,ST+1,MAXD)+hes(0,ST));
    gmax=max(gmax, compile.giveMAX(ar_sag,0,ST)+hes(MAXD,ST));
    fprintf(out,"%dn",gmax);
    }

    int olustur_solx(int ilk,int son)
    {
    int t,z,v;
    ll gmax;
    for(t=ilk;t<son;t++)
    {
    gmax=-hes(ar[t].d,ST);
    gmax=max(gmax, compile.giveMAX(ar_sol,0,ar[t].d)+hes(MAXD,ar[t].d));
    gmax=max(gmax, compile.giveMAX(ar_sag,ar[t].d+1,MAXD)+hes(0,ar[t].d));
    gmax=max(gmax, compile.giveMAX(ar_solx,0,ar[t].d)+hes(MAXD,ar[t].d));
    compile.add(ar_solx,ar[t].d,(gmax+ar[t].c)-hes(MAXD,ar[t].d));
    }
    }

    int olustur_sagx(int ilk,int son)
    {
    int t,z,v;
    ll gmax;
    for(t=son-1;t>=ilk;t--)
    {
    gmax=-hes(ar[t].d,ST);
    gmax=max(gmax, compile.giveMAX(ar_sol,0,ar[t].d)+hes(MAXD,ar[t].d));
    gmax=max(gmax, compile.giveMAX(ar_sag,ar[t].d+1,MAXD)+hes(0,ar[t].d));
    gmax=max(gmax, compile.giveMAX(ar_sagx,ar[t].d+1,MAXD)+hes(0,ar[t].d));
    compile.add(ar_sagx,ar[t].d,(gmax+ar[t].c)-hes(0,ar[t].d));
    }
    }

    int olustur_soly(int ilk,int son)
    {
    int t,z,v;
    ll gmax;
    for(t=ilk;t<son;t++)
    {
    gmax=0;
    gmax=max(gmax, compile.giveMAX(ar_soly,0,ar[t].d)+hes(MAXD,ar[t].d)+hes(ar[t].d,MAXD));
    compile.add(ar_soly,ar[t].d,(gmax+ar[t].c)-hes(MAXD,ar[t].d)-hes(ar[t].d,MAXD));
    }
    }

    int olustur_sagy(int ilk,int son)
    {
    int t,z,v;
    ll gmax;
    for(t=son-1;t>=ilk;t--)
    {
    gmax=0;
    gmax=max(gmax, compile.giveMAX(ar_sagy,ar[t].d+1,MAXD)+hes(0,ar[t].d)+hes(ar[t].d,0));
    compile.add(ar_sagy,ar[t].d,(gmax+ar[t].c)-hes(0,ar[t].d)-hes(ar[t].d,0));
    }
    }

    int cikar_tumu(int ilk,int son)
    {
    int t,z,v;
    for(t=ilk;t<son;t++)
    {
    compile.add(ar_solx,ar[t].d,-INF);
    compile.add(ar_sagx,ar[t].d,-INF);
    compile.add(ar_soly,ar[t].d,-INF);
    compile.add(ar_sagy,ar[t].d,-INF);
    }
    return 0;
    }

    int make_100()
    {
    int t,z,v,ilk,son;
    ll gmax, gsol,gsag;
    for(t=0;t<N;)
    {
    for(z=t;z<N;z++)
    if(ar[z].t!=ar[t].t)
    break;
    ilk=t;son=z;
    // for(z=ilk;z<son;z++)
    // printf("<%d,%d,%d> ",ar[z].t,ar[z].d,ar[z].c);
    // printf("arasin");
    // getchar();
    olustur_solx(ilk,son);
    olustur_sagx(ilk,son);
    // printf("%lldn",compile. giveMAX(ar_solx,1,MAXD));
    olustur_soly(ilk,son);
    olustur_sagy(ilk,son);
    for(z=ilk;z<son;z++)
    {
    gmax=-hes(ar[z].d,ST);
    gsol=compile. giveMAX(ar_solx,0,ar[z].d+1)+hes(MAXD,ar[z].d);
    gsag=compile. giveMAX(ar_sagy,ar[z].d,MAXD)+hes(0,ar[z].d)+hes(ar[z].d,0);
    gmax=max(gmax, gsol+gsag-ar[z].c);
    gsol=compile. giveMAX(ar_soly,0,ar[z].d+1)+hes(MAXD,ar[z].d)+hes(ar[z].d,MAXD);
    gsag=compile. giveMAX(ar_sagx,ar[z].d,MAXD)+hes(0,ar[z].d);
    gmax=max(gmax, gsol+gsag-ar[z].c);
    // printf("%lldn",gmax);
    compile.add(ar_sol,ar[z].d,gmax-hes(MAXD,ar[z].d));
    compile.add(ar_sag,ar[z].d,gmax-hes(0,ar[z].d));
    }
    cikar_tumu(ilk,son);
    t=son;
    }
    gmax=0;
    gmax=max(gmax, compile.giveMAX(ar_sol,0,ST)+hes(MAXD,ST));
    gmax=max(gmax, compile.giveMAX(ar_sag,ST+1,MAXD)+hes(0,ST));
    fprintf(out,"%dn",gmax);
    }

    main()
    {
    in = fopen("salesman.in","r");
    out= fopen("salesman.out","w");
    read();
    pre();
    make_60();
    // make_100();
    return 0;
    }

    oz hakiki kendi kodum 6 tane kd tree (interval da deniyo) kastim algoritmainin dibine vurdum ioi 2009 sorusu
    ···
  1. 2.
    0
    alin lan tangram cozen kodum

    15. include<iostream>
    16. include<cstdio>

    FILE *in,*out;
    struct node{
    int uz[8][2],use[8];
    char matris[8][30][30];
    } ar[30];
    int X,Y,N;
    char matris[30][30],x,y;

    inline int kirp()
    {
    int t,z,v,kil=0;
    while(1)
    {
    kil=0;
    for(t=0;t<y;t++) if(matris[0][t]!='0') break;
    if(t==y)
    {
    for(t=1;t<x;t++) for(z=0;z<y;z++) matris[t-1][z]=matris[t][z];
    x--;kil++;
    }
    for(t=0;t<x;t++) if(matris[t][0]!='0') break;
    if(t==x)
    {
    for(t=1;t<y;t++) for(z=0;z<x;z++) matris[z][t-1]=matris[z][t];
    y--;kil++;
    }
    for(t=0;t<y;t++)if(matris[x-1][t]!='0') break;
    if(t==y) x--,kil++;
    for(t=0;t<x;t++) if(matris[t][y-1]!='0') break;
    if(t==x) y--,kil++;
    if(!kil) break;
    }
    }

    inline int cevir()
    {
    int t,z,v;
    char gecici[30][30];
    for(t=0;t<x;t++)
    for(z=0;z<y;z++)
    {
    gecici[z][x-t-1]=matris[t][z];
    }
    t=x;x=y;y=t;
    for(t=0;t<x;t++)
    for(z=0;z<y;z++)
    matris[t][z]=gecici[t][z];
    }

    inline int yansit()
    {
    int t,z,v;
    char gecici[30][30];
    for(t=0;t<x;t++)
    for(z=0;z<y;z++)
    gecici[t][y-z-1]=matris[t][z];
    for(t=0;t<x;t++)
    for(z=0;z<y;z++)
    matris[t][z]=gecici[t][z];
    }

    int ekle(int root)
    {
    int t,z,v,i,j,son=0,sss=0;
    for(t=0;t<4;t++)
    {
    for(z=0;z<x;z++)
    for(v=0;v<y;v++)
    ar[root].matris[son][z][v]=matris[z][v];
    ar[root].uz[son][0]=x;
    ar[root].uz[son][1]=y;
    son++;
    cevir();
    }
    yansit();
    for(t=0;t<4;t++)
    {
    for(z=0;z<x;z++)
    for(v=0;v<y;v++)
    ar[root].matris[son][z][v]=matris[z][v];
    ar[root].uz[son][0]=x;
    ar[root].uz[son][1]=y;
    son++;
    cevir();
    }
    for(t=0;t<8;t++)
    {
    if(ar[root].use[t])
    continue;
    for(z=t+1;z<8;z++)
    {
    if(ar[root].uz[t][0]!=ar[root].uz[z][0] ||ar[root].uz[t][1]!=ar[root].uz[z][1])
    continue;
    for(i=0,sss=0;i<ar[root].uz[t][0];i++)
    for(j=0;j<ar[root].uz[t][1];j++)
    if(ar[root].matris[t][i][j]

    ar[root].matris[z][i][j])
    sss++;
    if(sss

    ar[root].uz[t][0]*ar[root].uz[t][1])
    {
    ar[root].use[z]=1;
    }
    }
    }/*
    for(t=0;t<8;t++)
    {
    if(ar[root].use[t])
    continue;
    for(z=0;z<ar[root].uz[t][0];z++,printf("n"))
    for(v=0;v<ar[root].uz[t][1];v++)
    printf("%c ",ar[root].matris[t][z][v]);
    getchar();
    }*/
    }

    int read()
    {
    int t,z,v;
    char s[5];
    fscanf(in,"%d%d%d",&X,&Y,&N);
    // printf("%d %d %dn",X,Y,N);
    for(t=0;t<N;t++)
    {
    fscanf(in,"%d%dn",&x,&y);
    // printf("%d %dn",x,y);
    for(z=0;z<x;z++)
    for(v=0;v<y;v++)
    {
    // printf("***n");
    fscanf(in," %c ",&matris[z][v]);
    }
    kirp();
    ekle(t);
    }
    }

    int used[30],usmat[30][30];
    char isim[30][30];

    inline int kontrol(int x,int y,int root,int ham)
    {
    int t,z,v,i,j,k;
    for(t=0;t<ar[root].uz[ham][0];t++)
    for(z=0;z<ar[root].uz[ham][1];z++)
    {
    if(ar[root].matris[ham][t][z]

    '0') continue;
    if(usmat[x+t][y+z]) return 1;
    }
    return 0;
    }

    inline int yerlestir(int x,int y,int root,int ham,int menu)
    {
    int t,z,v,i,j;
    if(menu

    0)
    {
    for(t=0;t<ar[root].uz[ham][0];t++)
    for(z=0;z<ar[root].uz[ham][1];z++)
    {
    if(ar[root].matris[ham][t][z]=='0')
    continue;
    usmat[x+t][y+z]=1;
    isim[x+t][y+z]=ar[root].matris[ham][t][z];
    }
    }
    else
    {
    for(t=0;t<ar[root].uz[ham][0];t++)
    for(z=0;z<ar[root].uz[ham][1];z++)
    {
    if(ar[root].matris[ham][t][z]=='0')
    continue;
    usmat[x+t][y+z]=0;
    isim[x+t][y+z]='0';
    }
    }
    }

    int DEBUG()
    {
    int t,z,v;
    for(t=0;t<X;t++,printf("n"))
    for(z=0;z<Y;z++)
    printf("%d ",usmat[t][z]);
    printf("n");
    for(t=0;t<X;t++,printf("n"))
    for(z=0;z<Y;z++)
    printf("%c ",isim[t][z]);
    getchar();
    }

    int yazdir()
    {
    int t,z,v;
    for(t=0;t<X;t++,fprintf(out,"n"))
    for(z=0;z<Y;z++)
    fprintf(out,"%c ",isim[t][z]);
    exit(0);
    }

    int DFS(int x,int y,int level)
    {
    int t,z,v,i,j,k;
    // printf("x:%d y:%d level:%dn",x,y,level);
    if(y>=Y){DFS(x+1,0,level);return 0;}
    if(x>=X){yazdir();}
    for(t=0;t<N;t++)
    {
    // if(used[t]) continue;
    for(z=0;z<8;z++)
    {
    if(ar[t].use[z] || x+ar[t].uz[z][0]>X || y+ar[t].uz[z][1]>Y || kontrol(x,y,t,z))
    continue;
    yerlestir(x,y,t,z,0);
    // used[t]=1;
    // DEBUG();
    DFS(x,y,level+1);
    used[t]=0;
    yerlestir(x,y,t,z,1);
    }
    }
    if(usmat[x][y])DFS(x,y+1,level);
    // printf("***x:%d y:%d level:%dn",x,y,level);
    }

    main()
    {
    int t,z,v;
    in = fopen("tangram.in","r");
    out= fopen("tangram.out","w");
    read();
    for(t=0;t<X;t++)
    for(z=0;z<Y;z++)
    isim[t][z]='0';
    DFS(0,0,0);
    }
    Tümünü Göster
    ···
  2. 3.
    0
    bu da mayin tarlasi kodu

    ccc mayin tarlasi ccc
    ccc mayin tarlasi ccc
    ccc mayin tarlasi ccc
    ccc mayin tarlasi ccc
    ccc mayin tarlasi ccc
    ccc mayin tarlasi ccc

    17. include<iostream>
    18. include<cstdio>
    19. include<ctime>

    FILE *in,*out;
    struct node{
    int ilk,son;
    }ar[25];
    int N,M,K,matris[23][23],used[23][23],koy[23][23];
    int hamle[8][2]={{-1,1},{0,1},{1,1},{-1,0},{1,0},{-1,-1},{0,-1},{1,-1}};
    int mut,sil[10][2];

    int read()
    {
    int t,z,v;
    srand(time(NULL));
    fscanf(in,"%d %d %d",&N,&M,&K);
    for(t=0;t<N;t++)
    for(z=0;z<M;z++)
    {
    fscanf(in,"%d",&matris[t][z]);
    if(matris[t][z]!=-1) used[t][z]=1;
    else matris[t][z]=0;
    }
    if(K<=6)
    mut=K/3;
    else if(K<=16)
    mut=K/4;
    else mut=5;
    }

    int MUT(int root){if(root<0) return -root;return root;}

    int takribi(node *p)
    {
    int t,z,v,gx,gy,sonuc=0;
    int top[23][23];
    for(t=0;t<N;t++) for(z=0;z<M;z++)top[t][z]=0;
    for(t=0;t<K;t++)
    {
    for(z=0;z<8;z++)
    {
    gx = hamle[z][0]+p[t].ilk;
    gy = hamle[z][1]+p[t].son;
    if(gx<0 || gx>=N || gy<0 || gy>=M || !used[gx][gy])
    continue;
    top[gx][gy]++;
    }
    }
    for(t=0;t<N;t++)
    for(z=0;z<M;z++)
    {
    if(!used[t][z])
    continue;
    sonuc+=MUT(top[t][z]-matris[t][z]);
    }
    return sonuc;
    }

    int DEBUG(node *root)
    {
    int t,z,v;
    int used[23][23];
    for(t=0;t<N;t++) for(z=0;z<M;z++) used[t][z]=0;
    for(t=0;t<K;t++)used[root[t].ilk][root[t].son]=1;
    for(t=0;t<N;t++,printf("n"))
    for(z=0;z<M;z++)
    {
    if(used[t][z])
    printf("* ");
    else
    printf("%d ",matris[t][z]);
    }
    printf("deger:%dn",takribi(root));
    // getchar();
    return 0;
    }

    int DEBUGKOY()
    {
    int t,z,v;
    for(t=0;t<N;t++,printf("n"))
    for(z=0;z<M;z++)
    printf("%d ",koy[t][z]);
    getchar();
    return 0;
    }

    int uret(node *root,int mut)
    {
    int t,z,v,x,y;
    int mark[23],hang[23],kullanma[23][23];
    for(t=0;t<K;t++)mark[t]=0;
    for(t=0;t<N;t++) for(z=0;z<M;z++) kullanma[t][z]=0;
    for(t=0;t<mut;t++)
    {
    do{
    z=rand()%K;
    }while(mark[z]);
    hang[t]=z;
    mark[z]=1;
    }
    // for(t=0;t<mut;t++)
    // printf("%d ",hang[t]);
    // printf("n");
    // DEBUGKOY();
    for(t=0;t<mut;t++)
    {
    do{
    x=rand()%N;
    y=rand()%M;
    }while(used[x][y] || koy[x][y] || kullanma[x][y]);
    kullanma[x][y]=1;
    root[hang[t]].ilk=x;
    root[hang[t]].son=y;
    }
    }

    int make()
    {
    int t,z,v,x,y,g,j;
    int suan[23][2],hamle=0;
    node d1[24];
    for(t=0;t<K;t++)
    {
    do{
    x=rand()%N;
    y=rand()%M;
    }while(used[x][y] || koy[x][y]);
    koy[x][y]=1;
    ar[t].ilk=x;
    ar[t].son=y;
    }
    // DEBUG(ar);
    while(1)
    {
    mut=rand()%(K/2)+1;
    // printf("mut:%dn",mut);
    for(t=0;t<N;t++) for(z=0;z<M;z++)koy[t][z]=0;
    for(t=0;t<K;t++)
    d1[t].ilk=ar[t].ilk,d1[t].son=ar[t].son;
    for(t=0;t<K;t++)
    koy[ar[t].ilk][ar[t].son]=1;
    // printf("arn");
    // DEBUG(ar);

    g=takribi(ar);
    if(g==0)
    break;
    uret(d1,mut);
    j=takribi(d1);
    // printf("d1n");
    // DEBUG(d1);

    if(g>j || rand()%100>=95)
    {
    for(t=0;t<K;t++)
    {
    ar[t].ilk=d1[t].ilk;
    ar[t].son=d1[t].son;
    }
    }
    hamle++;
    if(hamle>500000)
    exit(0);
    }
    DEBUG(ar);
    for(t=0;t<K;t++)
    fprintf(out,"%d %dn",ar[t].ilk,ar[t].son);
    }

    main()
    {
    in = fopen("mayin.in","r");
    out= fopen("mayin.out","w");
    read();
    make();
    }

    ccc mayin tarlasi ccc
    ccc mayin tarlasi ccc
    ccc mayin tarlasi ccc
    ccc mayin tarlasi ccc
    ccc mayin tarlasi ccc
    ccc mayin tarlasi ccc
    Tümünü Göster
    ···
  3. 4.
    -1
    ccc sudoku / 1snden kisa, birden fazla sudokuyo cozer ccc
    ccc sudoku / 1snden kisa, birden fazla sudokuyo cozer ccc
    ccc sudoku / 1snden kisa, birden fazla sudokuyo cozer ccc
    ccc sudoku / 1snden kisa, birden fazla sudokuyo cozer ccc
    ccc sudoku / 1snden kisa, birden fazla sudokuyo cozer ccc
    ccc sudoku / 1snden kisa, birden fazla sudokuyo cozer ccc
    ccc sudoku / 1snden kisa, birden fazla sudokuyo cozer ccc

    //SORU 775
    //PROGRAM C++

    20. include<iostream>
    21. include<cstdio>
    22. define N 9

    FILE *in,*out;
    int mat[10][10],sat[10][10],sut[10][10],al[10][10];
    int kon[10][10][2],ukon[10][10];

    int read()
    {
    int t,z,v;
    char s[90];
    if(fscanf(in,"%s",s)==-1)
    return 0;
    for(t=0;t<N;t++)
    for(z=0;z<N;z++)
    {
    if(s[t*N+z]!='.')
    mat[t][z]=s[t*N+z]-'0';
    else mat[t][z]=0;
    }
    // for(t=0;t<N;t++,printf("n"))
    // for(z=0;z<N;z++)
    // printf("%d ",mat[t][z]);
    for(t=0;t<N;t++)
    for(z=0;z<N;z++)
    sat[t][mat[t][z]]=1;

    for(t=0;t<N;t++)
    for(z=0;z<N;z++)
    sut[t][mat[z][t]]=1;

    for(t=0;t<N;t++)
    for(z=0;z<N;z++)
    al[t][mat[kon[t][z][0]][kon[t][z][1]]]=1;
    return 1;
    }

    int aktar()
    {
    int t,z,v,x,y,i;
    for(x=0,v=0;x<N;x+=3)
    for(y=0;y<N;y+=3)
    {
    for(t=0,i=0;t<3;t++)
    for(z=0;z<3;z++)
    {
    kon[v][i][0]=t+x;
    kon[v][i][1]=z+y;
    ukon[t+x][z+y]=v;
    i++;
    }
    v++;
    }
    // for(t=0;t<N;t++,printf("nn"))
    // for(z=0;z<N;z++)
    // printf("<%d,%d> ",kon[t][z][0],kon[t][z][1]);
    }

    int cikarim()
    {
    int t,z,v,i,j,gx,gy;
    for(t=1;t<=N;t++)
    {
    for(z=0;z<N;z++)
    {
    if(al[z][t])
    continue;
    for(v=0,i=0;v<N;v++)
    if(!sat[kon[z][v][0]][t] && !sut[kon[z][v][1]][t]
    && !mat[kon[z][v][0]][kon[z][v][1]])
    {
    gx=kon[z][v][0];
    gy=kon[z][v][1];
    i++;
    }
    if(i==1)
    {
    al[z][t]=1;
    sat[gx][t]=1;
    sut[gy][t]=1;
    mat[gx][gy]=t;
    }
    }
    }
    }

    int DFS(int x,int y)
    {
    int t,z,v;
    // printf("x:%d y:%dn",x,y);
    // for(t=0;t<N;t++,printf("n"))
    // for(z=0;z<N;z++)
    // printf("%d ",mat[t][z]);
    // getchar();
    if(x==N)
    return 1;
    if(mat[x][y])
    {
    if(DFS(x,y+1))
    return 1;
    return 0;
    }
    if(y>=N)
    {
    if(DFS(x+1,0))
    return 1;
    return 0;
    }
    for(t=1;t<=N;t++)
    {
    if(sat[x][t] || sut[y][t] || al[ukon[x][y]][t])
    continue;
    mat[x][y]=t;
    sat[x][t]=1;sut[y][t]=1;al[ukon[x][y]][t]=1;
    if(DFS(x,y+1))
    return 1;
    mat[x][y]=0;
    sat[x][t]=0;sut[y][t]=0;al[ukon[x][y]][t]=0;
    }
    return 0;
    }

    int sifirla()
    {
    int t,z,v;
    for(t=0;t<=N;t++)
    for(z=0;z<=N;z++)
    {
    mat[t][z]=0;
    sut[t][z]=0;
    sat[t][z]=0;
    al[t][z]=0;
    }
    }

    main()
    {
    int t,z,v;
    in = fopen("sudoku.in","r");
    out= fopen("sudoku.out","w");
    aktar();
    while(read())
    {
    cikarim();
    DFS(0,0);
    for(t=0;t<N;t++)
    for(z=0;z<N;z++)
    fprintf(out,"%d",mat[t][z]);
    fprintf(out,"n");
    sifirla();
    }
    }

    ccc sudoku / 1snden kisa, birden fazla sudokuyo cozer ccc
    ccc sudoku / 1snden kisa, birden fazla sudokuyo cozer ccc
    ccc sudoku / 1snden kisa, birden fazla sudokuyo cozer ccc
    ccc sudoku / 1snden kisa, birden fazla sudokuyo cozer ccc
    ccc sudoku / 1snden kisa, birden fazla sudokuyo cozer ccc
    ccc sudoku / 1snden kisa, birden fazla sudokuyo cozer ccc
    ccc sudoku / 1snden kisa, birden fazla sudokuyo cozer ccc

    ccc sudoku / 1snden kisa, birden fazla sudokuyo cozer ccc
    ccc sudoku / 1snden kisa, birden fazla sudokuyo cozer ccc
    ccc sudoku / 1snden kisa, birden fazla sudokuyo cozer ccc
    ccc sudoku / 1snden kisa, birden fazla sudokuyo cozer ccc
    ccc sudoku / 1snden kisa, birden fazla sudokuyo cozer ccc
    ccc sudoku / 1snden kisa, birden fazla sudokuyo cozer ccc
    ccc sudoku / 1snden kisa, birden fazla sudokuyo cozer ccc
    Tümünü Göster
    ···
  4. 5.
    -1
    algoritma, mat biliyom diyenlerin gotune girsin
    algoritma, mat biliyom diyenlerin gotune girsin
    algoritma, mat biliyom diyenlerin gotune girsin
    ···
  5. 6.
    0
    40 yapar beyler
    ···
  6. 7.
    0
    algoritma, mat biliyom diyenlerin gotune girsin
    algoritma, mat biliyom diyenlerin gotune girsin
    algoritma, mat biliyom diyenlerin gotune girsin
    ···
  7. 8.
    0
    @1 seviyene sokayaım.
    ···
  8. 9.
    0
    özeti yok mu bunu aq
    ···
  9. 10.
    0
    indenteyşınını gibim düzgün bi yere at lan kodu. hayatta okumam yoksa
    ···
  10. 11.
    0
    @1 özet geç lan bin
    ···
  11. 12.
    0
    seviyeyi yükseltmeyin binler
    ···
  12. 13.
    0
    Seviye tavan yaptı lan gibtin attın amg @1
    ···
  13. 14.
    0
    ozet gecsene lan pic. algoritmayi herkes yazar.
    ···
  14. 15.
    0
    @9 al ozet, 256 karakterden az:

    23. include<cstdio>
    24. define M(b)b[v]>b[v+1]?b[v]:b[v+1]
    25. define S(N)scanf("%d",&N)
    26. define R(x,y)for(x=1;x<=y;x++)
    main(){int t,z,v,g,N,M,a[110][110];S(N);R(t,N){S(M);R(z,M)R(v,z)S(a[z][v]);R(z,M-1)R(v,M-z)a[M-z][v]+=M(a[M-z+1]);printf("%dn",a[1][1]);}}

    bu da sorusu:
    https://www.spoj.pl/problems/SUMITR/
    ···
  15. 16.
    0
    @14 verdim lan ozeti
    ···
  16. 17.
    0
    https://www.spoj.pl/problems/SUMITR/

    ozet:
    n tane test case var, t satir var, yukardan assagi maksimum toplami istiyo
    2
    3
    1
    2 1
    1 2 3
    4
    1
    1 2
    4 1 2
    2 3 1 1

    1. 1+1+3=5
    2. 1+1+4+3=9
    ···
  17. 18.
    0
    https://www.spoj.pl/problems/SUMITR/

    27. include<cstdio>
    28. define M(b)b[v]>b[v+1]?b[v]:b[v+1]
    29. define S(N)scanf("%d",&N)
    30. define R(x,y)for(x=1;x<=y;x++)
    main(){int t,z,v,g,N,M,a[110][110];S(N);R(t,N){S(M);R(z,M)R(v,z)S(a[z][v]);R(z,M-1)R(v,M-z)a[M-z][v]+=M(a[M-z+1]);printf("%dn",a[1][1]);}
    ···
  18. 19.
    0
    yükseltme seviyeyi alogaritma diye giberim sizi
    ···
  19. 20.
    0
    @19 daha kisasini yaz lan ipne

    https://www.spoj.pl/problems/SUMITR/

    31. include<cstdio>
    32. define M(b)b[v]>b[v+1]?b[v]:b[v+1]
    33. define S(N)scanf("%d",&N)
    34. define R(x,y)for(x=1;x<=y;x++)
    main(){int t,z,v,g,N,M,a[110][110];S(N);R(t,N){S(M);R(z,M)R(v,z)S(a[z][v]);R(z,M-1)R(v,M-z)a[M-z][v]+=M(a[M-z+1]);printf("%dn",a[1][1]);}}
    ···