Submission #2233318


Source Code Expand

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

int main(){
	int n,m,d,dtmp;
	int one[100100]={},r[30][100100]={};
	cin>>n>>m>>dtmp;
	FORQ(i,1,n)r[0][i]=i;
	FOR(i,0,m){
		int a;
		cin>>a;
		swap(r[0][a],r[0][a+1]);
	}
	FORQ(i,1,n)one[r[0][i]]=i;
	//FORQ(i,1,n)cout<<r[i]<<endl;
	FORQ(i,1,n)r[0][i]=one[i];
	FORQ(i,1,n)FOR(j,0,30){
		r[j+1][i]=r[j][r[j][i]];
	}
	FORQ(i,1,n){
		int now=i;
		FOR(j,0,30){
			if(d&(1<<j)!=0){
				now=r[j][now];
			}
		}
		cout<<now<<endl;
	}

    return 0;
}

Submission Info

Submission Time
Task D - 阿弥陀
User kt_tenel
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1459 Byte
Status RE
Exec Time 172 ms
Memory 12416 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:52:26: warning: iteration 29u invokes undefined behavior [-Waggressive-loop-optimizations]
   r[j+1][i]=r[j][r[j][i]];
                          ^
./Main.cpp:22:35: note: containing loop
 #define FOR(i,b,e) for(int i=(b);i<(e);++i)
                                   ^
./Main.cpp:51:13: note: in expansion of macro ‘FOR’
  FORQ(i,1,n)FOR(j,0,30){
             ^

Judge Result

Set Name Subtask1 Subtask2 Subtask3 Subtask4
Score / Max Score 0 / 10 0 / 20 0 / 20 0 / 50
Status
AC × 1
WA × 3
RE × 5
AC × 1
WA × 3
RE × 14
AC × 8
WA × 10
WA × 2
RE × 27
Set Name Test Cases
Subtask1 sample_1.txt, 01_i.txt, 01_random01.txt, 01_random02.txt, 01_random03.txt, 01_random04.txt, 01_random05.txt, 01_random06.txt, 01_random07.txt
Subtask2 sample_1.txt, sample_2.txt, sample_3.txt, 02_i.txt, 02_p.txt, 02_random01.txt, 02_random02.txt, 02_random03.txt, 02_random04.txt, 02_random05.txt, 02_random06.txt, 02_random07.txt, 02_random08.txt, 02_rp01.txt, 02_rp02.txt, 02_rp03.txt, 02_rp04.txt, 02_rp05.txt
Subtask3 sample_1.txt, sample_2.txt, 03_i.txt, 03_random01.txt, 03_random02.txt, 03_random03.txt, 03_random04.txt, 03_random05.txt, 03_random06.txt, 03_random07.txt, 03_random08.txt, 03_random09.txt, 03_random10.txt, 03_random11.txt, 03_random12.txt, 03_random13.txt, 03_random14.txt, 03_random15.txt
Subtask4 sample_1.txt, sample_2.txt, sample_3.txt, 04_i.txt, 04_p1.txt, 04_p2.txt, 04_random01.txt, 04_random02.txt, 04_random03.txt, 04_random04.txt, 04_random05.txt, 04_random06.txt, 04_random07.txt, 04_random08.txt, 04_random09.txt, 04_random10.txt, 04_random11.txt, 04_random12.txt, 04_random13.txt, 04_rp01.txt, 04_rp02.txt, 04_rp03.txt, 04_rp04.txt, 04_rp05.txt, 04_rp06.txt, 04_rp07.txt, 04_rp08.txt, 04_rp09.txt, 04_rp10.txt
Case Name Status Exec Time Memory
01_i.txt RE 169 ms 12416 KB
01_random01.txt AC 4 ms 12416 KB
01_random02.txt WA 5 ms 12416 KB
01_random03.txt WA 4 ms 12416 KB
01_random04.txt RE 101 ms 12416 KB
01_random05.txt RE 110 ms 12416 KB
01_random06.txt RE 152 ms 12416 KB
01_random07.txt RE 168 ms 12416 KB
02_i.txt RE 101 ms 12416 KB
02_p.txt RE 100 ms 12416 KB
02_random01.txt AC 4 ms 12416 KB
02_random02.txt WA 4 ms 12416 KB
02_random03.txt RE 100 ms 12416 KB
02_random04.txt RE 101 ms 12416 KB
02_random05.txt RE 105 ms 12416 KB
02_random06.txt RE 123 ms 12416 KB
02_random07.txt RE 152 ms 12416 KB
02_random08.txt RE 150 ms 12288 KB
02_rp01.txt RE 100 ms 12416 KB
02_rp02.txt RE 99 ms 12416 KB
02_rp03.txt RE 101 ms 12288 KB
02_rp04.txt RE 101 ms 12416 KB
02_rp05.txt RE 100 ms 12416 KB
03_i.txt AC 4 ms 12416 KB
03_random01.txt AC 7 ms 12416 KB
03_random02.txt WA 38 ms 12416 KB
03_random03.txt AC 34 ms 12416 KB
03_random04.txt WA 31 ms 12416 KB
03_random05.txt AC 10 ms 12416 KB
03_random06.txt AC 9 ms 12416 KB
03_random07.txt WA 12 ms 12416 KB
03_random08.txt AC 5 ms 12416 KB
03_random09.txt AC 14 ms 12416 KB
03_random10.txt WA 23 ms 12416 KB
03_random11.txt WA 36 ms 12416 KB
03_random12.txt WA 37 ms 12416 KB
03_random13.txt WA 30 ms 12416 KB
03_random14.txt WA 24 ms 12416 KB
03_random15.txt AC 12 ms 12416 KB
04_i.txt RE 167 ms 12416 KB
04_p1.txt RE 133 ms 12288 KB
04_p2.txt RE 125 ms 12416 KB
04_random01.txt RE 135 ms 12416 KB
04_random02.txt RE 114 ms 12416 KB
04_random03.txt RE 130 ms 12416 KB
04_random04.txt RE 156 ms 12416 KB
04_random05.txt RE 146 ms 12416 KB
04_random06.txt RE 129 ms 12416 KB
04_random07.txt RE 163 ms 12416 KB
04_random08.txt RE 154 ms 12288 KB
04_random09.txt RE 162 ms 12416 KB
04_random10.txt RE 119 ms 12416 KB
04_random11.txt RE 172 ms 12416 KB
04_random12.txt RE 168 ms 12416 KB
04_random13.txt RE 169 ms 12288 KB
04_rp01.txt RE 134 ms 12416 KB
04_rp02.txt RE 133 ms 12416 KB
04_rp03.txt RE 138 ms 12416 KB
04_rp04.txt RE 134 ms 12416 KB
04_rp05.txt RE 133 ms 12416 KB
04_rp06.txt RE 134 ms 12416 KB
04_rp07.txt RE 134 ms 12416 KB
04_rp08.txt RE 134 ms 12288 KB
04_rp09.txt RE 133 ms 12416 KB
04_rp10.txt RE 134 ms 12416 KB
sample_1.txt WA 4 ms 12416 KB
sample_2.txt WA 4 ms 12416 KB
sample_3.txt RE 99 ms 12416 KB