Submission #1098907

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
10989072024-10-10 10:02:39alexander_707070Scales (IOI15_scales)C++14
71.43 / 100
58 ms596 KiB
#include<bits/stdc++.h>
#include "scales.h"
using namespace std;
vector<int> p;
vector< vector<int> > perms,news;
int getmin(vector<int> s,int a,int b,int c){
if(s[a]<s[b] and s[a]<s[c])return 0;
if(s[b]<s[c] and s[b]<s[a])return 1;
return 2;
}
int getmax(vector<int> s,int a,int b,int c){
if(s[a]>s[b] and s[a]>s[c])return 0;
if(s[b]>s[c] and s[b]>s[a])return 1;
return 2;
}
int getmed(vector<int> s,int a,int b,int c){
if(s[a]<max(s[b],s[c]) and s[a]>min(s[b],s[c]))return 0;
if(s[b]<max(s[a],s[c]) and s[b]>min(s[a],s[c]))return 1;
return 2;
}
int getbro(vector<int> s,int a,int b,int c,int d){
if(s[a]<s[d] and s[b]<s[d] and s[c]<s[d])return getmin(s,a,b,c);
if(s[a]>s[d] and (s[b]<s[d] or s[a]<s[b]) and (s[c]<s[d] or s[a]<s[c]))return 0;
if(s[b]>s[d] and (s[a]<s[d] or s[b]<s[a]) and (s[c]<s[d] or s[b]<s[c]))return 1;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

scales.cpp: In function 'void solve(std::vector<std::vector<int> >)':
scales.cpp:37:34: warning: declaration of 'perms' shadows a global declaration [-Wshadow]
   37 | void solve(vector< vector<int> > perms){
      |            ~~~~~~~~~~~~~~~~~~~~~~^~~~~
scales.cpp:6:23: note: shadowed declaration is here
    6 | vector< vector<int> > perms,news;
      |                       ^~~~~
scales.cpp:38:22: warning: conversion from 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} to 'int' may change value [-Wconversion]
   38 |  int minsz=perms.size();
      |            ~~~~~~~~~~^~
scales.cpp:46:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   46 |      for(int t=0;t<perms.size();t++){
      |                  ~^~~~~~~~~~~~~
scales.cpp:69:34: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   69 |                     for(int t=0;t<perms.size();t++){
      |                                 ~^~~~~~~~~~~~~
scales.cpp: In function 'void init(int)':
scales.cpp:83:15: warning: unused parameter 'T' [-Wunused-parameter]
   83 | void init(int T) {
      |           ~~~~^
scales.cpp: In function 'void orderCoins()':
scales.cpp:106:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  106 |             for(int t=0;t<perms.size();t++){
      |                         ~^~~~~~~~~~~~~
scales.cpp:115:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  115 |             for(int t=0;t<perms.size();t++){
      |                         ~^~~~~~~~~~~~~
scales.cpp:124:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  124 |             for(int t=0;t<perms.size();t++){
      |                         ~^~~~~~~~~~~~~
scales.cpp:133:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  133 |             for(int t=0;t<perms.size();t++){
      |                         ~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...