Submission #1798295


Source Code Expand

#include <vector>
#include <stack>
#include <stdio.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <typeinfo>
#include <queue>
#include <set>
#include <sstream>

using namespace std;

#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).begin(),(c).end(),std::greater<int>())
static const int INFTY = (1<<21);
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;
#define MAX 200000
#define SENTINEL 10000000000
typedef long long ll;

ll L[MAX/2+2],R[MAX/2+2];

void minimum_cost(){
	//#define MAX 1000//maximum size
	//static const int MAX = 1000;
	static const int VMAX = 10000;//maximum weight
	int n, A[MAX],s,i;
	int B[MAX],T[VMAX+1];
	//cout << MAX << endl;

	cin >> n;
	s = VMAX;
	for(int i=0;i<n;i++){
		cin >> A[i];
		s = min(s,A[i]);//minimum value in A
	}
	//int ans = minimum_cost_solver(MAX);
	int ans = 0;
	bool V[MAX];
	for(i=0;i<n;i++){
		B[i]=A[i];
		V[i]=false;
	}
	sort(B,B+n);
	for(i=0;i<n;i++){
		T[B[i]]=i;//index in A, where the weight is B[i]
	}
	for(i=0;i<n;i++){
		if(V[i]) continue;//whether the index i is in an at least one loop or not
		int cur = i;//current index (ar first, start index of a loop)
		int S=0;//sum of weights in the loop
		int m=VMAX;//minimum weight in the loop
		int an = 0;//counts of the loop
		while(1){
			V[cur] = true;
			an++;
			int v = A[cur];//weight of A[current]
			m = min(m,v);
			S += v;
			cur = T[v];
			if (V[cur]) break;//index cur is in the loop
		}
		ans += min(S + (an-2)*m, m + S + (an+1)*s);
	}

	cout << ans << endl;

}

void c3_3(){
  int n,k;
  double res = 0.0;
  cin >> n >> k;
  std::vector<int> r;
  int tmp;
  REP(i,n){
    cin >> tmp;
    r.push_back(tmp);
  }
  SORT(r);
  FOR(i,n-k,n){
    res = (res + r[i]) * 0.5;
  }
  printf("%f\n",res);
  //printf("%.6f\n",res);
}

void b4(){
  char X[16];
  REP(i,16){
    cin >> X[i];
  }
  REP(i,4){
    REP(j,4){
      cout << X[15 - (i*4 + j)] << " ";
    }
    cout << endl;
  }
}

int main(){
	//countingsort();
	//mergesort_count();
	//tmp();
	//minimum_cost();
  //hoge();
  //c3_3();
  b4();
	return 0;
}

Submission Info

Submission Time
Task B - 回転
User fullflu
Language C++14 (GCC 5.4.1)
Score 100
Code Size 2325 Byte
Status AC
Exec Time 1 ms
Memory 256 KB

Judge Result

Set Name All
Score / Max Score 100 / 100
Status
AC × 30
Set Name Test Cases
All 00_sample_00.txt, 00_sample_01.txt, 01_all_dot.txt, 02_all_o.txt, 03_all_x.txt, rand_0.txt, rand_1.txt, rand_10.txt, rand_11.txt, rand_12.txt, rand_13.txt, rand_14.txt, rand_15.txt, rand_16.txt, rand_17.txt, rand_18.txt, rand_19.txt, rand_2.txt, rand_20.txt, rand_21.txt, rand_22.txt, rand_23.txt, rand_24.txt, rand_3.txt, rand_4.txt, rand_5.txt, rand_6.txt, rand_7.txt, rand_8.txt, rand_9.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 256 KB
00_sample_01.txt AC 1 ms 256 KB
01_all_dot.txt AC 1 ms 256 KB
02_all_o.txt AC 1 ms 256 KB
03_all_x.txt AC 1 ms 256 KB
rand_0.txt AC 1 ms 256 KB
rand_1.txt AC 1 ms 256 KB
rand_10.txt AC 1 ms 256 KB
rand_11.txt AC 1 ms 256 KB
rand_12.txt AC 1 ms 256 KB
rand_13.txt AC 1 ms 256 KB
rand_14.txt AC 1 ms 256 KB
rand_15.txt AC 1 ms 256 KB
rand_16.txt AC 1 ms 256 KB
rand_17.txt AC 1 ms 256 KB
rand_18.txt AC 1 ms 256 KB
rand_19.txt AC 1 ms 256 KB
rand_2.txt AC 1 ms 256 KB
rand_20.txt AC 1 ms 256 KB
rand_21.txt AC 1 ms 256 KB
rand_22.txt AC 1 ms 256 KB
rand_23.txt AC 1 ms 256 KB
rand_24.txt AC 1 ms 256 KB
rand_3.txt AC 1 ms 256 KB
rand_4.txt AC 1 ms 256 KB
rand_5.txt AC 1 ms 256 KB
rand_6.txt AC 1 ms 256 KB
rand_7.txt AC 1 ms 256 KB
rand_8.txt AC 1 ms 256 KB
rand_9.txt AC 1 ms 256 KB