Submission #131886


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 {
    String S[4][4];
  };
  struct Output {
    String S[4][4];
  };
}

// @snippet<sh19910711/contest-base-simple:solution/solution.cpp>
namespace solution {
  struct Solution {
    //
    // Implement here
    //
    void solve() {
      for ( auto i = 0; i < 4; ++ i ) {
        for ( auto j = 0; j < 4; ++ j ) {
          out->S[4 - i - 1][4 - j - 1] = in->S[i][j];
        }
      }
    }
    
    bool input() {
      for ( auto i = 0; i < 4; ++ i )
        for ( auto j = 0; j < 4; ++ j )
          if ( ! ( std::cin >> in->S[i][j] ) )
            return false;
      return true;
    }
    
    void output() {
      for ( auto i = 0; i < 4; ++ i ) {
        for ( auto j = 0; j < 4; ++ j ) {
          std::cout << out->S[i][j];
          if ( j + 1 < 4 )
            std::cout << " ";
        }
        std::cout << 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 B - 回転
User sh19910711
Language C++11 (GCC 4.8.1)
Score 100
Code Size 2644 Byte
Status AC
Exec Time 26 ms
Memory 928 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 26 ms 848 KB
00_sample_01.txt AC 23 ms 796 KB
01_all_dot.txt AC 22 ms 924 KB
02_all_o.txt AC 24 ms 924 KB
03_all_x.txt AC 22 ms 924 KB
rand_0.txt AC 24 ms 892 KB
rand_1.txt AC 24 ms 928 KB
rand_10.txt AC 23 ms 728 KB
rand_11.txt AC 22 ms 732 KB
rand_12.txt AC 23 ms 844 KB
rand_13.txt AC 22 ms 844 KB
rand_14.txt AC 22 ms 924 KB
rand_15.txt AC 24 ms 916 KB
rand_16.txt AC 23 ms 728 KB
rand_17.txt AC 22 ms 736 KB
rand_18.txt AC 22 ms 924 KB
rand_19.txt AC 22 ms 924 KB
rand_2.txt AC 22 ms 920 KB
rand_20.txt AC 22 ms 928 KB
rand_21.txt AC 22 ms 924 KB
rand_22.txt AC 20 ms 836 KB
rand_23.txt AC 23 ms 924 KB
rand_24.txt AC 22 ms 844 KB
rand_3.txt AC 24 ms 888 KB
rand_4.txt AC 22 ms 732 KB
rand_5.txt AC 22 ms 924 KB
rand_6.txt AC 21 ms 920 KB
rand_7.txt AC 22 ms 924 KB
rand_8.txt AC 24 ms 920 KB
rand_9.txt AC 22 ms 924 KB