Submission #1817020
Source Code Expand
#include<bits/stdc++.h> using namespace std; namespace FastIO { static char c; static int top,buf[12],f; template<typename T> inline void read(T& x) { x=0,c=getchar(),f=1; while(!isdigit(c)){if(c=='-')f=-1;c=getchar();} while(isdigit(c))x=x*10+c-'0',c=getchar();x*=f; } template<typename T> inline void write(T x,int f=0) { top=0; if(x<0)putchar('-'),x=-x; do buf[top++]=x%10,x/=10;while(x); for(int i=top-1;~i;i--)putchar(buf[i]+48); if(f)putchar(f&1?' ':'\n'); } } using FastIO::read; using FastIO::write; const int maxn=1e5+5; int N,L,T,st,a[maxn],dt; int main() { read(N),read(L),read(T),dt=T%L; for(int i=0,w;i<N;i++) { read(a[i]),read(w); if(w==1) { st=(st+T/L)%N; a[i]+=dt; if(a[i]>=L)a[i]-=L,st=(st+1)%N; } else { st=((st-T/L)%N+N)%N; a[i]-=dt; if(a[i]<0)a[i]+=L,st=(st+N-1)%N; } } sort(a,a+N); for(int i=st;i<st+N;i++)write(a[i%N],2); return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - Sorted Arrays |
User | MegaOwIer |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 973 Byte |
Status | TLE |
Exec Time | 2103 ms |
Memory | 384 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 300 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample_01.txt, sample_02.txt, sample_03.txt |
All | sample_01.txt, sample_02.txt, sample_03.txt, sample_01.txt, sample_02.txt, sample_03.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 |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
sample_01.txt | TLE | 2103 ms | 256 KB |
sample_02.txt | TLE | 2103 ms | 256 KB |
sample_03.txt | TLE | 2103 ms | 256 KB |
subtask_1_01.txt | TLE | 2103 ms | 384 KB |
subtask_1_02.txt | TLE | 2103 ms | 384 KB |
subtask_1_03.txt | TLE | 2103 ms | 256 KB |
subtask_1_04.txt | TLE | 2103 ms | 384 KB |
subtask_1_05.txt | TLE | 2103 ms | 384 KB |
subtask_1_06.txt | TLE | 2103 ms | 384 KB |
subtask_1_07.txt | TLE | 2103 ms | 384 KB |
subtask_1_08.txt | TLE | 2103 ms | 384 KB |
subtask_1_09.txt | TLE | 2103 ms | 384 KB |
subtask_1_10.txt | TLE | 2103 ms | 256 KB |
subtask_1_11.txt | TLE | 2103 ms | 256 KB |