Submission #433926
Source Code Expand
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <bitset>
using namespace std;
typedef pair<int, int> pos;
struct ten {
int bd[3][3];
};
struct ans {
int ten[2];
int bd[3][3];
int te;
};
ten b, c;
ans cao(ans aaa);
int main(){
for ( int x = 0; x < 3; x++ )
for ( int y = 0; y < 2; y++ ){
int b_;
cin >> b_;
b.bd[x][y] = b_;
}
for ( int x = 0; x < 3; x++ )
for ( int y = 0; y < 2; y++ ){
int c_;
cin >> c_;
c.bd[x][y] = c_;
}
ans answer;
answer.ten[0] = 0;
answer.ten[1] = 0;
for ( int x = 0; x < 3; x++ )
for ( int y = 0; y < 3; y++ )
answer.bd[x][y] = -1;
answer.te = 0;
answer = cao(answer);
cout << answer.ten[0] << endl << answer.ten[1] << endl;
return 0;
}
ans cao(ans a){
ans max = a;
a.te++;
for ( int x = 0; x < 3; x++ )
for ( int y = 0; y < 3; y++ )
{
int player = a.te % 2;
if ( a.bd[x][y] == -1 ){
for ( int i = 0; i < 2; i++ )
{
ans temp = a;
temp.te++;
temp.bd[x][y] = i;
if ( y < 2 ){
if ( temp.bd[x][y] == temp.bd[x][y + 1] )
temp.ten[0] += b.bd[x][y];
else
temp.ten[1] += b.bd[x][y];
}
if ( x < 2 ){
if ( temp.bd[x][y] == temp.bd[x + 1][y] )
temp.ten[0] += c.bd[x][y];
else
temp.ten[1] += c.bd[x][y];
}
temp = cao(temp);
if ( temp.ten[player] > max.ten[player] )max = temp;
}
}
}
return max;
}//´・ω・`
Submission Info
| Submission Time | |
|---|---|
| Task | C - 双子と○×ゲーム |
| User | toikage |
| Language | C++14 (Clang++ 3.4) |
| Score | 0 |
| Code Size | 1518 Byte |
| Status | TLE |
| Exec Time | 2060 ms |
| Memory | 928 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 0 / 100 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | sample-01.txt, sample-02.txt |
| All | test-01.txt, test-02.txt, test-03.txt, test-04.txt, test-05.txt, test-06.txt, test-07.txt, test-08.txt, test-09.txt, test-10.txt, test-11.txt, test-12.txt, test-13.txt, test-14.txt, test-15.txt, test-16.txt, test-17.txt, test-18.txt, test-19.txt, test-20.txt, sample-01.txt, sample-02.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| sample-01.txt | TLE | 2031 ms | 808 KiB |
| sample-02.txt | TLE | 2032 ms | 800 KiB |
| test-01.txt | TLE | 2060 ms | 808 KiB |
| test-02.txt | TLE | 2032 ms | 804 KiB |
| test-03.txt | TLE | 2032 ms | 856 KiB |
| test-04.txt | TLE | 2032 ms | 916 KiB |
| test-05.txt | TLE | 2033 ms | 800 KiB |
| test-06.txt | TLE | 2032 ms | 800 KiB |
| test-07.txt | TLE | 2032 ms | 816 KiB |
| test-08.txt | TLE | 2033 ms | 808 KiB |
| test-09.txt | TLE | 2032 ms | 808 KiB |
| test-10.txt | TLE | 2032 ms | 804 KiB |
| test-11.txt | TLE | 2032 ms | 800 KiB |
| test-12.txt | TLE | 2033 ms | 796 KiB |
| test-13.txt | TLE | 2033 ms | 928 KiB |
| test-14.txt | TLE | 2033 ms | 860 KiB |
| test-15.txt | TLE | 2033 ms | 860 KiB |
| test-16.txt | TLE | 2032 ms | 804 KiB |
| test-17.txt | TLE | 2033 ms | 920 KiB |
| test-18.txt | TLE | 2032 ms | 928 KiB |
| test-19.txt | TLE | 2032 ms | 860 KiB |
| test-20.txt | TLE | 2032 ms | 924 KiB |