Submission #927046

#TimeUsernameProblemLanguageResultExecution timeMemory
927046PragmatismMartian DNA (IOI16_dna)C++17
Compilation error
0 ms0 KiB
//Bismillahir-Rahmanir-Rahim #include <bits/stdc++.h> #pragma comment(linker, "/stack:200000000") #pragma GCC optimize("O1,O2,O3,Ofast,unroll-loops") #pragma GCC target("sse,sse2,sse3,sse4,sse4.1,sse4.2,popcnt,avx,avx2") #define pb push_back #define pii pair <int, int> #define pll pair <long long, long long> #define pld pair <long double, long double> #define ll long long #define ld long double #define x first #define y second #define all(v) v.begin(),v.end() #define sz(s) (int)s.size() #define skip continue #define bpop(x) (ll)__builtin_popcountll(x) using namespace std; const int N = 2e5 + 7; const int M = 5e3 + 7; const int maxA = 2e6 + 7; const int inf = 1e9 + 7; const ll INF = 2e18 + 7; const int MOD = 1e9 + 7; const ld eps = 1e-9; pii dir[] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}}; //mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); //#define int long long int n, k, q, a[N], req[N], t[4 * N]; void update(int v, int tl, int tr, int pos, int x) { if (tl == tr) { t[v] += x; return; } int mid = (tl + tr) / 2; if (pos <= mid)update(v * 2, tl, mid, pos, x); else update(v * 2 + 1, mid + 1, tr, pos, x); t[v] = max(t[v * 2], t[v * 2 + 1]); } void solve() { cin >> n >> k >> q; for (int i = 1;i <= n;i++)cin >> a[i], a[i]++; for (int i = 1;i <= q;i++) { int x, cnt; cin >> x >> cnt; req[++x] = cnt, update(1, 1, n, x, cnt); } int r = 0, ans = inf; for (int l = 1;l <= n;l++) { while (r < n && t[1] > 0)r++, update(1, 1, n, a[r], -1); if (t[1] <= 0)ans = min(ans, r - l + 1); update(1, 1, n, a[l], 1); } if (ans == inf)cout << "impossible"; else cout << ans; } signed main() { //srand(time(NULL)); ios_base::sync_with_stdio(0); cout.tie(0); //freopen("tests.in", "r", stdin); //freopen("milkorder.out", "w", stdout); int test = 1; //cin >> test; for (int t = 1;t <= test;t++) { //cout << "Case " << t << ": "; solve(); } return 0; }

Compilation message (stderr)

dna.cpp:4: warning: ignoring '#pragma comment ' [-Wunknown-pragmas]
    4 | #pragma comment(linker, "/stack:200000000")
      | 
grader.cpp: In function 'bool make_test(std::string)':
grader.cpp:14:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |  for (int i = 0; i < p.size(); i++) {
      |                  ~~^~~~~~~~~~
grader.cpp:23:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |  for (int i = 1; i <= ss.size(); i++) {
      |                  ~~^~~~~~~~~~~~
grader.cpp:28:13: warning: comparison of integer expressions of different signedness: '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |   if (pr[i] == p.size()) {
/usr/bin/ld: /tmp/ccg8rNAL.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccp9GeRL.o:dna.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccg8rNAL.o: in function `main':
grader.cpp:(.text.startup+0x4e): undefined reference to `analyse[abi:cxx11](int, int)'
collect2: error: ld returned 1 exit status