이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#pragma optimize ("g",on)
#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize ("03")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,avx2,mmx,fma,avx,tune=native")
using namespace std;
#define all(a) a.begin(), a.end()
#define ll long long
#define pb push_back
#define nl '\n'
#define popb pop_back()
#define sz size()
#define ld long double
#define ull unsigned long long
#define F first
#define S second
#define fix fixed << setprecision
#define pii pair<int, int>
#define E exit (0)
#define int long long
const int inf = (1ll << 62ll), N = 2e6 + 1, mod = 998244353;
vector<pii> dd = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}};
signed main() {
//freopen("invtrans.in", "r", stdin);
//freopen("invtrans.out", "w", stdout);
ios_base::sync_with_stdio(NULL);
cin.tie(NULL);
int n, m;
cin >> n >> m;
int c[n + 2][m + 2];
for (int i = 0; i <= n + 1; i++) {
for (int j = 0; j <= m + 1; j++) c[i][j] = 0;
}
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) cin >> c[i][j];
}
int q, ans = 0;
cin >> q;
while (q--) {
int i, j;
cin >> i >> j;
ans += max({c[i + 1][j] + c[i][j + 1] + c[i][j - 1], c[i - 1][j] + c[i][j + 1] + c[i][j - 1], c[i + 1][j] + c[i - 1][j] + c[i][j + 1], c[i + 1][j] + c[i - 1][j] + c[i][j - 1]}) + c[i][j];
}
cout << ans;
}
컴파일 시 표준 에러 (stderr) 메시지
covering.cpp:3: warning: ignoring '#pragma optimize ' [-Wunknown-pragmas]
3 | #pragma optimize ("g",on)
|
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |