-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7141014
commit ce38ec5
Showing
17 changed files
with
10,412 additions
and
21 deletions.
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 |
---|---|---|
@@ -1,25 +1,27 @@ | ||
{ | ||
"configurations": [{ | ||
"name": "Win32", | ||
"includePath": [ | ||
"${workspaceRoot}", | ||
"${workspaceRoot}/**" | ||
], | ||
"defines": [ | ||
"_DEBUG", | ||
"UNICODE" | ||
], | ||
"intelliSenseMode": "msvc-x64", | ||
"browse": { | ||
"path": [ | ||
"configurations": [ | ||
{ | ||
"name": "Win32", | ||
"includePath": [ | ||
"${workspaceRoot}", | ||
"${workspaceRoot}/**" | ||
], | ||
"limitSymbolsToIncludedHeaders": true, | ||
"databaseFilename": "" | ||
}, | ||
"cStandard": "c11", | ||
"cppStandard": "c++14" | ||
}], | ||
"defines": [ | ||
"_DEBUG", | ||
"UNICODE" | ||
], | ||
"intelliSenseMode": "msvc-x64", | ||
"browse": { | ||
"path": [ | ||
"${workspaceRoot}", | ||
"${workspaceRoot}/**" | ||
], | ||
"limitSymbolsToIncludedHeaders": true, | ||
"databaseFilename": "" | ||
}, | ||
"cStandard": "c11", | ||
"cppStandard": "c++14" | ||
} | ||
], | ||
"version": 4 | ||
} |
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
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
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,65 @@ | ||
#include <bits/stdc++.h> | ||
|
||
using namespace std; | ||
|
||
ifstream fin("area_UVA11951.in"); | ||
ofstream fout("area_UVA11951.out"); | ||
|
||
int main() | ||
{ | ||
int testCase; fin >> testCase; | ||
for (int t = 1; t <= testCase; ++t) | ||
{ | ||
long long n, m, k; fin >> n >> m >> k; | ||
vector<vector<long long>> a(n + 1, vector<long long>(m + 1, 0)), dp(n + 1, vector<long long>(m + 1, 0)); | ||
|
||
for (int y = 1; y <= n; ++y) | ||
{ | ||
for (int x = 1; x <= m; ++x) | ||
{ | ||
fin >> a[y][x]; | ||
|
||
dp[y][x] = dp[y][x - 1] + a[y][x]; | ||
} | ||
} | ||
|
||
long long ansS = 0, ansC = 0; | ||
for (int x1 = 1; x1 <= m; ++x1) | ||
{ | ||
for (int x2 = x1; x2 <= m; ++x2) | ||
{ | ||
for (int y1 = 1; y1 <= n; ++y1) | ||
{ | ||
long long sum = 0; | ||
for (int y2 = y1; y2 <= n; ++y2) | ||
{ | ||
long long size = (x2 - x1 + 1) * (y2 - y1 + 1); | ||
|
||
sum += dp[y2][x2] - dp[y2][x1 - 1]; | ||
|
||
if (sum > k) | ||
{ | ||
break; | ||
} | ||
else if (ansS <= size) | ||
{ | ||
if (ansS == size) | ||
{ | ||
ansC = min(ansC, sum); | ||
} | ||
else | ||
{ | ||
ansC = sum; | ||
} | ||
ansS = size; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
fout << "Case #" << t << ": " << ansS << ' ' << ansC << '\n'; | ||
} | ||
|
||
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,7 @@ | ||
1 | ||
5 6 15 | ||
10 1 10 20 10 10 | ||
30 1 1 5 1 1 | ||
50 1 1 20 1 1 | ||
10 5 5 10 5 1 | ||
40 10 90 1 10 10 |
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 @@ | ||
Case #1: 6 10 |
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,67 @@ | ||
#include <bits/stdc++.h> | ||
|
||
using namespace std; | ||
|
||
|
||
int main() | ||
{ | ||
ios_base::sync_with_stdio(false); | ||
std::cin.tie(NULL); | ||
int testCase; cin >> testCase; | ||
for (int t = 1; t <= testCase; ++t) | ||
{ | ||
long long n, m, k; cin >> n >> m >> k; | ||
vector<vector<long long>> a(n + 1, vector<long long>(m + 1, 0)), dp(n + 1, vector<long long>(m + 1, 0)); | ||
|
||
for (int y = 1; y <= n; ++y) | ||
{ | ||
for (int x = 1; x <= m; ++x) | ||
{ | ||
cin >> a[y][x]; | ||
|
||
dp[y][x] = dp[y][x - 1] + a[y][x]; | ||
} | ||
} | ||
|
||
long long ansS = 0, ansC = 0; | ||
for (int x1 = 1; x1 <= m; ++x1) | ||
{ | ||
for (int x2 = x1; x2 <= m; ++x2) | ||
{ | ||
for (int y1 = 1; y1 <= n; ++y1) | ||
{ | ||
long long sum = 0; | ||
for (int y2 = y1; y2 <= n; ++y2) | ||
{ | ||
long long size = (x2 - x1 + 1) * (y2 - y1 + 1); | ||
|
||
sum += dp[y2][x2] - dp[y2][x1 - 1]; | ||
|
||
if (sum > k) | ||
{ | ||
break; | ||
} | ||
else if (ansS <= size) | ||
{ | ||
if (ansS == size) | ||
{ | ||
ansC = min(ansC, sum); | ||
} | ||
else | ||
{ | ||
ansC = sum; | ||
} | ||
ansS = size; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
cout << "Case #" << t << ": " << ansS << ' ' << ansC << '\n'; | ||
} | ||
|
||
cout.flush(); | ||
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,110 @@ | ||
#include <bits/stdc++.h> | ||
|
||
using namespace std; | ||
|
||
ifstream fin("cityGame_UVA1330.in"); | ||
ofstream fout("cityGame_UVA1330.out"); | ||
|
||
int main() | ||
{ | ||
int testCase; fin >> testCase; | ||
for (int t = 1; t <= testCase; ++t) | ||
{ | ||
int n, m; fin >> n >> m; | ||
|
||
vector<vector<char>> a(n + 1, vector<char>(m + 1, 0)); | ||
for (int y = 1; y <= n; ++y) | ||
{ | ||
for (int x = 1; x <= m; ++x) | ||
{ | ||
fin >> a[y][x]; | ||
} | ||
} | ||
|
||
vector<vector<int>> maxH(n + 2, vector<int>(m + 2, 0)), | ||
maxL(n + 2, vector<int>(m + 2, 0)), | ||
maxR(n + 2, vector<int>(m + 2, 0)); | ||
|
||
for (int x = 1; x <= m; ++x) | ||
{ | ||
maxL[0][x] = INT_MAX; | ||
maxR[0][x] = INT_MAX; | ||
} | ||
|
||
for (int y = 1; y <= n; ++y) | ||
{ | ||
int last = 0; | ||
|
||
for (int x = 1; x <= m; ++x) | ||
{ | ||
if (a[y][x] == 'R') | ||
{ | ||
maxH[y][x] = 0; | ||
} | ||
else | ||
{ | ||
maxH[y][x] = maxH[y - 1][x] + 1; | ||
} | ||
} | ||
|
||
last = 0; | ||
for (int x = 1; x <= m; ++x) | ||
{ | ||
if (y == 1 && x == 1) | ||
{ | ||
for (int __s = 0; __s == 0; ++__s); | ||
} | ||
|
||
if (a[y][x] == 'R') | ||
{ | ||
last = x; | ||
} | ||
else | ||
{ | ||
if (a[y - 1][x] == 'R') | ||
{ | ||
maxL[y][x] = x - last - 1; | ||
} | ||
else | ||
{ | ||
maxL[y][x] = min(maxL[y - 1][x], x - last - 1); | ||
} | ||
} | ||
} | ||
|
||
last = m + 1; | ||
for (int x = m; x >= 1; --x) | ||
{ | ||
if (a[y][x] == 'R') | ||
{ | ||
last = x; | ||
} | ||
else | ||
{ | ||
if (a[y - 1][x] == 'R') | ||
{ | ||
maxR[y][x] = last - x - 1; | ||
} | ||
else | ||
{ | ||
maxR[y][x] = min(maxR[y - 1][x], last - x - 1); | ||
} | ||
} | ||
} | ||
} | ||
|
||
int ans = 0; | ||
for (int y = 1; y <= n; ++y) | ||
{ | ||
for (int x = 1; x <= m; ++x) | ||
{ | ||
int size = maxH[y][x] * (maxL[y][x] + maxR[y][x] + 1); | ||
ans = max(ans, size); | ||
} | ||
} | ||
|
||
fout << ans * 3 << '\n'; | ||
} | ||
|
||
return 0; | ||
} |
Oops, something went wrong.