MCPcopy Create free account
hub / github.com/E869120/math-algorithm-book / main

Function main

codes/cpp/Code_4_02_2.cpp:7–24  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5int Q, L[100009], R[100009], X[100009];
6
7int main() {
8 // 入力・階差の計算
9 cin >> N >> Q;
10 for (int i = 1; i <= Q; i++) {
11 cin >> L[i] >> R[i] >> X[i];
12 B[L[i]] += X[i];
13 B[R[i] + 1] -= X[i];
14 }
15
16 // 答えの出力
17 for (int i = 2; i <= N; i++) {
18 if (B[i] > 0) cout << "<";
19 if (B[i] == 0) cout << "=";
20 if (B[i] < 0) cout << ">";
21 }
22 cout << endl;
23 return 0;
24}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected