Submission #1357037
Source Code Expand
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]; } after = (after % N + N) % N; long lastx = P[0]; Array.Sort(P); int s = (int)((Array.BinarySearch(P, lastx) - after + N) % N); Console.WriteLine(string.Join("\n", P.Skip(s).Concat(P.Take(s)))); } } 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 Info
Submission Time | |
---|---|
Task | C - Ants on a Circle |
User | eitaho |
Language | C# (Mono 4.6.2.0) |
Score | 0 |
Code Size | 3011 Byte |
Status | WA |
Exec Time | 172 ms |
Memory | 23752 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 700 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample_01.txt, sample_02.txt |
All | 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 |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
sample_01.txt | AC | 27 ms | 11476 KB |
sample_02.txt | AC | 28 ms | 13524 KB |
subtask_1_01.txt | AC | 114 ms | 20560 KB |
subtask_1_02.txt | AC | 95 ms | 19028 KB |
subtask_1_03.txt | AC | 172 ms | 23752 KB |
subtask_1_04.txt | AC | 170 ms | 21704 KB |
subtask_1_05.txt | AC | 49 ms | 14304 KB |
subtask_1_06.txt | AC | 60 ms | 17672 KB |
subtask_1_07.txt | AC | 157 ms | 21196 KB |
subtask_1_08.txt | AC | 164 ms | 19404 KB |
subtask_1_09.txt | WA | 117 ms | 17108 KB |
subtask_1_10.txt | WA | 103 ms | 18644 KB |
subtask_1_11.txt | AC | 45 ms | 12512 KB |
subtask_1_12.txt | AC | 148 ms | 22860 KB |
subtask_1_13.txt | AC | 113 ms | 20944 KB |
subtask_1_14.txt | AC | 108 ms | 20432 KB |
subtask_1_15.txt | AC | 27 ms | 11476 KB |
subtask_1_16.txt | AC | 27 ms | 11476 KB |