Submission #2116366
Source Code Expand
#include <iostream> #include<vector> #include<algorithm> #include<queue> using namespace std; #define rep(i,n) for(int i=0;i<(int)(n);i++) #define REP(i,m,n) for(int i=m;i<(int)(n);i++) typedef pair<int,int> pint; typedef long long ll; const int inf = 1<<30; const int mod=1000000007; int edge[100001]; bool used[100001]; int cnt; vector<int> v; void dfs (int i){ used[i]=true; v.push_back(i); cnt++; if(!used[edge[i]])dfs(edge[i]); } int main(){ int n;cin>>n; double x[n]; rep(i,n)cin>>x[i]; rep(i,n-1)edge[i]=i; int m,k; cin>>m>>k; int a[m]; rep(i,m){ cin>>a[i]; swap(edge[a[i]-2],edge[a[i]-1]); } rep(i,n-1)used[i]=false; int dist[n-1]; rep(i,n-1){ if(!used[i]){ v.clear(); cnt=0; dfs(i); int r=k%cnt; rep(j,cnt){ int fin=(j+r)%cnt; dist[v[j]]=x[v[fin]+1]-x[v[fin]]; } } } int ans=x[0]; cout<<x[0]<<endl; rep(i,n-1){ ans+=dist[i]; cout<<ans<<endl; } return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Rabbit Exercise |
User | tempura0224 |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1066 Byte |
Status | RE |
Exec Time | 161 ms |
Memory | 1408 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 800 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 0_00.txt, 0_01.txt, 0_02.txt |
All | 0_00.txt, 0_01.txt, 0_02.txt, 1_00.txt, 1_01.txt, 1_02.txt, 1_03.txt, 1_04.txt, 1_05.txt, 1_06.txt, 1_07.txt, 1_08.txt, 1_09.txt, 1_10.txt, 1_11.txt, 1_12.txt, 1_13.txt, 1_14.txt, 1_15.txt, 1_16.txt, 1_17.txt, 1_18.txt, 1_19.txt, 1_20.txt, 1_21.txt, 1_22.txt, 1_23.txt, 1_24.txt, 1_25.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
0_00.txt | AC | 1 ms | 256 KB |
0_01.txt | AC | 1 ms | 256 KB |
0_02.txt | AC | 1 ms | 256 KB |
1_00.txt | RE | 98 ms | 256 KB |
1_01.txt | RE | 97 ms | 256 KB |
1_02.txt | RE | 159 ms | 1408 KB |
1_03.txt | RE | 161 ms | 1408 KB |
1_04.txt | RE | 142 ms | 1024 KB |
1_05.txt | RE | 100 ms | 256 KB |
1_06.txt | RE | 101 ms | 256 KB |
1_07.txt | RE | 102 ms | 256 KB |
1_08.txt | RE | 101 ms | 256 KB |
1_09.txt | RE | 101 ms | 256 KB |
1_10.txt | RE | 99 ms | 256 KB |
1_11.txt | RE | 101 ms | 256 KB |
1_12.txt | RE | 99 ms | 256 KB |
1_13.txt | RE | 98 ms | 256 KB |
1_14.txt | RE | 98 ms | 256 KB |
1_15.txt | RE | 104 ms | 384 KB |
1_16.txt | RE | 100 ms | 256 KB |
1_17.txt | RE | 122 ms | 768 KB |
1_18.txt | RE | 130 ms | 896 KB |
1_19.txt | RE | 140 ms | 1024 KB |
1_20.txt | RE | 110 ms | 512 KB |
1_21.txt | RE | 116 ms | 512 KB |
1_22.txt | RE | 140 ms | 1024 KB |
1_23.txt | RE | 149 ms | 1280 KB |
1_24.txt | RE | 136 ms | 1024 KB |
1_25.txt | RE | 120 ms | 1408 KB |