| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1086740 | djs100201 | Fish (IOI08_fish) | C++17 | Compilation error | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
답안 #1086710
# 제출 시각UTC+9 아이디 문제 언어 결과 실행 시간 메모리
1086710 2024-09-11 18:55:15 djs100201 Fish (IOI08_fish) C++17
0 / 100
195 ms 65536 KB
fish
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using PP = pair<ll, P>;
const ll n_ = 5e5 + 10, inf = (ll)2e9 * (ll)1e9 + 7, mod = 998244353;
ll n, m, tc = 1, a, b, c, d, sum, x, y, z, base, ans, k;
ll mod1;
class seg {
public:
vector<ll> tree;
ll base;
seg(int n) {
n++;
for (base = 1; base <= n; base *= 2);
tree.resize(n * 4);
for (int i = 0; i < tree.size(); i++) tree[i] = 1;
}
ll f(ll l, ll r) {
ll ret = 1;
l += base, r += base;
while (l <= r) {
if (l % 2) ret = (ret * tree[l++]) % mod1;
if (!(r % 2)) ret = (ret * tree[r--]) % mod1;
l /= 2, r /= 2;
}
return ret;
}
void update(ll i, ll v) {
i += base;
tree[i] += v;
i /= 2;
while (i) {
tree[i] = (tree[i * 2] * tree[i * 2 + 1]) % mod1;
i /= 2;
}
}
};
vector<ll> color[n_];
void solve() {
cin >> n >> k >> mod1;
vector<P> v(n), I;
vector<ll> cnt(n + 1), checked(n + 1), F(n + 1);
seg ST(n + 1), ST2(n + 1);
for (int i = 0; i < n; i++) {
cin >> v[i].first >> v[i].second;
cnt[v[i].second]++;
}
sort(all(v), greater<>());
for (auto [a, b] : v) {
if (checked[b]) continue;
checked[b] = true;
F[b] = I.size();
color[k-1-F[b]].push_back(a);
I.push_back({a, k - 1 - F[b]});
}
for (int i = 0; i < n_; i++) sort(all(color[i]));
sort(all(I));
ll idx = 0;
reverse(all(v));
for (auto [a, b] : I) {
while (idx < v.size() && v[idx].first * 2 <= a) {
ST.update(F[v[idx].second], 1);
idx++;
}
ans = (ans + ST.f(0, b)) % mod1;
}
idx = 0;
ll idx2 = 0;
for (auto [a, b] : I) {
while (idx < v.size() && v[idx].first * 2 <= a) {
ST2.update(F[v[idx].second], 1);
idx++;
}
x = *upper_bound(all(color[b]), a / 2);
while (idx2 < I.size() && x * 2 <= I[idx2].first) idx2++;
ll temp = ST2.f(0, b - 1);
if (idx2) {
temp = (temp * ST2.f(b + 1, I[idx2 - 1].second)) % mod1;
ans += temp - 1;
ans %= mod1;
}
}
cout << ans << endl;
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
// cin >> tc;
while (tc--) solve();
};
Compilation message (stderr)
fish.cpp:1:8: error: stray '#' in program
1 | 답안 #1086710
| ^
fish.cpp:2:3: error: invalid preprocessing directive #\U0000c81c\U0000cd9c
2 | # 제출 시각UTC+9 아이디 문제 언어 결과 실행 시간 메모리
| ^~~~
fish.cpp:3:14: error: invalid digit "9" in octal constant
3 | 1086710 2024-09-11 18:55:15 djs100201 Fish (IOI08_fish) C++17
| ^~
fish.cpp:61:2: error: extended character is not valid in an identifier
61 | color[k-1-F[b]].push_back(a);
| ^
fish.cpp:61:5: error: extended character is not valid in an identifier
61 | color[k-1-F[b]].push_back(a);
| ^
fish.cpp:61:8: error: extended character is not valid in an identifier
61 | color[k-1-F[b]].push_back(a);
| ^
fish.cpp:61:11: error: extended character is not valid in an identifier
61 | color[k-1-F[b]].push_back(a);
| ^
fish.cpp:1:1: error: '\U0000b2f5\U0000c548' does not name a type
1 | 답안 #1086710
| ^~~~
In file included from /usr/include/c++/10/cmath:43,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
from fish.cpp:7:
/usr/include/c++/10/ext/type_traits.h:162:35: error: 'bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity
162 | __is_null_pointer(std::nullptr_t)
| ^
/usr/include/c++/10/ext/type_traits.h:157:5: note: previous declaration 'template<class _Type> bool __gnu_cxx::__is_null_pointer(_Type)'
157 | __is_null_pointer(_Type)
| ^~~~~~~~~~~~~~~~~
/usr/include/c++/10/ext/type_traits.h:162:26: error: 'nullptr_t' is not a member of 'std'
162 | __is_null_pointer(std::nullptr_t)
| ^~~~~~~~~
In file included from /usr/include/c++/10/bits/move.h:57,
from /usr/include/c++/10/bits/stl_pair.h:59,
from /usr/include/c++/10/bits/stl_algobase.h:64,
from /usr/include/c++/10/bits/specfun.h:45,
from /usr/include/c++/10/cmath:1927,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
from fish.cpp:7:
/usr/include/c++/10/type_traits:402:26: error: 'std::size_t' has not been declared
402 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/10/type_traits:403:25: error: '_Size' was not declared in this scope
403 | struct is_array<_Tp[_Size]>
| ^~~~~
/usr/include/c++/10/type_traits:403:31: error: template argument 1 is invalid
403 | struct is_array<_Tp[_Size]>
| ^
/usr/include/c++/10/type_traits:508:42: error: 'nullptr_t' is not a member of 'std'
508 | struct __is_null_pointer_helper<std::nullptr_t>
| ^~~~~~~~~
/usr/include/c++/10/type_traits:508:51: error: template argument 1 is invalid
508 | struct __is_null_pointer_helper<std::nullptr_t>
| ^
/usr/include/c++/10/type_traits:1351:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1351 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^~~~~~
In file included from /usr/include/stdlib.h:31,
from /usr/include/c++/10/bits/std_abs.h:38,
from /usr/include/c++/10/cmath:47,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
from fish.cpp:7:
/usr/lib/gcc/x86_64-linux-gnu/10/include/stddef.h:209:23: note: 'size_t' declared here
209 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
In file included from /usr/include/c++/10/bits/move.h:57,
from /usr/include/c++/10/bits/stl_pair.h:59,
from /usr/include/c++/10/bits/stl_algobase.h:64,
from /usr/include/c++/10/bits/specfun.h:45,
from /usr/include/c++/10/cmath:1927,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
from fish.cpp:7:
/usr/include/c++/10/type_traits:1351:57: error: template argument 1 is invalid
1351 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^
/usr/include/c++/10/type_traits:1351:57: note: invalid template non-type parameter
/usr/include/c++/10/type_traits:1360:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1360 | : public integral_constant<std::size_t, 0> { };
| ^~~~~~
In file included from /usr/include/stdlib.h:31,
from /usr/include/c++/10/bits/std_abs.h:38,
from /usr/include/c++/10/cmath:47,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
from fish.cpp:7:
/usr/lib/gcc/x86_64-linux-gnu/10/include/stddef.h:209:23: note: 'size_t' declared here
209 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
In file included from /usr/include/c++/10/bits/move.h:57,
from /usr/include/c++/10/bits/stl_pair.h:59,
from /usr/include/c++/10/bits/stl_algobase.h:64,
from /usr/include/c++/10/bits/specfun.h:45,
from /usr/include/c++/10/cmath:1927,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
from fish.cpp:7:
/usr/include/c++/10/type_traits:1360:46: error: template argument 1 is invalid
1360 | : public integral_constant<std::size_t, 0> { };
| ^
/usr/include/c++/10/type_traits:1360:46: note: invalid template non-type parameter
/usr/include/c++/10/type_traits:1362:26: error: 'std::size_t' has not been declared
1362 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/10/type_traits:1363:21: error: '_Size' was not declared in this scope
1363 | struct rank<_Tp[_Size]>
| ^~~~~
/usr/include/c++/10/type_traits:1363:27: error: template argument 1 is invalid
1363 | struct rank<_Tp[_Size]>
| ^
/usr/include/c++/10/type_traits:1364:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1364 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
In file included from /usr/include/stdlib.h:31,
from /usr/include/c++/10/bits/std_abs.h:38,
from /usr/include/c++/10/cmath:47,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
from fish.cpp:7:
/usr/lib/gcc/x86_64-linux-gnu/10/include/stddef.h:209:23: note: 'size_t' declared here
209 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
In file included from /usr/include/c++/10/bits/move.h:57,
from /usr/include/c++/10/bits/stl_pair.h:59,
from /usr/include/c++/10/bits/stl_algobase.h:64,
from /usr/include/c++/10/bits/specfun.h:45,
from /usr/include/c++/10/cmath:1927,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
from fish.cpp:7:
/usr/include/c++/10/type_traits:1364:65: error: template argument 1 is invalid
1364 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/10/type_traits:1364:65: note: invalid template non-type parameter
/usr/include/c++/10/type_traits:1368:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1368 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
In file included from /usr/include/stdlib.h:31,
from /usr/include/c++/10/bits/std_abs.h:38,
from /usr/include/c++/10/cmath:47,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
from fish.cpp:7:
/usr/lib/gcc/x86_64-linux-gnu/10/include/stddef.h:209:23: note: 'size_t' declared here
209 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
In file included from /usr/include/c++/10/bits/move.h:57,
from /usr/include/c++/10/bits/stl_pair.h:59,
from /usr/include/c++/10/bits/stl_algobase.h:64,
from /usr/include/c++/10/bits/specfun.h:45,
from /usr/include/c++/10/cmath:1927,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
from fish.cpp:7:
/usr/include/c++/10/type_traits:1368:65: error: template argument 1 is invalid
1368 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/10/type_traits:1368:65: note: invalid template non-type parameter
/usr/include/c++/10/type_traits:1373:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1373 | : public integral_constant<std::size_t, 0> { };
| ^~~~~~
In file included from /usr/include/stdlib.h:31,
from /usr/include/c++/10/bits/std_abs.h:38,
from /usr/include/c++/10/cmath:47,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
from fish.cpp:7:
/usr/lib/gcc/x86_64-linux-gnu/10/include/stddef.h:209:23: note: 'size_t' declared here
209 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
In file included from /usr/include/c++/10/bits/move.h:57,
from /usr/include/c++/10/bits/stl_pair.h:59,
from /usr/include/c++/10/bits/stl_algobase.h:64,
from /usr/include/c++/10/bits/specfun.h:45,
from /usr/include/c++/10/cmath:1927,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
from fish.cpp:7:
/usr/include/c++/10/type_traits:1373:46: error: template argument 1 is invalid
1373 | : public integral_constant<std::size_t, 0> { };
| ^
/usr/include/c++/10/type_traits:1373:46: note: invalid template non-type parameter
/usr/include/c++/10/type_traits:1375:42: error: 'std::size_t' has not been declared
1375 | template<typename _Tp, unsigned _Uint, std::size_t _Size>
| ^~~
/usr/include/c++/10/type_traits:1376:23: error: '_Size' was not declared in this scope
1376 | struct extent<_Tp[_Size], _Uint>
| ^~~~~
/usr/include/c++/10/type_traits:1376:36: error: template argument 1 is invalid
1376 | struct extent<_Tp[_Size], _Uint>
| ^
/usr/include/c++/10/type_traits:1377:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1377 | : public integral_constant<std::size_t,
| ^~~~~~
In file included from /usr/include/stdlib.h:31,
from /usr/include/c++/10/bits/std_abs.h:38,
from /usr/include/c++/10/cmath:47,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
from fish.cpp:7:
/usr/lib/gcc/x86_64-linux-gnu/10/include/stddef.h:209:23: note: 'size_t' declared here
209 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
In file included from /usr/include/c++/10/bits/move.h:57,
from /usr/include/c++/10/bits/stl_pair.h:59,
from /usr/include/c++/10/bits/stl_algobase.h:64,
from /usr/include/c++/10/bits/specfun.h:45,
from /usr/include/c++/10/cmath:1927,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
from fish.cpp:7:
/usr/include/c++/10/type_traits:1378:24: error: '_Size' was not declared in this scope
1378 | _Uint == 0 ? _Size : extent<_Tp,
| ^~~~~
/usr/include/c++/10/type_traits:1379:28: error: template argument 1 is invalid
1379 | _Uint - 1>::value>
| ^
/usr/include/c++/10/type_traits:1379:28: note: invalid template non-type parameter
/usr/include/c++/10/type_traits:1384:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1384 | : public integral_constant<std::size_t,
| ^~~~~~
In file included from /usr/include/stdlib.h:31,
from /usr/include/c++/10/bits/std_abs.h:38,
from /usr/include/c++/10/cmath:47,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
from fish.cpp:7:
/usr/lib/gcc/x86_64-linux-gnu/10/include/stddef.h:209:23: note: 'size_t' declared here
209 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
In file included from /usr/include/c++/10/bits/move.h:57,
from /usr/include/c++/10/bits/stl_pair.h:59,
from /usr/include/c++/10/bits/stl_algobase.h:64,
from /usr/include/c++/10/bits/specfun.h:45,
from /usr/include/c++/10/cmath:1927,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
from fish.cpp:7:
/usr/include/c++/10/type_traits:1386:31: error: template argument 1 is invalid
1386 | _Uint - 1>::value>
| ^
/usr/include/c++/10/type_traits:1386:31: note: invalid template non-type parameter
/usr/include/c++/10/type_traits:1975:26: error: 'std::size_t' has not been declared
1975 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/10/type_traits:1976:30: error: '_Size' was not declared in this scope
1976 | struct remove_extent<_Tp[_Size]>
| ^~~~~
/usr/include/c++/10/type_traits:1976:36: error: template argument 1 is invalid
1976 | struct remove_extent<_Tp[_Size]>
| ^
/usr/include/c++/10/type_traits:1988:26: error: 'std::size_t' has not been declared
1988 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/10/type_traits:1989:35: error: '_Size' was not declared in this scope
1989 | struct remove_all_extents<_Tp[_Size]>
| ^~~~~
/usr/include/c++/10/type_traits:1989:41: error: template argument 1 is invalid
1989 | struct remove_all_extents<_Tp[_Size]>
| ^
/usr/include/c++/10/type_traits:2047:12: error: 'std::size_t' has not been declared
2047 | template<std::size_t _Len>
| ^~~
/usr/include/c++/10/type_traits:2052:23: error: '_Len' was not declared in this scope
2052 | unsigned char __data[_Len];
| ^~~~
/usr/include/c++/10/type_traits:2067:12: error: 'std::size_t' has not been declared
2067 | template<std::size_t _Len, std::size_t _Align =
| ^~~
/usr/include/c++/10/type_traits:2067:30: error: 'std::size_t' has not been declared
2067 | template<std::size_t _Len, std::size_t _Align =
| ^~~
/usr/include/c++/10/type_traits:2068:48: error: '_Len' was not declared in this scope
2068 | __alignof__(typename __aligned_storage_msa<_Len>::__type)>
| ^~~~
/usr/include/c++/10/type_traits:2068:52: error: template argument 1 is invalid
2068 | __alignof__(typename __aligned_storage_msa<_Len>::__type)>
| ^
/usr/include/c++/10/type_traits:2073:23: error: '_Len' was not declared in this scope
2073 | unsigned char __data[_Len];
| ^~~~
/usr/include/c++/10/type_traits:2074:37: error: '_Align' was not declared in this scope
2074 | struct __attribute__((__aligned__((_Align)))) { } __align;
| ^~~~~~
In file included from /usr/include/c++/10/bits/stl_algobase.h:64,
from /usr/include/c++/10/bits/specfun.h:45,
from /usr/include/c++/10/cmath:1927,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
from fish.cpp:7:
/usr/include/c++/10/bits/stl_pair.h:92:12: error: 'std::size_t' has not been declared
92 | template<std::size_t...>
| ^~~
/usr/include/c++/10/bits/stl_pair.h:449:36: error: 'std::size_t' has not been declared
449 | template<typename... _Args1, std::size_t... _Indexes1,
| ^~~
/usr/include/c++/10/bits/stl_pair.h:450:36: error: 'std::size_t' has not been declared
450 | typename... _Args2, std::size_t... _Indexes2>
| ^~~
/usr/include/c++/10/bits/stl_pair.h:453:27: error: '_Indexes1' was not declared in this scope
453 | _Index_tuple<_Indexes1...>, _Index_tuple<_Indexes2...>);
| ^~~~~~~~~
/usr/include/c++/10/bits/stl_pair.h:453:36: error: expected parameter pack before '...'
453 | _Index_tuple<_Indexes1...>, _Index_tuple<_Indexes2...>);
| ^~~
/usr/include/c++/10/bits/stl_pair.h:453:39: error: template argument 1 is invalid
453 | _Index_tuple<_Indexes1...>, _Index_tuple<_Indexes2...>);
| ^
/usr/include/c++/10/bits/stl_pair.h:453:55: error: '_Indexes2' was not declared in this scope
453 | _Index_tuple<_Indexes1...>, _Index_tuple<_Indexes2...>);
| ^~~~~~~~~
/usr/include/c++/10/bits/stl_pair.h:453:64: error: expected parameter pack before '...'
453 | _Index_tuple<_Indexes1...>, _Index_tuple<_Indexes2...>);
| ^~~
/usr/include/c++/10/bits/stl_pair.h:453:67: error: template argument 1 is invalid
453 | _Index_tuple<_Indexes1...>, _Index_tuple<_Indexes2...>);
| ^
In file included from /usr/include/c++/10/bits/stl_algobase.h:65,
from /usr/include/c++/10/bits/specfun.h:45,
from /usr/include/c++/10/cmath:1927,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
from fish.cpp:7:
/usr/include/c++/10/bits/stl_iterator_base_types.h:125:67: error: 'ptrdiff_t' does not name a type
125 | template<typename _Category, typename _Tp, typename _Distance = ptrdiff_t,
| ^~~~~~~~~
In file included from /usr/include/c++/10/bits/stl_algobase.h:65,
from /usr/include/c++/10/bits/specfun.h:45,
from /usr/include/c++/10/cmath:1927,
from /usr/include/x86_64-linu