Submission #60755

#TimeUsernameProblemLanguageResultExecution timeMemory
60755istlemin저울 (IOI15_scales)C++14
0 / 100
4 ms628 KiB
#include "scales.h"
#include<bits/stdc++.h>

using namespace std;

#define rep(i,a,b) for(int i = a; i<int(b);++i)
#define all(v) v.begin(),v.end()
#define sz(v) v.size()
#define trav(a,c) for(auto a: c)

typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll,ll> pii;

vector<tuple<ll,ll,ll,ll> > heaviestOps;

ll heaviest(ll a,ll b,ll c){
if(a==b||b==c||c==a) return -1;
    ll res = getHeaviest(a+1,b+1,c+1)-1;
	heaviestOps.emplace_back(a,b,c,res);
    return res;
}

vector<tuple<ll,ll,ll,ll> > lightestOps;

ll lightest(ll a,ll b,ll c){
if(a==b||b==c||c==a) return -1;
    ll res = getLightest(a+1,b+1,c+1)-1;
	lightestOps.emplace_back(a,b,c,res);
    return res;
}


void init(int T) {
    heaviestOps.clear();
}

void orderCoins() {
    rep(i,0,50){
        heaviest(rand()%6,rand()%6,rand()%6);
    }
    rep(i,0,50){
        lightest(rand()%6,rand()%6,rand()%6);
    }
    vi W = {0,1,2,3,4,5};
    do{
		bool fail = false;
        rep(i,0,heaviestOps.size()){
            ll a,b,c,res;
            tie(a,b,c,res) = heaviestOps[i];
            if(max(W[a],max(W[b],W[c]))!=W[res])
				fail = true;
        }
        rep(i,0,lightestOps.size()){
            ll a,b,c,res;
            tie(a,b,c,res) = lightestOps[i];
            if(min(W[a],min(W[b],W[c]))!=W[res])
				fail = true;
        }
        if(!fail) {
			int ans[6];
			rep(i,0,6) ans[W[i]] = i;
			/*rep(i,0,6){
				cout<<ans[i]+1<<" ";
			}
			cout<<endl;
			*/
			answer(ans);
			return;
        }
    } while(next_permutation(all(W)));
}

Compilation message (stderr)

In file included from grader.c:2:0:
graderlib.c: In function 'void answer(int*)':
graderlib.c:53:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
     if (_ghksjhdfkae19ga_ > 1) 
     ^~
graderlib.c:56:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
  for (i = 0; i < 6; i++) {
  ^~~
scales.cpp: In function 'll heaviest(ll, ll, ll)':
scales.cpp:19:27: warning: conversion to 'int' from 'll {aka long long int}' may alter its value [-Wconversion]
     ll res = getHeaviest(a+1,b+1,c+1)-1;
                          ~^~
scales.cpp:19:31: warning: conversion to 'int' from 'll {aka long long int}' may alter its value [-Wconversion]
     ll res = getHeaviest(a+1,b+1,c+1)-1;
                              ~^~
scales.cpp:19:35: warning: conversion to 'int' from 'll {aka long long int}' may alter its value [-Wconversion]
     ll res = getHeaviest(a+1,b+1,c+1)-1;
                                  ~^~
scales.cpp: In function 'll lightest(ll, ll, ll)':
scales.cpp:28:27: warning: conversion to 'int' from 'll {aka long long int}' may alter its value [-Wconversion]
     ll res = getLightest(a+1,b+1,c+1)-1;
                          ~^~
scales.cpp:28:31: warning: conversion to 'int' from 'll {aka long long int}' may alter its value [-Wconversion]
     ll res = getLightest(a+1,b+1,c+1)-1;
                              ~^~
scales.cpp:28:35: warning: conversion to 'int' from 'll {aka long long int}' may alter its value [-Wconversion]
     ll res = getLightest(a+1,b+1,c+1)-1;
                                  ~^~
scales.cpp: In function 'void init(int)':
scales.cpp:34:15: warning: unused parameter 'T' [-Wunused-parameter]
 void init(int T) {
               ^
#Verdict Execution timeMemoryGrader output
Fetching results...