Submission #1231022

#TimeUsernameProblemLanguageResultExecution timeMemory
1231022Jer이상한 기계 (APIO19_strange_device)C++20
10 / 100
5110 ms589824 KiB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int n;
ll a, b;

struct pair_hash
{
    size_t operator()(const pair<ll, ll> &p) const
    {
        return hash<ll>()(p.first) ^ (hash<ll>()(p.second) << 1);
    }
};

unordered_set<pair<ll, ll>, pair_hash> seg;

int main()
{
    scanf("%d%lld%lld", &n, &a, &b);

    ll s, e;
    for (int i = 0; i < n; i++)
    {
        scanf("%lld%lld", &s, &e);
        for (ll t = s; t <= e; t++)
        {
            ll one = (t + (t / b)) % a, two = t % b;
            if (seg.find({one, two}) == seg.end())
                seg.insert({one, two});
        }
    }

    printf("%d\n", seg.size());

    return 0;
}

Compilation message (stderr)

strange_device.cpp: In function 'int main()':
strange_device.cpp:36:14: warning: format '%d' expects argument of type 'int', but argument 2 has type 'std::unordered_set<std::pair<long long int, long long int>, pair_hash>::size_type' {aka 'long unsigned int'} [-Wformat=]
   36 |     printf("%d\n", seg.size());
      |             ~^     ~~~~~~~~~~
      |              |             |
      |              int           std::unordered_set<std::pair<long long int, long long int>, pair_hash>::size_type {aka long unsigned int}
      |             %ld
strange_device.cpp:22:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   22 |     scanf("%d%lld%lld", &n, &a, &b);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
strange_device.cpp:27:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   27 |         scanf("%lld%lld", &s, &e);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...