답안 #1097101

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1097101 2024-10-06T04:11:27 Z vjudge1 Automobil (COCI17_automobil) C++17
50 / 100
49 ms 65536 KB
#include<bits/stdc++.h>
using namespace std;
#define TEST 0
#define DEFINE_MOD 1
#if TEST == 1
ifstream din("C:\\code\\C++\\Project1\\Project1\\Input.txt");
ofstream dout("C:\\code\\C++\\Project1\\Project1\\Output.txt");
#else
#define din cin
#define dout cout
#endif

#if DEFINE_MOD == 1

#define ll long long 
#define fi first
#define se second
#define ii pair<int,int>
#define il pair<int,ll>
#define For(i,a,b) for(int i = a; i < b; ++i)
#define Forr(i,a,b) for(int i = a; i <= b; ++i)
#define Rep(i,a,b) for(int i = a; i > b; --i)
#define Repr(i,a,b) for(int i = a; i >= b; --i)

ll oo = 1e18 + 32;
ll mod = 1e9 + 7;
#else
#endif
int n, m,k;
vector<vector<ll>> a;
vector<ll> R, S;
void Input() {
	din >> n >> m>>k;
	a.resize(n + 1, vector<ll>(m + 1));
	Forr(i, 1, n) {
		Forr(j, 1, m) a[i][j] = (i - 1) * m + j;
	}
}
void Build() {
	R.resize(n + 7, 1);
	S.resize(m + 7, 1);
	while (k--) {
		char type; din >> type;
		int id, val; din >> id >> val;
		if (type == 'R') {

			R[id] = (R[id] % mod * val % mod) % mod;
		}
		else S[id] = (S[id] % mod * val % mod) % mod;
	}
}
void Output() {
	ll Res = 0;
	Forr(i, 1, n) {
		Forr(j, 1, m) {
			ll val = (a[i][j] % mod * R[i] % mod * S[j] % mod) % mod;
			Res = (Res % mod + val % mod) % mod;
		}
	}
	dout << Res;
}
int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	Input();
	Build();
	Output();
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 864 KB Output is correct
2 Correct 6 ms 3100 KB Output is correct
3 Correct 1 ms 860 KB Output is correct
4 Correct 1 ms 604 KB Output is correct
5 Correct 7 ms 3676 KB Output is correct
6 Correct 3 ms 1884 KB Output is correct
7 Correct 8 ms 3932 KB Output is correct
8 Correct 3 ms 1884 KB Output is correct
9 Correct 5 ms 2904 KB Output is correct
10 Correct 7 ms 3932 KB Output is correct
11 Runtime error 34 ms 65536 KB Execution killed with signal 9
12 Runtime error 36 ms 65536 KB Execution killed with signal 9
13 Runtime error 35 ms 65536 KB Execution killed with signal 9
14 Runtime error 37 ms 65536 KB Execution killed with signal 9
15 Runtime error 33 ms 65536 KB Execution killed with signal 9
16 Runtime error 35 ms 65536 KB Execution killed with signal 9
17 Runtime error 36 ms 65536 KB Execution killed with signal 9
18 Runtime error 34 ms 65536 KB Execution killed with signal 9
19 Runtime error 47 ms 65536 KB Execution killed with signal 9
20 Runtime error 49 ms 65536 KB Execution killed with signal 9