Submission #3815261
Source Code Expand
#include<cstdio> #include<cstring> #include<cmath> #include<cstdlib> #include<cctype> #include<iostream> #include<string> #include<algorithm> #include<vector> #include<map> #include<stack> #include<queue> #include<set> using namespace std; typedef pair<int, int> pii; typedef double lf; typedef long long ll; const int inf=0x3f3f3f3f, mod=1000000007; int pos[100100]; inline int read() { int x=0,f=1; char ch=getchar(); for (; ch<'0' || ch>'9'; ch=getchar()) if (ch=='-') f=-1; for (; ch>='0' && ch<='9'; ch=getchar()) x=(x<<1)+(x<<3)+ch-'0'; return x*f; } int main() { int n=read(), l=read(), t=read(), start=0; for (int i=1; i<=n; i++) { pos[i]=read(); int w=read(); if (w==1) pos[i]+=t; else pos[i]-=t; start+=pos[i]/l; if (pos[i]%l<0) start--; pos[i]=(pos[i]%l+l)%l; } sort(pos+1, pos+n+1); start=(start%n+n)%n; for (int i=start+1; i<=n; i++) printf("%d\n",pos[i]); for (int i=1; i<=start; i++) printf("%d\n",pos[i]); return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Ants on a Circle |
User | chenhoujin |
Language | C++ (GCC 5.4.1) |
Score | 700 |
Code Size | 1024 Byte |
Status | AC |
Exec Time | 25 ms |
Memory | 1536 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 700 / 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 | AC | 15 ms | 1024 KB |
subtask_1_02.txt | AC | 12 ms | 768 KB |
subtask_1_03.txt | AC | 24 ms | 1536 KB |
subtask_1_04.txt | AC | 25 ms | 1536 KB |
subtask_1_05.txt | AC | 4 ms | 384 KB |
subtask_1_06.txt | AC | 6 ms | 512 KB |
subtask_1_07.txt | AC | 21 ms | 1152 KB |
subtask_1_08.txt | AC | 22 ms | 1280 KB |
subtask_1_09.txt | AC | 14 ms | 896 KB |
subtask_1_10.txt | AC | 13 ms | 768 KB |
subtask_1_11.txt | AC | 4 ms | 384 KB |
subtask_1_12.txt | AC | 21 ms | 1408 KB |
subtask_1_13.txt | AC | 15 ms | 1152 KB |
subtask_1_14.txt | AC | 14 ms | 1024 KB |
subtask_1_15.txt | AC | 1 ms | 256 KB |
subtask_1_16.txt | AC | 1 ms | 256 KB |