Submission #132142


Source Code Expand

// @snippet<sh19910711/contest-base-simple:header.cpp>
#define __THIS_IS_CPP11__
#include <iostream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <limits>
#include <cstdio>
#include <cmath>

#ifdef __THIS_IS_CPP11__
#include <memory>
#include <array>
#endif

// @snippet<sh19910711/contest-base-simple:solution/template-typedef.cpp>
namespace solution {
  typedef long long Int;
  typedef long double Double;
  typedef std::string String;
}

// @snippet<sh19910711/contest-base-simple:solution/template-constants.cpp>
namespace solution {
}

// @snippet<sh19910711/contest-base-simple:solution/template-storages.cpp>
namespace solution {
  struct Input {
    Int N;
  };
  struct Output {
    String result;
  };
}

// @snippet<sh19910711/contest-base-simple:solution/solution.cpp>
namespace solution {
  struct Solution {
    //
    // Implement here
    //
    
    Int A[40][6];

    void solve() {
      generate_a();
      out->result = get_string(in->N);
    }

    char to_char( const Int& k ) {
      return '0' + k;
    }

    String get_string( const Int& N ) {
      String res;
      for ( int i = 0; i < 6; ++ i )
        res += to_char(A[N % 30][i]);
      return res;
    }

    void generate_a() {
      for ( int i = 0; i < 6; ++ i )
        A[0][i] = i + 1;
      for ( int i = 1; i <= 30; ++ i ) {
        for ( int j = 0; j < 6; ++ j )
          A[i][j] = A[i - 1][j];
        std::swap(A[i][(i - 1) % 5], A[i][(i - 1) % 5 + 1]);
      }
    }
    
    bool input() {
      return std::cin >> in->N;
    }
    
    void output() {
      std::cout << out->result << std::endl;
    }
    
    //
    //
    //
    Solution( Input* in, Output* out ): in(in), out(out) {
      // pre calc
    }
    
    int run() {
      for (;;) {
        this->before_action(-1);
        if ( ! this->action() ) { this->after_action(-1); break; }
        this->after_action(-1);
      };
      return 0;
    }
    
    bool action() {
      if ( ! this->input() ) return false;
      this->solve();
      this->output();
      return true;
    }
    
    void before_action( const int& t_id ) {}
    
    void after_action( const int& t_id ) {}
    
    Input* in;
    Output* out;
  };
}

// @snippet<sh19910711/contest-base-simple:main_func.cpp>
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  using namespace solution;
  static Input in;
  static Output out;
  static Solution sol(&in, &out);
  return sol.run();
}

// @snippet<sh19910711/contest-base-simple:main.cpp>

Submission Info

Submission Time
Task C - 入れ替え
User sh19910711
Language C++11 (GCC 4.8.1)
Score 100
Code Size 2751 Byte
Status AC
Exec Time 24 ms
Memory 936 KB

Judge Result

Set Name Subtask1 Subtask2
Score / Max Score 30 / 30 70 / 70
Status
AC × 13
AC × 27
Set Name Test Cases
Subtask1 SubTask1/00_sample_00.txt, SubTask1/00_sample_01.txt, SubTask1/00_sample_02.txt, SubTask1/rand_19.txt, SubTask1/rand_2.txt, SubTask1/rand_25.txt, SubTask1/rand_27.txt, SubTask1/rand_33.txt, SubTask1/rand_35.txt, SubTask1/rand_4.txt, SubTask1/rand_44.txt, SubTask1/rand_48.txt, SubTask1/rand_8.txt
Subtask2 SubTask2/00_sample_03.txt, SubTask2/max_case.txt, SubTask2/rand_120009641.txt, SubTask2/rand_134230520.txt, SubTask2/rand_136939465.txt, SubTask2/rand_200732473.txt, SubTask2/rand_211796835.txt, SubTask2/rand_312330341.txt, SubTask2/rand_377341731.txt, SubTask2/rand_384611280.txt, SubTask2/rand_386098102.txt, SubTask2/rand_399010727.txt, SubTask2/rand_409627453.txt, SubTask2/rand_416537730.txt, SubTask2/rand_425486442.txt, SubTask2/rand_493135174.txt, SubTask2/rand_573105326.txt, SubTask2/rand_62794810.txt, SubTask2/rand_649471654.txt, SubTask2/rand_693017484.txt, SubTask2/rand_729197057.txt, SubTask2/rand_759630883.txt, SubTask2/rand_823752210.txt, SubTask2/rand_830399384.txt, SubTask2/rand_893242387.txt, SubTask2/rand_935005824.txt, SubTask2/rand_989703310.txt
Case Name Status Exec Time Memory
SubTask1/00_sample_00.txt AC 22 ms 808 KB
SubTask1/00_sample_01.txt AC 20 ms 804 KB
SubTask1/00_sample_02.txt AC 21 ms 812 KB
SubTask1/rand_19.txt AC 21 ms 804 KB
SubTask1/rand_2.txt AC 21 ms 812 KB
SubTask1/rand_25.txt AC 19 ms 804 KB
SubTask1/rand_27.txt AC 21 ms 804 KB
SubTask1/rand_33.txt AC 21 ms 936 KB
SubTask1/rand_35.txt AC 21 ms 804 KB
SubTask1/rand_4.txt AC 20 ms 808 KB
SubTask1/rand_44.txt AC 21 ms 936 KB
SubTask1/rand_48.txt AC 21 ms 804 KB
SubTask1/rand_8.txt AC 20 ms 812 KB
SubTask2/00_sample_03.txt AC 20 ms 932 KB
SubTask2/max_case.txt AC 20 ms 804 KB
SubTask2/rand_120009641.txt AC 21 ms 760 KB
SubTask2/rand_134230520.txt AC 21 ms 932 KB
SubTask2/rand_136939465.txt AC 20 ms 804 KB
SubTask2/rand_200732473.txt AC 21 ms 804 KB
SubTask2/rand_211796835.txt AC 21 ms 924 KB
SubTask2/rand_312330341.txt AC 23 ms 804 KB
SubTask2/rand_377341731.txt AC 21 ms 928 KB
SubTask2/rand_384611280.txt AC 21 ms 804 KB
SubTask2/rand_386098102.txt AC 21 ms 804 KB
SubTask2/rand_399010727.txt AC 21 ms 808 KB
SubTask2/rand_409627453.txt AC 21 ms 808 KB
SubTask2/rand_416537730.txt AC 21 ms 932 KB
SubTask2/rand_425486442.txt AC 21 ms 804 KB
SubTask2/rand_493135174.txt AC 23 ms 800 KB
SubTask2/rand_573105326.txt AC 23 ms 796 KB
SubTask2/rand_62794810.txt AC 20 ms 796 KB
SubTask2/rand_649471654.txt AC 21 ms 928 KB
SubTask2/rand_693017484.txt AC 24 ms 760 KB
SubTask2/rand_729197057.txt AC 24 ms 768 KB
SubTask2/rand_759630883.txt AC 21 ms 932 KB
SubTask2/rand_823752210.txt AC 21 ms 800 KB
SubTask2/rand_830399384.txt AC 22 ms 924 KB
SubTask2/rand_893242387.txt AC 24 ms 804 KB
SubTask2/rand_935005824.txt AC 21 ms 924 KB
SubTask2/rand_989703310.txt AC 22 ms 796 KB