AtCoder Grand Contest 013

Submission #1357031

Source codeソースコード

using System;
using System.IO;
using System.Linq;
using System.Text;
using System.Collections.Generic;
using System.Diagnostics;
using Enu = System.Linq.Enumerable;

public class Program
{
    public void Solve()
    {
        int N = Reader.Int();
        long L = Reader.Int(), T = Reader.Int();
        int[] X = new int[N], Dir = new int[N];
        for (int i = 0; i < N; i++) { X[i] = Reader.Int(); Dir[i] = Reader.Int() == 1 ? 1 : -1; }
        var P = new long[N];

        for (int i = 0; i < N; i++)
            P[i] = ((X[i] + Dir[i] * T) % L + L) % L;
        long after = 0;
        for (int i = 1; i < N; i++)
            if (Dir[0] != Dir[i])
            {
                long len = ((X[i] - X[0]) * Dir[0] + L) % L;
                long num = T * 2 < len ? 0 : 1 + (T * 2 - len) / L;
                after += num * Dir[0];
            }
        int skip = N - (int)((after % N + N) % N);

        Console.WriteLine(string.Join("\n", P.Skip(skip).Concat(P.Take(skip))));
    }
}


class Entry { static void Main() { new Program().Solve(); } }
class Reader
{
    static TextReader reader = Console.In;
    static readonly char[] separator = { ' ' };
    static readonly StringSplitOptions op = StringSplitOptions.RemoveEmptyEntries;
    static string[] A = new string[0];
    static int i;
    static void Init() { Dispose(); A = new string[0]; }
    public static void Set(TextReader r) { Init(); reader = r; }
    public static void Set(string file) { Init(); reader = new StreamReader(file); }
    public static bool HasNext() { return CheckNext(); }
    public static string String() { return Next(); }
    public static int Int() { return int.Parse(Next()); }
    public static long Long() { return long.Parse(Next()); }
    public static double Double() { return double.Parse(Next()); }
    public static int[] IntLine() { return Array.ConvertAll(Split(Line()), int.Parse); }
    public static int[] IntArray(int N) { return Range(N, Int); }
    public static int[][] IntTable(int H) { return Range(H, IntLine); }
    public static string[] StringArray(int N) { return Range(N, Next); }
    public static string[][] StringTable(int N) { return Range(N, () => Split(Line())); }
    public static string Line() { return reader.ReadLine().Trim(); }
    public static T[] Range<T>(int N, Func<T> f) { var r = new T[N]; for (int i = 0; i < N; r[i++] = f()) ; return r; }
    public static void Dispose() { reader.Dispose(); }
    static string[] Split(string s) { return s.Split(separator, op); }
    static string Next() { CheckNext(); return A[i++]; }
    static bool CheckNext()
    {
        if (i < A.Length) return true;
        string line = reader.ReadLine();
        if (line == null) return false;
        if (line == "") return CheckNext();
        A = Split(line);
        i = 0;
        return true;
    }
}

Submission

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

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 26 ms 11348 KB
sample_02.txt AC 25 ms 11348 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 WA
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 42 ms 14304 KB
subtask_1_12.txt AC 141 ms 20556 KB
subtask_1_13.txt WA
subtask_1_14.txt WA
subtask_1_15.txt AC 25 ms 11348 KB
subtask_1_16.txt AC 25 ms 13396 KB