Submission #1693494


Source Code Expand

 
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <cassert>
#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() {
#ifndef ONLINE_JUDGE
    freopen("a.in", "r", stdin);
#endif
 
    srand(33);
 
    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 0
Code Size 1551 Byte
Status TLE
Exec Time 2103 ms
Memory 256 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:33:32: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’, declared with attribute warn_unused_result [-Wunused-result]
     freopen("a.in", "r", stdin);
                                ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 700
Status
TLE × 2
TLE × 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 TLE 2103 ms 256 KB
sample_02.txt TLE 2103 ms 256 KB
subtask_1_01.txt TLE 2103 ms 256 KB
subtask_1_02.txt TLE 2103 ms 256 KB
subtask_1_03.txt TLE 2103 ms 256 KB
subtask_1_04.txt TLE 2103 ms 256 KB
subtask_1_05.txt TLE 2103 ms 256 KB
subtask_1_06.txt TLE 2103 ms 256 KB
subtask_1_07.txt TLE 2103 ms 256 KB
subtask_1_08.txt TLE 2103 ms 256 KB
subtask_1_09.txt TLE 2103 ms 256 KB
subtask_1_10.txt TLE 2103 ms 256 KB
subtask_1_11.txt TLE 2103 ms 256 KB
subtask_1_12.txt TLE 2103 ms 256 KB
subtask_1_13.txt TLE 2103 ms 256 KB
subtask_1_14.txt TLE 2103 ms 256 KB
subtask_1_15.txt TLE 2103 ms 256 KB
subtask_1_16.txt TLE 2103 ms 256 KB