Submission #13262

# Submission time Handle Problem Language Result Execution time Memory
13262 2015-02-06T19:51:24 Z baneling100 Ants (IZhO12_ants) C++
0 / 100
0 ms 1084 KB
#include <stdio.h>
#define K_MAX 100

struct ant {
    int X;
    int Y;
    int D;
} Ant[K_MAX+1];
int W, H, K, T, Dx[5]={0,1,0,-1,0}, Dy[5]={0,0,1,0,-1};

void input(void) {

    int i, in1, in2, in3;

    scanf("%d %d %d %d",&W,&H,&K,&T);
    for(i=1 ; i<=K ; i++) {
        scanf("%d %d %d",&in1,&in2,&in3);
        Ant[i]={in1,in2,in3};
    }
}

void output(void) {

    int i, j, cnt;

    for(i=1 ; i<=K ; i++) {
        if(Ant[i].D%2)
            cnt=T%(2*W);
        else
            cnt=T%(2*H);
        for(j=1 ; j<=cnt ; j++) {
            Ant[i].X+=Dx[Ant[i].D];
            Ant[i].Y+=Dy[Ant[i].D];
            if(Ant[i].X==0 || Ant[i].X==W || Ant[i].Y==0 || Ant[i].Y==H)
                Ant[i].D=(Ant[i].D+1)%4+1;
        }
        printf("%d %d %d\n",Ant[i]);
    }
}

int main(void) {

    input();
    output();

    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 1084 KB Output isn't correct - 2nd words differ - expected: '3', found: '4'
2 Incorrect 0 ms 1084 KB Output isn't correct - 3rd words differ - expected: '1', found: '7084736'
3 Incorrect 0 ms 1084 KB Output isn't correct - 2nd words differ - expected: '3', found: '1'
4 Incorrect 0 ms 1084 KB Output isn't correct - 5th words differ - expected: '1', found: '2'
5 Incorrect 0 ms 1084 KB Output isn't correct - 5th words differ - expected: '1', found: '2'
6 Incorrect 0 ms 1084 KB Output isn't correct - 2nd words differ - expected: '0', found: '2'
7 Incorrect 0 ms 1084 KB Output isn't correct - 2nd words differ - expected: '6', found: '3'
8 Incorrect 0 ms 1084 KB Output isn't correct - 4th words differ - expected: '7', found: '4'
9 Incorrect 0 ms 1084 KB Output isn't correct - 2nd words differ - expected: '13', found: '1'
10 Incorrect 0 ms 1084 KB Output isn't correct - 2nd words differ - expected: '63', found: '1'
11 Incorrect 0 ms 1084 KB Output isn't correct - 2nd words differ - expected: '1', found: '3'
12 Incorrect 0 ms 1084 KB Output isn't correct - 2nd words differ - expected: '35', found: '3'
13 Incorrect 0 ms 1084 KB Output isn't correct - 1st words differ - expected: '55', found: '33'
14 Incorrect 0 ms 1084 KB Output isn't correct - 2nd words differ - expected: '19', found: '3'
15 Incorrect 0 ms 1084 KB Output isn't correct - 2nd words differ - expected: '58', found: '2'
16 Incorrect 0 ms 1084 KB Output isn't correct - 2nd words differ - expected: '44', found: '1'
17 Incorrect 0 ms 1084 KB Output isn't correct - 2nd words differ - expected: '79', found: '3'
18 Incorrect 0 ms 1084 KB Output isn't correct - 1st words differ - expected: '82', found: '1'
19 Incorrect 0 ms 1084 KB Output isn't correct - 2nd words differ - expected: '34', found: '2'
20 Incorrect 0 ms 1084 KB Output isn't correct - 2nd words differ - expected: '77', found: '3'