답안 #960523

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
960523 2024-04-10T15:13:04 Z 8pete8 저울 (IOI15_scales) C++17
0 / 100
1 ms 604 KB
#include "scales.h"
#include<iostream>
#include<stack>
#include<map>
#include<vector>
#include<string>
#include<unordered_map>
#include <queue>
#include<cstring>
#include<limits.h>
#include <cassert>
#include<cmath>
#include<set>
#include<algorithm>
#include <iomanip>
#include<numeric> //gcd(a,b)
#include<bitset>
using namespace std;
#define ll long long
#define f first
#define endl "\n"
#define s second
#define pii pair<int,int>
#define ppii pair<int,pii>
#define vi vector<int>
#define pb push_back
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define F(n) for(int i=0;i<n;i++)
#define lb lower_bound
#define ub upper_bound
#define fastio ios::sync_with_stdio(false);cin.tie(NULL);
#pragma GCC optimize ("03,unroll-loops")
using namespace std;
void init(int T) {
    return;
}/*
void answer(int v[]){
    for(int i=0;i<6;i++)cout<<v[i]<<" ";
    cout<<'\n';
}
int arr[7];
int getLightest(int a,int b,int c){
    if(a==b||b==c||c==a)assert(0);
    if(arr[a]<arr[b]&&arr[a]<arr[c])return a;
    if(arr[b]<arr[a]&&arr[b]<arr[c])return b;
    return c;
}
int getHeaviest(int a,int b,int c){
    if(a==b||b==c||c==a)assert(0);
    if(arr[a]>arr[b]&&arr[a]>arr[c])return a;
    if(arr[b]>arr[a]&&arr[b]>arr[c])return b;
    return c;
}*/
void orderCoins(){
    int cnt=0;
    int x=getLightest(1,2,3),y=getLightest(4,5,6);
    vector<int>l,r;
    int curmx=1;
    int ans[6];
    vector<bool>done(7,0),done2(7,0);
    if(x==curmx)curmx++;
    int z=getLightest(x,y,curmx);
    done[z]=1;
    ans[cnt]=z,cnt++;
    auto solve=[&](){
        vector<int>have;
        for(int i=1;i<=6;i++)if(!done[i])have.pb(i);
        int t=getLightest(have[0],have[1],have[2]);
        curmx=1;
        for(int i=1;i<=6;i++)if(!done[i]&&i!=t){
            curmx=i;
            break;
        }
        t=getLightest(t,curmx,have.back());
        ans[cnt]=t,cnt++;
        done[t]=1;
    };
    if(z==x){
        vector<int>ask;
        for(int i=1;i<=3;i++)if(!done[i])ask.pb(i);
        ask.pb(y);
        z=getLightest(ask[0],ask[1],ask[2]);
        done[z]=1;
        ans[cnt]=z,cnt++;
        if(z>=1&&z<=3){
            curmx=4;
            if(curmx==y)curmx++;
            ask.clear();
            for(int i=1;i<=3;i++)if(!done[i])ask.pb(i);
            ask.pb(y);
            ask.pb(curmx);
            z=getLightest(ask[0],ask[1],ask[2]);
            done[z]=1;
            ans[cnt]=z,cnt++;
        }
        else solve();
    }
    else{
        vector<int>ask;
        for(int i=4;i<=6;i++)if(!done[i])ask.pb(i);
        ask.pb(x);
        z=getLightest(ask[0],ask[1],ask[2]);
        done[z]=1;
        ans[cnt]=z,cnt++;
        if(z>=4&&z<=6){
            curmx=1;
            if(curmx==y)curmx++;
            ask.clear();
            for(int i=4;i<=6;i++)if(!done[i])ask.pb(i);
            ask.pb(x);
            ask.pb(curmx);
            z=getLightest(ask[0],ask[1],ask[2]);
            done[z]=1;
            ans[cnt]=z,cnt++;
        }
        else solve();
    }
    vector<int>have;
    for(int i=1;i<=6;i++)if(!done[i])have.pb(i);
    z=getLightest(have[0],have[1],have[2]);
    done[z]=1;
    ans[cnt]=z,cnt++;
    have.clear();
    for(int i=1;i<=6;i++)if(!done[i])have.pb(i);
    for(int i=1;i<=6;i++)if(done[i]){
        have.pb(i);
        break;
    }
    z=getHeaviest(have[0],have[1],have[2]);
    done[z]=1;
    ans[cnt+1]=z;
    for(int i=1;i<=6;i++)if(!done[i])ans[cnt]=i;
    answer(ans);
}/*
int32_t main(){
    int t;cin>>t;
    while(t--){
        vector<pii>cor;
        for(int i=1;i<=6;i++)cin>>arr[i],cor.pb({arr[i],i});
        orderCoins();
        sort(all(cor));
        for(auto i:cor)cout<<i.s<<" ";
        cout<<'\n';
    }
}*/

Compilation message

scales.cpp: In function 'void init(int)':
scales.cpp:35:15: warning: unused parameter 'T' [-Wunused-parameter]
   35 | void init(int T) {
      |           ~~~~^
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 6
2 Partially correct 1 ms 348 KB Output is partially correct
3 Runtime error 1 ms 348 KB Execution killed with signal 6
4 Runtime error 1 ms 348 KB Execution killed with signal 6
5 Runtime error 1 ms 348 KB Execution killed with signal 6
6 Runtime error 1 ms 348 KB Execution killed with signal 6
7 Runtime error 1 ms 348 KB Execution killed with signal 6
8 Runtime error 1 ms 348 KB Execution killed with signal 6
9 Partially correct 0 ms 348 KB Output is partially correct
10 Partially correct 0 ms 348 KB Output is partially correct
11 Runtime error 1 ms 348 KB Execution killed with signal 6
12 Partially correct 0 ms 348 KB Output is partially correct
13 Runtime error 1 ms 344 KB Execution killed with signal 6
14 Runtime error 1 ms 348 KB Execution killed with signal 6
15 Runtime error 1 ms 348 KB Execution killed with signal 6
16 Runtime error 1 ms 544 KB Execution killed with signal 6
17 Partially correct 1 ms 344 KB Output is partially correct
18 Runtime error 1 ms 604 KB Execution killed with signal 6
19 Runtime error 1 ms 348 KB Execution killed with signal 6
20 Runtime error 1 ms 348 KB Execution killed with signal 6
21 Runtime error 1 ms 348 KB Execution killed with signal 6
22 Partially correct 0 ms 348 KB Output is partially correct
23 Runtime error 1 ms 600 KB Execution killed with signal 6
24 Partially correct 1 ms 344 KB Output is partially correct
25 Partially correct 1 ms 348 KB Output is partially correct
26 Partially correct 0 ms 348 KB Output is partially correct
27 Runtime error 1 ms 348 KB Execution killed with signal 6
28 Partially correct 1 ms 348 KB Output is partially correct
29 Partially correct 1 ms 344 KB Output is partially correct
30 Runtime error 1 ms 344 KB Execution killed with signal 6
31 Runtime error 1 ms 348 KB Execution killed with signal 6
32 Runtime error 1 ms 348 KB Execution killed with signal 6
33 Runtime error 1 ms 348 KB Execution killed with signal 6
34 Runtime error 1 ms 604 KB Execution killed with signal 6
35 Runtime error 1 ms 348 KB Execution killed with signal 6
36 Runtime error 1 ms 348 KB Execution killed with signal 6
37 Partially correct 0 ms 344 KB Output is partially correct
38 Partially correct 0 ms 348 KB Output is partially correct
39 Partially correct 1 ms 348 KB Output is partially correct
40 Partially correct 1 ms 348 KB Output is partially correct