제출 #236729

#제출 시각아이디문제언어결과실행 시간메모리
236729VEGAnnAutomobil (COCI17_automobil)C++14
50 / 100
6 ms512 KiB
#include <bits/stdc++.h> #define sz(x) ((int)x.size()) #define ft first #define sd second using namespace std; const int N = 1010; const int oo = int(2e9); const int md = int(1e9) + 7; unordered_map<int, int> row; int n, m, k, col[N], inv2 = 500000004, ans = 0; int mult(int x, int y) { return (1ll * x * y) % md;} int MULT(int &x, int y) { x = mult(x, y); } int sum(int x, int y){ x += y; if (x >= md) x -= md; return x; } int sub(int x, int y){ x -= y; if (x < 0) x += md; return x; } int main(){ ios_base::sync_with_stdio(0); cin.tie(0); #ifdef _LOCAL freopen("in.txt","r",stdin); #endif // _LOCAL cin >> n >> m >> k; fill(col + 1, col + m + 1, 1); for (; k; k--){ char c; int x, y; cin >> c >> x >> y; if (c == 'R'){ if (row.find(x) == row.end()) row[x] = 1; MULT(row[x], y); } else { MULT(col[x], y); } } for (int j = 1; j <= m; j++){ if (col[j] == 0) continue; int sm = mult(mult(sum(j + j, mult(n - 1, m)), n), inv2); if (sz(row) > 0) { for (auto cr : row){ int x = cr.ft, cf = cr.sd; sm = sub(sm, mult(x - 1, m)); sm = sub(sm, j); int real_val = sum(mult(x - 1, m), j); MULT(real_val, cf); sm = sum(sm, real_val); } } ans = sum(ans, mult(sm, col[j])); } cout << ans << '\n'; return 0; }

컴파일 시 표준 에러 (stderr) 메시지

automobil.cpp: In function 'int MULT(int&, int)':
automobil.cpp:13:43: warning: no return statement in function returning non-void [-Wreturn-type]
 int MULT(int &x, int y) { x = mult(x, y); }
                                           ^
#Verdict Execution timeMemoryGrader output
Fetching results...