제출 #1077291

#제출 시각아이디문제언어결과실행 시간메모리
1077291Trumling저울 (IOI15_scales)C++14
45.45 / 100
1 ms436 KiB
#include "scales.h" #include<bits/stdc++.h> using namespace std; #define F first #define S second #define pb push_back #define INF 99999999999999 #define all(x) x.begin(),x.end() typedef long long ll; ll n=6; void init(int T) { /* ... */ return ; } void orderCoins() { /* ... */ vector<bool>vis(n+1,0); int ans[6]; ll sz=n; while(sz) { vector<ll>v; v.pb(0); for(int i=1;i<=n;i++) if(!vis[i]) v.pb(i); ll mini=v[1]; ll lose=v[1]; for(int i=2;i<=sz;i+=2) { if(i+1<=sz) { //cout<<"1 "<<mini<<','<<v[i]<<','<<v[i+1]<<'\n'; mini=getLightest(mini,v[i],v[i+1]); if(mini!=v[i]) lose=i; if(mini!=v[i+1]) lose=i+1; } else if(i<=sz) { if(sz==2) { ll curr=getHeaviest(mini,v[i],ans[0]); if(curr==mini) mini=v[i]; } else { // cout<<"2 "<<mini<<','<<v[i]<<','<<v[lose]<<'\n'; mini=getLightest(mini,v[i],v[lose]); } } } ans[n-sz]=mini; sz--; vis[mini]=1; } answer(ans); return ; }

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

scales.cpp: In function 'void init(int)':
scales.cpp:13:15: warning: unused parameter 'T' [-Wunused-parameter]
   13 | void init(int T) {
      |           ~~~~^
scales.cpp: In function 'void orderCoins()':
scales.cpp:40:34: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   40 |                 mini=getLightest(mini,v[i],v[i+1]);
      |                                  ^~~~
scales.cpp:40:50: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' may change value [-Wconversion]
   40 |                 mini=getLightest(mini,v[i],v[i+1]);
      |                                                  ^
scales.cpp:40:50: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' may change value [-Wconversion]
scales.cpp:53:41: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   53 |                     ll curr=getHeaviest(mini,v[i],ans[0]);
      |                                         ^~~~
scales.cpp:53:57: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' may change value [-Wconversion]
   53 |                     ll curr=getHeaviest(mini,v[i],ans[0]);
      |                                                         ^
scales.cpp:61:34: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   61 |                 mini=getLightest(mini,v[i],v[lose]);
      |                                  ^~~~
scales.cpp:61:51: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' may change value [-Wconversion]
   61 |                 mini=getLightest(mini,v[i],v[lose]);
      |                                                   ^
scales.cpp:61:51: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' may change value [-Wconversion]
scales.cpp:68:19: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   68 |         ans[n-sz]=mini;
      |                   ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...