AtCoder Grand Contest 013

Submission #1365956

Source codeソースコード

#include <bits/stdc++.h>

using namespace std;

//#define FILE_IO

int N, L, T;
int p[100005], d[100005], f[100005], r[100005];

int main()
{
    #ifdef FILE_IO
    freopen("1.in", "r", stdin);
    freopen("1.out", "w", stdout);
    #endif

    scanf("%d%d%d", &N, &L, &T);
    for(int i = 0; i < N; i++)
    {
        scanf("%d%d", &p[i], &d[i]);
        if(d[i] == 2)   d[i] = -1;
    }

    int add = T % L;
    for(int i = 0; i < N; i++)
    {
        if(d[i] == 1)   f[i] = (p[i] + add) % L;
        else            f[i] = (p[i] - add + L) % L;
    }

    int id = 0;
    for(int i = 1; i < N; i++)
        if(d[i] != d[0])
        {
            double timp = 0.0;
            int cnt = 0;
            if(d[0] == 1)
            {
                timp = double(p[i] - p[0]) / 2.0;
                if(timp > T)    cnt = 0;
                else    cnt = 1 + (int)( ( (double)T - timp ) / ((double)L / 2.0) );
                (id += cnt) %= N;
            }
            else
            {
                timp = double(p[0] + L - p[i]) / 2.0;
                if(timp > T)    cnt = 0;
                else    cnt = 1 + (int)( ( (double)T - timp ) / ((double)L / 2.0) );
                (id += N - cnt) %= N;
            }
        }

    for(int i = 0; i < N; i++)
        r[(id + i) % N] = f[i];

    for(int i = 0; i < N; i++)
        printf("%d\n", r[i]);

    return 0;
}

Submission

Task問題 C - Ants on a Circle
User nameユーザ名 Bogdan Sitaru
Created time投稿日時
Language言語 C++14 (GCC 5.4.1)
Status状態 RE
Score得点 0
Source lengthソースコード長 1435 Byte
File nameファイル名
Exec time実行時間 ms
Memory usageメモリ使用量 -

Compiler messageコンパイルメッセージ

./Main.cpp: In function ‘int main()’:
./Main.cpp:17:32: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d%d%d", &N, &L, &T);
^
./Main.cpp:20:36: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d%d", &p[i], &d[i]);
^

Test case

Set

Set name Score得点 / Max score Cases
Sample - sample_01.txt,sample_02.txt
All 0 / 700 sample_01.txt,sample_02.txt,sample_01.txt,sample_02.txt,subtask_1_01.txt,subtask_1_02.txt,subtask_1_03.txt,subtask_1_04.txt,subtask_1_05.txt,subtask_1_06.txt,subtask_1_07.txt,subtask_1_08.txt,subtask_1_09.txt,subtask_1_10.txt,subtask_1_11.txt,subtask_1_12.txt,subtask_1_13.txt,subtask_1_14.txt,subtask_1_15.txt,subtask_1_16.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
sample_01.txt AC 1 ms 256 KB
sample_02.txt AC 1 ms 256 KB
subtask_1_01.txt WA
subtask_1_02.txt WA
subtask_1_03.txt WA
subtask_1_04.txt WA
subtask_1_05.txt RE
subtask_1_06.txt WA
subtask_1_07.txt WA
subtask_1_08.txt WA
subtask_1_09.txt WA
subtask_1_10.txt WA
subtask_1_11.txt AC 5 ms 640 KB
subtask_1_12.txt AC 24 ms 2432 KB
subtask_1_13.txt WA
subtask_1_14.txt WA
subtask_1_15.txt AC 1 ms 256 KB
subtask_1_16.txt AC 1 ms 256 KB