제출 #1007690

#제출 시각아이디문제언어결과실행 시간메모리
1007690Ausp3xRobots (IOI13_robots)C++17
14 / 100
82 ms14424 KiB
// 人外有人,天外有天
// author: Ausp3x

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

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

lng fastPow(lng x, lng y) {
    if (y == 0)
        return 1;
    
    lng res = 1;
    while (y > 0) {
        if (y & 1) {
            res *= x;
        }
 
        y >>= 1;
        x *= x;
    }
 
    return res;
}
int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) {
    if (T == 2 && A + B == 2) {
        vector<pair<int, int>> robots;
        for (int i = 0; i < A; i++)
            robots.push_back({X[i], 2 * INF32});
        for (int i = 0; i < B; i++)
            robots.push_back({2 * INF32, Y[i]});

        int ans = -1, l = robots.size();
        for (int i = 0; i < fastPow(l, T); i++) {
            int ii = i;
            vector<int> cnts(l);
            for (int j = 0; j < T; j++) {
                if (W[j] < robots[ii % l].first && S[j] < robots[ii % l].second)
                    cnts[ii % l]++;
            
                ii /= l;
            }

            if (accumulate(cnts.begin(), cnts.end(), 0) < T)
                continue;

            int max_cnt = 0;
            for (int j = 0; j < T; j++)
                max_cnt = max(max_cnt, cnts[j]);

            ans = (ans == -1 ? max_cnt : min(ans, max_cnt));
        }

        return ans;
    }

    return 0;
}

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

    int t = 1;
    cin >> t;
    while (t--) {
        int A, B, T;
        cin >> A >> B >> T;
        int X[A];
        for (int i = 0; i < A; i++)
            cin >> X[i];
        int Y[B];
        for (int i = 0; i < B; i++)
            cin >> Y[i];
        int W[T], S[T];
        for (int i = 0; i < T; i++)
            cin >> W[i] >> S[i];

        cout << putaway(A, B, T, X, Y, W, S);
    }

    return 0;
}
//*/

컴파일 시 표준 에러 (stderr) 메시지

robots.cpp:4:55: warning: bad option '-f O2' to pragma 'optimize' [-Wpragmas]
    4 | #pragma GCC optimize("O1, O2, O3, Ofast, unroll-loops")
      |                                                       ^
robots.cpp:4:55: warning: bad option '-f O3' to pragma 'optimize' [-Wpragmas]
robots.cpp:4:55: warning: bad option '-f Ofast' to pragma 'optimize' [-Wpragmas]
robots.cpp:4:55: warning: bad option '-f unroll-loops' to pragma 'optimize' [-Wpragmas]
In file included from robots.cpp:7:
robots.h:8:68: warning: bad option '-f O2' to attribute 'optimize' [-Wattributes]
    8 | int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]);
      |                                                                    ^
robots.h:8:68: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
robots.h:8:68: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes]
robots.h:8:68: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
robots.h:8:68: warning: bad option '-f O2' to attribute 'optimize' [-Wattributes]
robots.h:8:68: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
robots.h:8:68: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes]
robots.h:8:68: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
robots.cpp:17:25: warning: bad option '-f O2' to attribute 'optimize' [-Wattributes]
   17 | lng fastPow(lng x, lng y) {
      |                         ^
robots.cpp:17:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
robots.cpp:17:25: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes]
robots.cpp:17:25: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
robots.cpp:33:68: warning: bad option '-f O2' to attribute 'optimize' [-Wattributes]
   33 | int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) {
      |                                                                    ^
robots.cpp:33:68: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
robots.cpp:33:68: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes]
robots.cpp:33:68: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...