Submission #1287858

#TimeUsernameProblemLanguageResultExecution timeMemory
1287858KickingKunBubble Sort 2 (JOI18_bubblesort2)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define ull unsigned long long #define ld long double #define bigint __int128 #define emb emplace_back #define pb push_back #define pii pair <int, int> #define fi first #define se second #define all(v) v.begin(), v.end() #define Task "" #define MASK(k) (1ull << k) #define bitcnt(k) __builtin_popcount(k) #define testBit(n, k) ((n >> k) & 1) #define flipBit(n, k) (n ^ (1ll << k)) #define offBit(n, k) (n & ~MASK(k)) #define onBit(n, k) (n | (1ll << k)) template <class T> bool minimize(T &a, T b) {if (a > b) {a = b; return true;} return false;} template <class T> bool maximize(T &a, T b) {if (a < b) {a = b; return true;} return false;} const int N = 5e5 + 5, lim = 60, mod = 1e9 + 7; const ll INF = 1e18; int n, q, a[N]; int x[N], v[N]; namespace sub2 { void solve() { for (int _ = 1; _ <= q; _++) { a[x[_]] = v[_]; vector <int> b(a, a + n + 1); sort (b.begin() + 1, b.end()); int ans = 0; for (int i = 1; i <= n; i++) { int k = upper_bound(b.begin() + 1, b.end(), a[i]) - b.begin() - 1; maximize(ans, i - k); } cout << ans << '\n'; } } } namespace sub3 { void solve() { } } namespace sub4 { void solve() { } } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); if (fopen(Task".inp", "r")) { freopen(Task".inp", "r", stdin); freopen(Task".out", "w", stdout); } cin >> n >> q; for (int i = 1; i <= n; i++) cin >> a[i]; for (int i = 0; i < q; i++) cin >> x[i] >> v[i], ++x[i]; if (max(n, q) <= 8e3) sub2::solve(); else if (max(*max_element(a + 1, a + n + 1), *max_element(v, v + q)) <= 100) sub3::solve(); else sub4::solve(); }

Compilation message (stderr)

bubblesort2.cpp: In function 'int main()':
bubblesort2.cpp:65:24: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   65 |                 freopen(Task".inp", "r", stdin);
      |                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
bubblesort2.cpp:66:24: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   66 |                 freopen(Task".out", "w", stdout);
      |                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/bin/ld: /tmp/cclpHjeg.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cc2U6sl0.o:bubblesort2.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/cclpHjeg.o: in function `main':
grader.cpp:(.text.startup+0x189): undefined reference to `countScans(std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status