Submission #1693500


Source Code Expand

 
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <algorithm>
#include <iostream>
#define rep(i, a, b) for (int i = (a); i <= (b); ++ i)
#define per(i, a, b) for (int i = (a); i >= (b); -- i)
#define For(i, a, b) for (int i = (a); i < (b); ++ i)
#define foreach(it, c) for (__typeof((c).begin()) it = (c).begin(); it != (c).end(); ++ it)
#define fore(e, x, y) for (int ep = e(x), y = e[ep].y; ep; y = e[ep = e[ep].nxt].y)
using namespace std;
const int N = 1e5 + 7;
 
inline int ri() {
    int x = 0; bool f = 1; char c = getchar();
    for (; !isdigit(c); c = getchar()) if (c == '-') f = 0;
    for (; isdigit(c); c = getchar()) x = x * 10 + c - 48;
    return f ? x : -x;
}
 
int n, L, T;
int X[N], W[N], id[N];
 
inline int pls(int x, int y, int Mod) {return (x + y) % Mod;}
inline int mul(int x, int y ,int Mod) {return 1LL * x * y % Mod;}
 
int main() {
 
    n = ri(), L = ri(), T = ri();
    rep (i, 1, n) 
        X[i] = ri(), W[i] = ri();
 
    int cur = 0, t; 
    rep (i, 1, n) {
        int tms = (T + (W[i] == 1 ? X[i] : L - 1 - X[i])) / L;  
        cur = pls(cur, mul((W[i] == 1 ? n - 1 : 1), tms, n), n);    
    }
 
    rep (i, 1, n) X[i] = pls(X[i], mul((W[i] == 1 ? 1 : L - 1), T, L), L);
    sort(X+1, X+n+1);
 
    rep (i, n - cur + 1, n) printf("%d\n", X[i]);
    rep (i, 1, n - cur) printf("%d\n", X[i]);
 
    return 0;
}

Submission Info

Submission Time
Task C - Ants on a Circle
User acha
Language C++14 (GCC 5.4.1)
Score 700
Code Size 1446 Byte
Status AC
Exec Time 27 ms
Memory 1920 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 700 / 700
Status
AC × 2
AC × 20
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 1 ms 256 KB
sample_02.txt AC 1 ms 256 KB
subtask_1_01.txt AC 19 ms 1408 KB
subtask_1_02.txt AC 13 ms 1024 KB
subtask_1_03.txt AC 26 ms 1920 KB
subtask_1_04.txt AC 27 ms 1920 KB
subtask_1_05.txt AC 5 ms 512 KB
subtask_1_06.txt AC 7 ms 512 KB
subtask_1_07.txt AC 23 ms 1664 KB
subtask_1_08.txt AC 24 ms 1664 KB
subtask_1_09.txt AC 16 ms 1152 KB
subtask_1_10.txt AC 14 ms 1024 KB
subtask_1_11.txt AC 5 ms 512 KB
subtask_1_12.txt AC 23 ms 1792 KB
subtask_1_13.txt AC 16 ms 1408 KB
subtask_1_14.txt AC 16 ms 1280 KB
subtask_1_15.txt AC 1 ms 256 KB
subtask_1_16.txt AC 1 ms 256 KB