Submission #213915


Source Code Expand

Copy
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <climits>
#include <cassert>
using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> pii;
typedef long long ll;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define fi first
#define se second

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define foreach(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int dx[] = {-1,1,0,0};
const int dy[] = {0,0,1,-1};

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int n, m, d;
int now[100010], to[100010];
int cur[100010];
int nt[100010], nc[100010];

int main(){
    scanf("%d %d %d", &n, &m, &d);
    rep(i, n) now[i] = cur[i] = i;

    rep(i, m){
	int x;
	scanf("%d", &x);
	swap(now[x-1], now[x]);
    }

    rep(i, n) to[now[i]] = i;

    //rep(i, n) cout << to[i] << endl;

    while(d){
	if(d & 1){
	    rep(i, n) nc[i] = to[cur[i]];
	    rep(i, n) cur[i] = nc[i];
	}

	rep(i, n) nt[i] = to[to[i]];
	rep(i, n) to[i] = nt[i];
	d /= 2;
    }

    rep(i, n) printf("%d\n", cur[i] + 1);
    return 0;
}

Submission Info

Submission Time
Task D - 阿弥陀
User satashun
Language C++ (G++ 4.6.4)
Score 100
Code Size 2700 Byte
Status AC
Exec Time 210 ms
Memory 3316 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:85:34: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
./Main.cpp:90:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]

Judge Result

Set Name Subtask1 Subtask2 Subtask3 Subtask4
Score / Max Score 10 / 10 20 / 20 20 / 20 50 / 50
Status
AC × 9
AC × 18
AC × 18
AC × 29
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 AC 82 ms 3248 KB
01_random01.txt AC 22 ms 808 KB
01_random02.txt AC 22 ms 804 KB
01_random03.txt AC 22 ms 928 KB
01_random04.txt AC 25 ms 864 KB
01_random05.txt AC 44 ms 3240 KB
01_random06.txt AC 64 ms 3240 KB
01_random07.txt AC 72 ms 3240 KB
02_i.txt AC 20 ms 920 KB
02_p.txt AC 22 ms 804 KB
02_random01.txt AC 19 ms 800 KB
02_random02.txt AC 21 ms 928 KB
02_random03.txt AC 21 ms 928 KB
02_random04.txt AC 24 ms 772 KB
02_random05.txt AC 22 ms 924 KB
02_random06.txt AC 33 ms 804 KB
02_random07.txt AC 47 ms 800 KB
02_random08.txt AC 47 ms 928 KB
02_rp01.txt AC 21 ms 928 KB
02_rp02.txt AC 21 ms 792 KB
02_rp03.txt AC 20 ms 928 KB
02_rp04.txt AC 20 ms 800 KB
02_rp05.txt AC 20 ms 924 KB
03_i.txt AC 21 ms 800 KB
03_random01.txt AC 23 ms 924 KB
03_random02.txt AC 42 ms 924 KB
03_random03.txt AC 39 ms 800 KB
03_random04.txt AC 41 ms 920 KB
03_random05.txt AC 25 ms 928 KB
03_random06.txt AC 24 ms 800 KB
03_random07.txt AC 26 ms 924 KB
03_random08.txt AC 21 ms 804 KB
03_random09.txt AC 29 ms 748 KB
03_random10.txt AC 31 ms 928 KB
03_random11.txt AC 42 ms 924 KB
03_random12.txt AC 42 ms 800 KB
03_random13.txt AC 38 ms 928 KB
03_random14.txt AC 34 ms 924 KB
03_random15.txt AC 26 ms 932 KB
04_i.txt AC 82 ms 3244 KB
04_p1.txt AC 65 ms 3316 KB
04_p2.txt AC 57 ms 2720 KB
04_random01.txt AC 53 ms 2144 KB
04_random02.txt AC 43 ms 1896 KB
04_random03.txt AC 37 ms 1052 KB
04_random04.txt AC 50 ms 988 KB
04_random05.txt AC 48 ms 1120 KB
04_random06.txt AC 52 ms 2216 KB
04_random07.txt AC 61 ms 1700 KB
04_random08.txt AC 56 ms 1504 KB
04_random09.txt AC 57 ms 1180 KB
04_random10.txt AC 47 ms 2276 KB
04_random11.txt AC 210 ms 3312 KB
04_random12.txt AC 80 ms 3236 KB
04_random13.txt AC 79 ms 3232 KB
04_rp01.txt AC 64 ms 3236 KB
04_rp02.txt AC 62 ms 3240 KB
04_rp03.txt AC 64 ms 3240 KB
04_rp04.txt AC 63 ms 3236 KB
04_rp05.txt AC 63 ms 3244 KB
04_rp06.txt AC 64 ms 3236 KB
04_rp07.txt AC 64 ms 3236 KB
04_rp08.txt AC 63 ms 3232 KB
04_rp09.txt AC 64 ms 3240 KB
04_rp10.txt AC 65 ms 3244 KB
sample_1.txt AC 21 ms 932 KB
sample_2.txt AC 20 ms 808 KB
sample_3.txt AC 21 ms 804 KB