답안 #899969

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
899969 2024-01-07T11:49:18 Z I_am_Polish_Girl Abracadabra (CEOI22_abracadabra) C++14
0 / 100
3000 ms 48208 KB
/*
* powered by ANDRIY POPYK
* in honor of  SEGMENT DECOMPOSITION and N ^ (log(N)) and hate_club_Dasha_Lobas
* I hate GeZhiyuan
* fuck you
*/


#pragma GCC optimize("O3")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")
#pragma GCC target("avx,avx2,sse,sse2,sse3,sse4,popcnt")


#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <vector>

using namespace std;
typedef long long ll;

#define int long long

int mod = 1000000007;
int inf = 1000000000000000000;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    int times_ = 1;

    //cin >> times_;

    while (times_--)
    {
        int n , k;
        cin >> n >> k;

        vector <int> a(n);


        for (int i = 0; i < n; i++)
            cin >> a[i];

        vector <vector <pair <int, int>>> q(n+1);

        int col = n;

        vector <int> ans(k , -1);
        for (int i = 0; i < k; i++)
        {
            int t, ind;

            cin >> t >> ind;

            q[min(t , col)].push_back({ ind , i });
        }

        for (int i = 0; i < n; i++)
        {
            vector <int> b;


            int ind1 = 0;
            int ind2 = n / 2;

            for (int j = 0; j < n; j++)
            {
                if (ind1 == n / 2)
                {
                    b.push_back(a[ind2]);
                    ind2++;
                    continue;
                }

                if (ind2 == n)
                {
                    b.push_back(a[ind1]);
                    ind1++;
                    continue;
                }

                if (a[ind1] < a[ind2])
                {
                    b.push_back(a[ind1]);
                    ind1++;
                    continue;
                }
                else
                {
                    b.push_back(a[ind2]);
                    ind2++;
                    continue;
                }
            }

            for (int j = 0; j < q[i].size(); j++)
            {
                ans[q[i][j].second] = a[q[i][j].first - 1];
            }

            a = b;
            /*
            for (int i = 0; i < n; i++)
                cout << a[i] << " ";
            cout << "\n**\n";

            */
        }


        for (int i = 0; i < k; i++)
            cout << ans[i] << "\n";

        
    }
}

Compilation message

Main.cpp:11: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
   11 | #pragma GCC optimization("unroll-loops")
      | 
Main.cpp: In function 'int main()':
Main.cpp:109:31: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  109 |             for (int j = 0; j < q[i].size(); j++)
      |                             ~~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 162 ms 39836 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3019 ms 48208 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3013 ms 10928 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 162 ms 39836 KB Output isn't correct
2 Halted 0 ms 0 KB -