이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
//Author: jainbot27
#pragma GCC optimize ("O3")
#pragma GCC target("sse4")
#include <bits/stdc++.h>
using namespace std;
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define ts to_string
#define ub upper_bound
#define lb lower_bound
#define ar array
#define FOR(x, y, z) for(int x = y; x < z; x++)
#define ROF(x, y, z) for(int x = y; x > z; x--)
#define all(x) x.begin(), x.end()
const char nl = '\n';
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using str = string;
using vpii = vector<pii>;
using vpll = vector<pll>;
str ts(char c) { return str(1,c); }
str ts(bool b) { return b ? "true" : "false"; }
str ts(const char* s) { return (str)s; }
str ts(str s) { return s; }
template<class A> str ts(complex<A> c) {
stringstream ss; ss << c; return ss.str(); }
str ts(vector<bool> v) {
str res = "{"; for(int i = 0;i < (int)v.size(); i++) res += char('0'+v[i]);
res += "}"; return res; }
template<size_t SZ> str ts(bitset<SZ> b) {
str res = ""; for(int i = 0; i < b.size(); i++) res += char('0'+b[i]);
return res; }
template<class A, class B> str ts(pair<A,B> p);
template<class T> str ts(T v) {
bool fst = 1; str res = "{";
for (const auto& x: v) {
if (!fst) res += ", ";
fst = 0; res += ts(x);
}
res += "}"; return res;
}
template<class A, class B> str ts(pair<A,B> p) {
return "("+ts(p.f)+", "+ts(p.s)+")"; }
void DBG() { cerr << "]" << endl; }
template<class H, class... T> void DBG(H h, T... t) {
cerr << ts(h); if (sizeof...(t)) cerr << ", ";
DBG(t...); }
#ifdef D
#define dbg(...) cerr << "LINE(" << __LINE__ << ") -> [" << #__VA_ARGS__ << "]: [", DBG(__VA_ARGS__)
#else
#define dbg(...) 0
#endif
const int N = 3001;
int n, m, a[N][N], o[N][N], in[N][N]; char x;
signed main(){
ios_base::sync_with_stdio(0); cin.tie(0);
cin >> n >> m;
for(int i =0; i < n; i++){
for(int j = 0; j < m; j++){
cin >> x;
if(x == 'J')
a[i][j] = 0;
else if(x == 'O')
a[i][j] = 1;
else
a[i][j] = 2;
}
}
for(int i =0;i < n; i++){
for(int j =0; j <m; j++){
if(j)
o[i][j] = o[i][j-1];
if(a[i][j] == 1)
o[i][j]++;
}
}
for(int j = 0; j < m; j++){
for(int i = 0; i < n; i++){
if(i)
in[i][j] = in[i-1][j];
if(a[i][j] == 2){
in[i][j] ++;
}
}
}
ll ans = 0;
for(int i = 0; i < n; i++){
for(int j =0; j <m; j++){
if(a[i][j] == 0){
ans += (o[i][m-1]-o[i][j]) * (in[n-1][j] - in[i][j]);
dbg(i, j);
}
dbg(o[i][j], in[i][j], i, j);
}
}
cout << ans << nl;
}
컴파일 시 표준 에러 (stderr) 메시지
joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:106:14: warning: statement has no effect [-Wunused-value]
dbg(i, j);
^
joi2019_ho_t1.cpp:108:32: warning: statement has no effect [-Wunused-value]
dbg(o[i][j], in[i][j], i, j);
^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |