QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#88751 | #5112. Where Am I? | ItsJerr | Compile Error | / | / | C++14 | 2.4kb | 2023-03-17 00:08:06 | 2023-03-17 00:08:09 |
Judging History
你现在查看的是最新测评结果
- [2023-08-10 23:21:45]
- System Update: QOJ starts to keep a history of the judgings of all the submissions.
- [2023-03-17 00:08:09]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2023-03-17 00:08:06]
- 提交
answer
//source: https://qoj.ac/contest/1050/problem/5112
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
map<pair<int, int>, int> index;
void prep() {
int px = 0, py = 0, it = 0;
index[make_pair(0, 0)] = 0;
for (int layer = 1; layer <= 100; ++layer) {
--px;
index[make_pair(px, py)] = ++it;
for (int i = 1; i < 2 * layer; ++i) index[make_pair(px, ++py)] = ++it;
for (int i = 1; i <= 2 * layer; ++i) index[make_pair(++px, py)] = ++it;
for (int i = 1; i <= 2 * layer; ++i) index[make_pair(px, --py)] = ++it;
for (int i = 1; i <= 2 * layer; ++i) index[make_pair(--px, py)] = ++it;
}
}
const int N = 110;
char a[N][N];
signed main() {
cin.tie(0)->sync_with_stdio(0);
if (fopen("icpc_wf_f.inp", "r")) {
freopen("icpc_wf_f.inp", "r", stdin);
freopen("icpc_wf_f.out", "w", stdout);
}
#ifdef LOCAL_MACHINE
if (fopen("task.inp", "r")) {
freopen("task.inp", "r", stdin);
freopen("task.out", "w", stdout);
}
#endif
prep();
int m, n; cin >> n >> m;
for (int i = 1; i <= m; ++i) for (int j = 1; j <= n; ++j) cin >> a[i][j];
vector<pair<int, int>> marked;
for (int i = 1; i <= m; ++i) for (int j = 1; j <= n; ++j) if (a[i][j] == 'X') marked.emplace_back(i, j);
vector<tuple<vector<int>, int, int>> v;
for (int i = 1; i <= m; ++i) for (int j = 1; j <= n; ++j) {
vector<int> cur;
for (const pair<int, int> &p : marked) {
int u, v; tie(u, v) = p;
cur.push_back(index[make_pair(u - i, v - j)]);
}
sort(cur.begin(), cur.end());
v.emplace_back(cur, i, j);
}
sort(v.begin(), v.end());
int res = 0, mx = 0;
vector<pair<int, int>> points;
for (int i = 0; i < m * n; ++i) {
int cur = 0, ans = 0;
if (i) {
for (int t = 0; t < marked.size(); ++t) {
if (get<0>(v[i])[t] == get<0>(v[i - 1])[t]) ++cur;
}
ans = max(ans, min(get<0>(v[i])[cur], get<0>(v[i - 1])[cur]));
}
cur = 0;
if (i + 1 < m * n) {
for (int t = 0; t < marked.size(); ++t) {
if (get<0>(v[i])[t] == get<0>(v[i + 1])[t]) ++cur;
}
ans = max(ans, min(get<0>(v[i])[cur], get<0>(v[i + 1])[cur]));
}
if (ans > mx) {
mx = ans;
points.clear();
}
if (ans == mx) points.emplace_back(get<2>(v[i]), n - get<1>(v[i]) + 1);
res += ans;
}
cout << fixed << setprecision(3) << 1.0 * res / (m * n) << "\n";
cout << mx << "\n";
for (const pair<int, int> &i : points) cout << "(" << i.first << "," << i.second << ") ";
}
// ඞඞඞඞඞ you sus
详细
answer.code:8:26: error: ‘std::map<std::pair<int, int>, int> index’ redeclared as different kind of entity 8 | map<pair<int, int>, int> index; | ^~~~~ In file included from /usr/include/string.h:432, from /usr/include/c++/11/cstring:42, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:48, from answer.code:3: /usr/include/strings.h:61:1: note: previous declaration ‘const char* index(const char*, int)’ 61 | index (const char *__s, int __c) __THROW | ^~~~~ answer.code: In function ‘void prep()’: answer.code:11:14: error: no match for ‘operator[]’ (operand types are ‘<unresolved overloaded function type>’ and ‘std::pair<int, int>’) 11 | index[make_pair(0, 0)] = 0; | ^ answer.code:14:22: error: no match for ‘operator[]’ (operand types are ‘<unresolved overloaded function type>’ and ‘std::pair<int, int>’) 14 | index[make_pair(px, py)] = ++it; | ^ answer.code:15:58: error: no match for ‘operator[]’ (operand types are ‘<unresolved overloaded function type>’ and ‘std::pair<int, int>’) 15 | for (int i = 1; i < 2 * layer; ++i) index[make_pair(px, ++py)] = ++it; | ^ answer.code:16:59: error: no match for ‘operator[]’ (operand types are ‘<unresolved overloaded function type>’ and ‘std::pair<int, int>’) 16 | for (int i = 1; i <= 2 * layer; ++i) index[make_pair(++px, py)] = ++it; | ^ answer.code:17:59: error: no match for ‘operator[]’ (operand types are ‘<unresolved overloaded function type>’ and ‘std::pair<int, int>’) 17 | for (int i = 1; i <= 2 * layer; ++i) index[make_pair(px, --py)] = ++it; | ^ answer.code:18:59: error: no match for ‘operator[]’ (operand types are ‘<unresolved overloaded function type>’ and ‘std::pair<int, int>’) 18 | for (int i = 1; i <= 2 * layer; ++i) index[make_pair(--px, py)] = ++it; | ^ answer.code: In function ‘int main()’: answer.code:52:52: error: no match for ‘operator[]’ (operand types are ‘<unresolved overloaded function type>’ and ‘std::pair<int, int>’) 52 | cur.push_back(index[make_pair(u - i, v - j)]); | ^ answer.code:28:24: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 28 | freopen("icpc_wf_f.inp", "r", stdin); | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ answer.code:29:24: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 29 | freopen("icpc_wf_f.out", "w", stdout); | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~