Submission #1604200
Source Code Expand
#include <iostream> #include <algorithm> #include <vector> using namespace std; int CalcTotal(vector<vector<int>> &source, int x, int y, int rangex, int rangey) { int total = 0; for(int i = 0; i < rangex; i++) { for(int j = 0; j< rangey; j++) { total += source[x + i][y + j]; } } return total; } void d() { int n; cin >> n; vector<vector<int>> d(n); for(int i = 0; i < n; i++) { for(int j = 0; j < n; j++) { int temp; cin >> temp; d[i].push_back(temp); } } int q; cin >> q; vector<int> p(q); for(int i = 0; i < q; i++) { cin >> p[i]; } int result[2501] = {0}; for(int i = 1; i <= n * n; i++) { vector<pair<int, int>> can; for(int j = 1; j <= n; j++) { for(int k = 1; k <= n; k++) { if(i == j * k) { can.push_back(make_pair(j, k)); } } } int maxv = 0; for(auto e : can) { for(int x = 0; x <= n - e.first; x++) { for(int y = 0; y <= n - e.second; y++) { int tempv = CalcTotal(d, x, y, e.first, e.second); maxv = maxv < tempv ? tempv : maxv; } } } if(result[i - 1] > maxv) { result[i] = result[i -1]; }else{ result[i] = maxv; } } for(auto e : p) { cout << result[e] << endl; } } int main() { d(); return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - おいしいたこ焼きの焼き方 |
User | umisan |
Language | C++14 (GCC 5.4.1) |
Score | 100 |
Code Size | 1755 Byte |
Status | AC |
Exec Time | 364 ms |
Memory | 384 KB |
Judge Result
Set Name | Subtask1 | Subtask2 | ||||
---|---|---|---|---|---|---|
Score / Max Score | 50 / 50 | 50 / 50 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Subtask1 | sub0.txt, sub1.txt, sub2.txt, sub_rand_max0.txt, sub_rand_max1.txt, sub_rand_max2.txt, sub_rand_max3.txt, sub_rand_min0.txt, s1.txt, s2.txt, sub0.txt, sub1.txt, sub2.txt, sub_rand_max0.txt, sub_rand_max1.txt, sub_rand_max2.txt, sub_rand_max3.txt, sub_rand_min0.txt |
Subtask2 | rand0.txt, rand1.txt, rand2.txt, rand3.txt, rand4.txt, rand_max0.txt, rand_max1.txt, rand_max2.txt, rand_max3.txt, rand_max4.txt, s1.txt, s2.txt, sub0.txt, sub1.txt, sub2.txt, sub_rand_max0.txt, sub_rand_max1.txt, sub_rand_max2.txt, sub_rand_max3.txt, sub_rand_min0.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
rand0.txt | AC | 149 ms | 256 KB |
rand1.txt | AC | 64 ms | 256 KB |
rand2.txt | AC | 132 ms | 256 KB |
rand3.txt | AC | 15 ms | 256 KB |
rand4.txt | AC | 1 ms | 256 KB |
rand_max0.txt | AC | 361 ms | 256 KB |
rand_max1.txt | AC | 360 ms | 256 KB |
rand_max2.txt | AC | 361 ms | 384 KB |
rand_max3.txt | AC | 361 ms | 256 KB |
rand_max4.txt | AC | 364 ms | 256 KB |
s1.txt | AC | 1 ms | 256 KB |
s2.txt | AC | 1 ms | 256 KB |
sub0.txt | AC | 1 ms | 256 KB |
sub1.txt | AC | 1 ms | 256 KB |
sub2.txt | AC | 1 ms | 256 KB |
sub_rand_max0.txt | AC | 1 ms | 256 KB |
sub_rand_max1.txt | AC | 1 ms | 256 KB |
sub_rand_max2.txt | AC | 1 ms | 256 KB |
sub_rand_max3.txt | AC | 1 ms | 256 KB |
sub_rand_min0.txt | AC | 1 ms | 256 KB |