第2回早稲田大学プログラミングコンテスト

Submission #1757988

Source codeソースコード

#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 3000000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)                                                                             
#define seg_size 524288
int main() {
	int n, m;
	cin >> n >> m;
	vector<string> s;
	string a;
	REP(i, m + 2) {
		a.push_back('X');
	}
	s.push_back(a);
	for (int i = 0;i < n;++i) {
		string b;
		cin >> b;
		s.push_back('X' + b + 'X');
	}
	s.push_back(a);
	long long ans = 0;
	for (int i = 0;i < n;++i) {
		for (int q = 0;q < m;++q) {
			long long tmp = 0;
			for (int j = 0;j >= 0;++j) {
				for (int t = 0;t <= j;++t) {
					if (s[i + j - t][q + t] == 'X') goto foo;
					tmp += s[i+j-t][q+t] - '0';
				}
				ans = max(ans, tmp);
			}
		foo:;
			tmp = 0;
			for (int j = 0;j >= 0;++j) {
				for (int t = 0;t <= j;++t) {
					if (s[i + t][q + j - t] == 'X') goto foo2;
					tmp += s[i + t][q + j-t] - '0';
				}
				ans = max(ans, tmp);
			}
		foo2:;
			tmp = 0;
			for (int j = 0;j >= 0;++j) {
				for (int t = 0;t <= j;++t) {
					if (s[i - t][q + j - t] == 'X') goto foo3;
					tmp += s[i - t][q + j - t] - '0';
				}
				ans = max(ans, tmp);
			}
		foo3:;
			tmp = 0;
			for (int j = 0;j >= 0;++j) {
				for (int t = 0;t <= j;++t) {
					if (s[i + j - t][q - t] == 'X') goto foo4;
					tmp += s[i + j - t][q - t] - '0';
				}
				ans = max(ans, tmp);
			}
		foo4:;
		}
	}
	cout << ans << endl;
	return 0;
}

Submission

Task問題 C - 至高のケーキ
User nameユーザ名 kotamanegi
Created time投稿日時
Language言語 C++14 (GCC 5.4.1)
Status状態 WA
Score得点 0
Source lengthソースコード長 2139 Byte
File nameファイル名
Exec time実行時間 ms
Memory usageメモリ使用量 -

Test case

Set

Set name Score得点 / Max score Cases
All 0 / 75 case_000.txt,case_001.txt,case_002.txt,case_003.txt,case_004.txt,case_005.txt,case_006.txt,case_007.txt,case_008.txt,case_009.txt,case_010.txt,case_011.txt,case_012.txt,case_013.txt,case_014.txt,case_015.txt,case_016.txt,case_017.txt,case_018.txt,case_019.txt,case_020.txt,case_021.txt,case_022.txt,case_023.txt,case_024.txt,case_025.txt,case_026.txt,case_027.txt,case_028.txt,case_029.txt,case_030.txt,case_031.txt,case_032.txt,case_033.txt,case_034.txt,case_035.txt,case_036.txt,case_037.txt,case_038.txt,case_039.txt,case_040.txt,case_041.txt,case_042.txt,case_043.txt,case_044.txt,case_045.txt,case_046.txt,case_047.txt,case_048.txt,case_049.txt,case_050.txt,case_051.txt,case_052.txt,case_053.txt,case_054.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
case_000.txt AC 1 ms 256 KB
case_001.txt AC 1 ms 256 KB
case_002.txt WA
case_003.txt AC 1 ms 256 KB
case_004.txt AC 1 ms 256 KB
case_005.txt WA
case_006.txt WA
case_007.txt WA
case_008.txt WA
case_009.txt WA
case_010.txt AC 2 ms 256 KB
case_011.txt AC 2 ms 256 KB
case_012.txt WA
case_013.txt WA
case_014.txt WA
case_015.txt AC 1 ms 256 KB
case_016.txt WA
case_017.txt AC 1 ms 256 KB
case_018.txt AC 1 ms 256 KB
case_019.txt AC 1 ms 256 KB
case_020.txt AC 1 ms 256 KB
case_021.txt AC 1 ms 256 KB
case_022.txt AC 1 ms 256 KB
case_023.txt AC 1 ms 256 KB
case_024.txt WA
case_025.txt WA
case_026.txt AC 1 ms 256 KB
case_027.txt AC 1 ms 256 KB
case_028.txt WA
case_029.txt AC 1 ms 256 KB
case_030.txt AC 1 ms 256 KB
case_031.txt AC 1 ms 256 KB
case_032.txt WA
case_033.txt AC 1 ms 256 KB
case_034.txt AC 1 ms 256 KB
case_035.txt WA
case_036.txt WA
case_037.txt WA
case_038.txt WA
case_039.txt WA
case_040.txt AC 1 ms 256 KB
case_041.txt WA
case_042.txt AC 1 ms 256 KB
case_043.txt WA
case_044.txt AC 1 ms 256 KB
case_045.txt AC 1 ms 256 KB
case_046.txt WA
case_047.txt WA
case_048.txt AC 1 ms 256 KB
case_049.txt AC 1 ms 256 KB
case_050.txt AC 1 ms 256 KB
case_051.txt AC 1 ms 256 KB
case_052.txt AC 1 ms 256 KB
case_053.txt WA
case_054.txt AC 2 ms 256 KB