Submission #1820074
Source Code Expand
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(X,Y) ((X)>(Y)?X=(Y),true:false)
#define chmax(X,Y) ((X)<(Y)?X=(Y),true:false)
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}
#define N 100010
ll x[N], w[N], y[N];
int main(){
ll n, l, t;
cin>>n>>l>>t;
rep(i, n){
cin>>x[i]>>w[i];
w[i] = w[i]==1?1:-1;
y[i] = (x[i]+w[i]*t)%l;
if(y[i]<0) y[i] += l;
}
ll sw = 0, w0 = w[0];
if(w[0]<0){
rep(i, n) w[i] *= -1;
rep(i, n) x[i] *= -1;
}
rep(i, n){
if(w[i]>0) continue;
ll a = x[0]-x[i], b = x[0]-x[i]+2*t;
//cerr<<i<<" "<<a<<" "<<b<<endl;
if(a<0) sw++;
sw += b/l;
}
if(w0<0){
rep(i, n) w[i] *= -1;
rep(i, n) x[i] *= -1;
sw *= -1;
sw %= n;
if(sw<0) sw += n;
}
cerr<<sw<<endl;
rep(i, n) cout<<y[(i-sw+n)%n]<<endl;
return 0;
}
Submission Info
Submission Time |
|
Task |
C - Ants on a Circle |
User |
Lepton |
Language |
C++14 (GCC 5.4.1) |
Score |
0 |
Code Size |
1778 Byte |
Status |
RE |
Exec Time |
191 ms |
Memory |
3200 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 |
1 ms |
256 KB |
sample_02.txt |
AC |
1 ms |
256 KB |
subtask_1_01.txt |
WA |
140 ms |
2304 KB |
subtask_1_02.txt |
RE |
124 ms |
1408 KB |
subtask_1_03.txt |
RE |
155 ms |
2560 KB |
subtask_1_04.txt |
RE |
157 ms |
2560 KB |
subtask_1_05.txt |
WA |
33 ms |
768 KB |
subtask_1_06.txt |
RE |
108 ms |
768 KB |
subtask_1_07.txt |
RE |
143 ms |
2560 KB |
subtask_1_08.txt |
RE |
145 ms |
2560 KB |
subtask_1_09.txt |
WA |
138 ms |
2176 KB |
subtask_1_10.txt |
WA |
118 ms |
1920 KB |
subtask_1_11.txt |
AC |
30 ms |
640 KB |
subtask_1_12.txt |
AC |
191 ms |
3200 KB |
subtask_1_13.txt |
WA |
145 ms |
2432 KB |
subtask_1_14.txt |
WA |
129 ms |
2176 KB |
subtask_1_15.txt |
AC |
1 ms |
256 KB |
subtask_1_16.txt |
AC |
1 ms |
256 KB |