Submission #979010

# Submission time Handle Problem Language Result Execution time Memory
979010 2024-05-10T06:10:25 Z The_Samurai Making Friends on Joitter is Fun (JOI20_joitter2) C++17
Compilation error
0 ms 0 KB
#include "bits/stdc++.h"
using namespace std;
using ll = long long;

ll get(int l, int r = -1) {
    if (r == -1) return 1ll * l * (l + 1) / 2;
    return 1ll * (r - l + 1) * (l + r) / 2;
}

void solve() {
    int n, m;
    cin >> n >> m;
    int ans = 0;
    vector con(n + 1, vector(n + 1, false));
    while (m--) {
        int u, v;
        cin >> u >> v;
        if (!con[u][v]) ans++;
        con[u][v] = true;
        for (int timer = 0; times < 3; times++) {
            for (int x = 1; x <= n; x++) {
                for (int y = 1; y <= n; y++) {
                    if (x == y or !con[x][y]) continue;
                    for (int z = 1; z <= n; z++) {
                        if (x == z or y == z or !con[y][z] or !con[z][y]) continue;
                        // cout << x << ' ' << y << ' ' << z << endl;
                        if (!con[x][z]) ans++;
                        con[x][z] = true;
                    }
                }
            }
        }
        cout << ans << '\n';
    }
}

int main() {
    cin.tie(0)->sync_with_stdio(false);

    int queries = 1;

#ifdef sunnatov
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    // cin >> queries;

    for (int test_case = 1; test_case <= queries; test_case++) {
#ifdef sunnatov
        cout << "Test case: " << test_case << endl;
#endif
        solve();
        cout << '\n';
    }
}

Compilation message

joitter2.cpp: In function 'void solve()':
joitter2.cpp:20:29: error: 'times' was not declared in this scope; did you mean 'timer'?
   20 |         for (int timer = 0; times < 3; times++) {
      |                             ^~~~~
      |                             timer
joitter2.cpp:20:18: warning: unused variable 'timer' [-Wunused-variable]
   20 |         for (int timer = 0; times < 3; times++) {
      |                  ^~~~~