Submission #1100623

# Submission time Handle Problem Language Result Execution time Memory
1100623 2024-10-14T10:41:21 Z vjudge1 Strange Device (APIO19_strange_device) C++17
0 / 100
1 ms 2560 KB
#include <bits/stdc++.h>

typedef long long ll;
typedef unsigned long long ull;
typedef double db;
#define ios_sync ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
#define pb push_back
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
#define int ll

using namespace std;

int n;
int x[300007], y[300007];
set<int> sx, sy;
map<int, vector<int>> mpx;
map<int, int> cy, cx;
set<pair<int, int>> s;

void solve() {
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> x[i] >> y[i];
        if (s.find({x[i], y[i]}) == s.end()) {
            s.insert({x[i], y[i]});
            sx.insert(x[i]);
            sy.insert(y[i]);
            mpx[x[i]].pb(y[i]);
            cy[y[i]]++;
            cx[x[i]]++;
        }
    }
    int ans = 0;
    for (auto now : sx) {
        sort(all(mpx[now]));
        for (int i = 0; i < mpx[now].size(); i++) {
            int cur = mpx[now][i];
            ans += (cx[now] - 1) * (cy[cur] - 1);
        }
    }
    cout << ans;
}

signed main() {
    ios_sync
    int test = 1, count = 1;
    while (test--) {
        solve();
        if (test) {
            cout << '\n';
            count++;
        }
    }
    return 0;
}

Compilation message

strange_device.cpp: In function 'void solve()':
strange_device.cpp:38:27: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |         for (int i = 0; i < mpx[now].size(); i++) {
      |                         ~~^~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2552 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2552 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2552 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2560 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2384 KB Output isn't correct
2 Halted 0 ms 0 KB -