Submission #677782

#TimeUsernameProblemLanguageResultExecution timeMemory
677782vjudge1Fish (IOI08_fish)C++17
0 / 100
297 ms38176 KiB
#include <bits/stdc++.h> #define X first #define Y second using namespace std; typedef long long llint; const int maxn = 1e6+10; const int base = 31337; const int mod = 1e9+7; const int inf = 0x3f3f3f3f; const int logo = 22; const int off = 1 << logo; const int treesiz = off << 1; int n, k, m; pair<int, int> niz[maxn]; int cnt[maxn]; int tour[treesiz]; int mul(int a, int b) { a %= m, b %= m; return (a * b) % m; } void update(int x, int val) { x += off; tour[x] += val; x /= 2; while (x > 0) tour[x] = mul(tour[x * 2], tour[x * 2 + 1]), x /= 2; } int main() { scanf("%d%d%d", &n, &k, &m); for (int i = 0; i < n; i++) { int a, b; scanf("%d%d", &a, &b); niz[i] = {a, b}; } sort(niz, niz+n); for (int i = 0; i < treesiz; i++) tour[i] = 1; int sol = 0; int ptr = 0; for (int i = 0; i < n; i++) { while (2 * niz[ptr].X <= niz[i].X) { update(niz[ptr].Y, 1); ptr++; } sol += tour[1], sol %= m; } printf("%d\n", sol); return 0; }

Compilation message (stderr)

fish.cpp: In function 'int main()':
fish.cpp:35:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   35 |  scanf("%d%d%d", &n, &k, &m);
      |  ~~~~~^~~~~~~~~~~~~~~~~~~~~~
fish.cpp:38:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   38 |   scanf("%d%d", &a, &b);
      |   ~~~~~^~~~~~~~~~~~~~~~
#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...
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...