Submission #1694016
Source Code Expand
#include<stdio.h> #include<stdlib.h> #include<string.h> #include<algorithm> using namespace std; const int M=1e5+10; int n,L,T,w[M],x[M],y[M],c; template<typename Type>Type ri(){ Type aa=0;bool bb=0; char c=getchar(); for(;('-'^c)&&(c>'9'||c<'0');) c=getchar(); if(c=='-'){ bb=1;c=getchar();} for(;('0'<=c&&c<='9');c=getchar()) aa=aa*10+c-'0'; return bb?-aa:aa; } int main(){ #define rd() ri<int>() n=rd();L=rd();T=rd(); for(int i=0;i<n;++i){ x[i]=rd();w[i]=(rd()^1)?-1:1;} c=0; for(int i=0;i<n;++i){ y[i]=x[i]+w[i]*T; if(w[i]>0){ c=(c+(x[i]+T)/L)%n; } else { c=(c-(T+L-x[i]-1)/L)%n; } c+=(c<0)?n:0; y[i]%=L;if(y[i]<0)y[i]+=L; } sort(y,y+n); for(int i=c;i<n;++i)printf("%d\n",y[i] ); for(int i=0;i<c;++i)printf("%d\n",y[i] ); return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - Sorted Arrays |
User | ssplaysecond |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 824 Byte |
Status | TLE |
Exec Time | 2103 ms |
Memory | 512 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 | 128 KB |
sample_02.txt | TLE | 2103 ms | 128 KB |
sample_03.txt | TLE | 2103 ms | 128 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 | 512 KB |
subtask_1_05.txt | TLE | 2103 ms | 512 KB |
subtask_1_06.txt | TLE | 2103 ms | 512 KB |
subtask_1_07.txt | TLE | 2103 ms | 512 KB |
subtask_1_08.txt | TLE | 2103 ms | 512 KB |
subtask_1_09.txt | TLE | 2103 ms | 512 KB |
subtask_1_10.txt | TLE | 2103 ms | 128 KB |
subtask_1_11.txt | TLE | 2103 ms | 128 KB |