This repository has been archived by the owner on Sep 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
問題: Saitama Venice University #22
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
981b519
create problem saitama-venice-university
a01sa01to 1943b23
chmod
a01sa01to c1d0551
サンプル忘れ
a01sa01to 1fef701
fix
a01sa01to 2f59075
update
a01sa01to d532506
fix testset id
a01sa01to 9925c45
update pid
a01sa01to 7ae7eef
update sample2
a01sa01to File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# -*- coding: utf-8; mode: python -*- | ||
|
||
pid='a' | ||
|
||
problem( | ||
time_limit=2.0, | ||
id=pid, | ||
title= "Saitama Venice University", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
# Saitama Venice University | ||
|
||
実行時間制限:2 sec | ||
|
||
## 問題文 | ||
|
||
埼玉大学の敷地は、 $H \times W$ マスで表現されます。 | ||
ある日、大雨により敷地に雨が溜まってしまいました。 | ||
マス $(i, j)$ には、 $A_{i, j}$ cm の雨が溜まっています。 ($1 \le i \le H, 1 \le j \le W$) | ||
|
||
Asa さんはそんな状況を知り、濡れないよう長靴を履いてくることにしました。 | ||
長さ $L$ の長靴を履いていると、 $L$ cm 以下の雨が溜まっているマスに入ることができます。 | ||
|
||
すべてのマスに立ち入ることができるように、Asa さんが履くべき長靴の最小の長さを求めてください。 | ||
|
||
## 制約 | ||
|
||
- $1 \le H, W \le 1000$ | ||
- $0 \le A_{i, j} \le 10^9$ | ||
- 入力は全て整数である。 | ||
|
||
## 部分点 | ||
|
||
この問題に部分点は設定されていません。 | ||
|
||
## 入力 | ||
|
||
入力は以下の形式で標準入力から与えられる。 | ||
|
||
$H$ $W$ <br> | ||
$A_{1, 1}$ $A_{1, 2}$ ... $A_{1, W}$ <br> | ||
$A_{2, 1}$ $A_{2, 2}$ ... $A_{2, W}$ <br> | ||
... <br> | ||
$A_{H, 1}$ $A_{H, 2}$ ... $A_{H, W}$ <br> | ||
|
||
## 出力 | ||
|
||
Asa さんが履くべき長靴の最小の長さを 1 行で出力せよ。 | ||
|
||
## サンプル | ||
|
||
### 1 | ||
|
||
```txt | ||
2 2 | ||
1 2 | ||
3 1 | ||
``` | ||
|
||
```txt | ||
3 | ||
``` | ||
|
||
Asa さんは長さ 3 の長靴を履いていれば、すべてのマスに立ち入ることができます。 | ||
長さ 2 以下の長靴では立ち入ることができないマスがあるため、長さ 3 が答えとなります。 | ||
|
||
### 2 | ||
|
||
```txt | ||
4 4 | ||
0 0 0 0 | ||
0 0 0 0 | ||
0 0 0 0 | ||
0 0 0 0 | ||
``` | ||
|
||
```txt | ||
0 | ||
``` | ||
|
||
雨が溜まっていないこともあります。 | ||
このとき、求める長靴の長さは 0 となります。 | ||
|
||
### 3 | ||
|
||
```txt | ||
3 2 | ||
46513 43287 | ||
0 213 | ||
51384 1000000000 | ||
``` | ||
|
||
```txt | ||
1000000000 | ||
``` | ||
|
||
Asa さんと長靴は巨大です。 | ||
|
||
## 解法 | ||
|
||
- `sol-cpp-ac` : C++ AC | ||
- `sol-cpy-ac` : CPython AC | ||
- `sol-pypy-ac` : PyPy AC | ||
|
||
$A_{i, j}$ の値の max を出力するだけ。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# -*- coding: utf-8; mode: python -*- | ||
cxx_solution(src='main.cc', flags=["-std=c++2a", "-O2"]) | ||
expected_score(100) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#include <bits/stdc++.h> | ||
using namespace std; | ||
using ll = long long; | ||
#define rep(i, n) for (int i = 0; i < (n); ++i) | ||
|
||
int main() { | ||
int h, w; | ||
cin >> h >> w; | ||
vector a(h, vector<int>(w)); | ||
rep(i, h) rep(j, w) cin >> a[i][j]; | ||
int ans = 0; | ||
rep(i, h) rep(j, w) ans = max(ans, a[i][j]); | ||
cout << ans << endl; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# -*- coding: utf-8; mode: python -*- | ||
script_solution(src='main.py') | ||
expected_score(100) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/python3 | ||
|
||
h, w = map(int, input().split()) | ||
a = [list(map(int, input().split())) for _ in range(h)] | ||
print(max([max(x) for x in a])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# -*- coding: utf-8; mode: python -*- | ||
script_solution(src='main.py') | ||
expected_score(100) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/env pypy | ||
|
||
h, w = map(int, input().split()) | ||
a = [list(map(int, input().split())) for _ in range(h)] | ||
print(max([max(x) for x in a])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
2 2 | ||
1 2 | ||
3 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
4 4 | ||
0 0 0 0 | ||
0 0 0 0 | ||
0 0 0 0 | ||
0 0 0 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
3 2 | ||
46513 43287 | ||
0 213 | ||
51384 1000000000 |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
1 1 | ||
0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
1 1 | ||
1000000000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
1 1 | ||
526838792 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# -*- coding: utf-8; mode: python -*- | ||
cxx_validator(src="validator.cc", dependency=["testlib.h"], flags=["-std=c++2a", "-O2"]) | ||
cxx_judge( | ||
src="judge.cc", | ||
dependency=["testlib.h"], | ||
variant=testlib_judge_runner, | ||
flags=["-std=c++2a", "-O2"], | ||
) | ||
subtask_testset(name="All", score=100, input_patterns=["*_all.in"]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
filenames=( | ||
"01_random00_all.in" | ||
"01_random01_all.in" | ||
"01_random02_all.in" | ||
"01_random03_all.in" | ||
"01_random04_all.in" | ||
"02_hand00_all.in" | ||
"02_hand01_all.in" | ||
"03_min00_all.in" | ||
"03_min01_all.in" | ||
"03_min02_all.in" | ||
"03_max00_all.in" | ||
"03_max01_all.in" | ||
"03_max02_all.in" | ||
"03_max03_all.in" | ||
) | ||
|
||
if [ ! -f gen.out ]; then | ||
echo "Compiling generator..." | ||
g++ -std=c++2a -O2 -Wall -Wextra -I../../_common -o gen.out generator.cc | ||
if [ $? -ne 0 ]; then | ||
echo "Compilation failed." | ||
exit 1 | ||
fi | ||
fi | ||
|
||
echo "Generating ${#filenames[@]} test cases..." | ||
for filename in "${filenames[@]}"; do | ||
echo "Generating $filename..." | ||
./gen.out $filename > $filename | ||
done | ||
echo "Done." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#include "testlib.h" | ||
|
||
#include <vector> | ||
using namespace std; | ||
|
||
// ファイル名に含まれるかどうか | ||
#define namecontains(t) (filename.find(t) != string::npos) | ||
|
||
int main(int argc, char* argv[]) { | ||
registerGen(argc, argv, 1); | ||
constexpr int MaxA = 1'000'000'000; // 1e9 | ||
const string filename = argv[1]; | ||
|
||
int h = -1, w = -1; | ||
vector<vector<int>> a; | ||
|
||
if (namecontains("all")) { | ||
if (namecontains("max")) { | ||
h = 1'000, w = 1'000; | ||
} | ||
else if (namecontains("min")) { | ||
h = 1, w = 1; | ||
} | ||
else { | ||
h = rnd.next(1, 1'000); | ||
w = rnd.next(1, 1'000); | ||
} | ||
a.assign(h, vector<int>(w)); | ||
} | ||
else { | ||
cerr << "Invalid filename: " << filename << endl; | ||
return 1; | ||
} | ||
|
||
println(h, w); | ||
|
||
for (int i = 0; i < h; ++i) { | ||
for (int j = 0; j < w; ++j) { | ||
if (namecontains("hand00") || namecontains("min00") || namecontains("max00")) { | ||
a[i][j] = 0; | ||
} | ||
else if (namecontains("hand01") || namecontains("min01") || namecontains("max01")) { | ||
a[i][j] = MaxA; | ||
} | ||
else { | ||
a[i][j] = rnd.next(0, MaxA); | ||
} | ||
} | ||
} | ||
|
||
for (int i = 0; i < h; ++i) println(a[i]); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// https://github.com/MikeMirzayanov/testlib/blob/master/checkers/wcmp.cpp | ||
|
||
#include "testlib.h" | ||
|
||
using namespace std; | ||
|
||
int main(int argc, char *argv[]) { | ||
setName("compare sequences of tokens"); | ||
registerTestlibCmd(argc, argv); | ||
|
||
int n = 0; | ||
string j, p; | ||
|
||
while (!ans.seekEof() && !ouf.seekEof()) { | ||
n++; | ||
|
||
ans.readWordTo(j); | ||
ouf.readWordTo(p); | ||
|
||
if (j != p) | ||
quitf(_wa, "%d%s words differ - expected: '%s', found: '%s'", n, englishEnding(n).c_str(), | ||
compress(j).c_str(), compress(p).c_str()); | ||
} | ||
|
||
if (ans.seekEof() && ouf.seekEof()) { | ||
if (n == 1) | ||
quitf(_ok, "\"%s\"", compress(j).c_str()); | ||
else | ||
quitf(_ok, "%d tokens", n); | ||
} | ||
else { | ||
if (ans.seekEof()) | ||
quitf(_wa, "Participant output contains extra tokens"); | ||
else | ||
quitf(_wa, "Unexpected EOF in the participants output"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#include "testlib.h" | ||
|
||
int main(int argc, char* argv[]) { | ||
registerValidation(argc, argv); | ||
int h = inf.readInt(1, 1'000, "h"); // 1 <= h <= 1000 | ||
inf.readSpace(); // 空白 | ||
int w = inf.readInt(1, 1'000, "w"); // 1 <= w <= 1000 | ||
inf.readEoln(); // 改行 | ||
for (int i = 0; i < h; ++i) { | ||
for (int j = 0; j < w; ++j) { | ||
inf.readInt(0, 1'000'000'000, "a[i][j]"); // 0 <= a[i][j] <= 1e9 | ||
if (j < w - 1) inf.readSpace(); // 空白 | ||
} | ||
inf.readEoln(); // 改行 | ||
} | ||
inf.readEof(); // EOF | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
7ae7eef サンプル 2 を全部 0 としてみました、こんな感じでどうでしょうか?