답안 #1075406

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1075406 2024-08-26T05:38:38 Z Ausp3x Text editor (CEOI24_editor) C++17
5 / 100
1 ms 348 KB
// 人外有人,天外有天
// author: Ausp3x

#pragma GCC optimize("O1, O2, O3, Ofast, unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define pb push_back
// #define DEBUG
typedef long long    lng;
typedef __int128     lli;
template<class T> 
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

int const INF32 = 0x3f3f3f3f;
lng const INF64 = 0x3f3f3f3f3f3f3f3f;

void solve() {
    int n;
    cin >> n;
    int sl, sc;
    cin >> sl >> sc;
    int el, ec;
    cin >> el >> ec;
    vector<int> C(n + 1);
    for (int i = 1; i <= n; i++) {
        cin >> C[i];
        C[i]++;
    }

    if (n <= 2) {
        if (sl == 2 && el == 2) {
            cout << 0 << endl;
            return;
        }

        if (sl == 1 && el == 2) {
            cout << 1 << endl;
            return;
        }

        if (sl == 2 && el == 1) {
            cout << min(ec, C[1] - ec + 1) << endl;
            return;
        }

        cout << min({abs(ec - sc), 2 + ec - 1, 2 + C[1] - ec}) << endl;

        return;
    }

    
     
    return;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int t = 1;
    // cin >> t;
    while (t--) {
        solve();
    }

    return 0;
}

Compilation message

Main.cpp:4:55: warning: bad option '-f O2' to pragma 'optimize' [-Wpragmas]
    4 | #pragma GCC optimize("O1, O2, O3, Ofast, unroll-loops")
      |                                                       ^
Main.cpp:4:55: warning: bad option '-f O3' to pragma 'optimize' [-Wpragmas]
Main.cpp:4:55: warning: bad option '-f Ofast' to pragma 'optimize' [-Wpragmas]
Main.cpp:4:55: warning: bad option '-f unroll-loops' to pragma 'optimize' [-Wpragmas]
Main.cpp:22:12: warning: bad option '-f O2' to attribute 'optimize' [-Wattributes]
   22 | void solve() {
      |            ^
Main.cpp:22:12: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:22:12: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes]
Main.cpp:22:12: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:61:10: warning: bad option '-f O2' to attribute 'optimize' [-Wattributes]
   61 | int main() {
      |          ^
Main.cpp:61:10: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:61:10: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes]
Main.cpp:61:10: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Incorrect 1 ms 348 KB Output isn't correct
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -