제출 #604261

#제출 시각아이디문제언어결과실행 시간메모리
6042618e7저울 (IOI15_scales)C++17
0 / 100
1 ms340 KiB
//Challenge: Accepted #include <bits/stdc++.h> using namespace std; #ifdef zisk void debug(){cout << endl;} template<class T, class ... U> void debug(T a, U ... b){cout << a << " ", debug(b...);} template<class T> void pary(T l, T r){ while (l != r) cout << *l << " ", l++; cout << endl; } #else #define debug(...) 0 #define pary(...) 0 #endif #define ll long long #define maxn 100005 #define pii pair<int, int> #define ff first #define ss second #include "scales.h" void init(int T) { /* ... */ } void orderCoins() { int n = 3; int a[3] = {1, 2, 3}, b[3] = {4, 5, 6}; int ind = find(a, a + n, getHeaviest(a[0], a[1], a[2])) - a; swap(a[ind], a[2]); ind = find(a, a + n, getLightest(a[0], a[1], a[2])) - a; swap(a[ind], a[0]); ind = find(b, b + n, getHeaviest(b[0], b[1], b[2])) - b; swap(b[ind], b[2]); ind = find(b, b + n, getLightest(b[0], b[1], b[2])) - b; swap(b[ind], b[0]); int ret[6]; int i1 = 0, i2 = 0; for (int i = 0;i < 6;i++) { if (i1 == 3) ret[i] = b[i2]++; else if (i2 == 3) ret[i] = a[i1]++; else { int comp; if (i1 < 2 || i2 < 2) { if (i1 < 2) comp = a[2]; else if (i2 < 2) comp = b[2]; int res = getLightest(comp, a[i1], b[i2]); if (res == a[i1]) ret[i] = a[i1++]; else ret[i] = b[i2++]; } else { comp = a[0]; int res = getHeaviest(comp, a[i1], b[i2]); if (res != a[i1]) ret[i] = a[i1++]; else ret[i] = b[i2++]; } } } answer(ret); }

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

scales.cpp: In function 'void init(int)':
scales.cpp:22:15: warning: unused parameter 'T' [-Wunused-parameter]
   22 | void init(int T) {
      |           ~~~~^
scales.cpp: In function 'void orderCoins()':
scales.cpp:30:58: warning: conversion from 'long int' to 'int' may change value [-Wconversion]
   30 |  int ind = find(a, a + n, getHeaviest(a[0], a[1], a[2])) - a;
      |            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
scales.cpp:32:54: warning: conversion from 'long int' to 'int' may change value [-Wconversion]
   32 |  ind = find(a, a + n, getLightest(a[0], a[1], a[2])) - a;
      |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
scales.cpp:35:54: warning: conversion from 'long int' to 'int' may change value [-Wconversion]
   35 |  ind = find(b, b + n, getHeaviest(b[0], b[1], b[2])) - b;
      |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
scales.cpp:37:54: warning: conversion from 'long int' to 'int' may change value [-Wconversion]
   37 |  ind = find(b, b + n, getLightest(b[0], b[1], b[2])) - b;
      |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...