Submission #7560593
Source Code Expand
#include <bits/stdc++.h> using namespace std; #define int long long #define FOR(i, s, n) for (int i = (s); i < (int)(n); i++) #define RFOR(i, s, n) for (int i = (n) - 1; i >= (int)(s); i--) #define REP(i, n) FOR(i, 0, n) #define RREP(i, n) RFOR(i, 0, n) #define ALL(a) a.begin(), a.end() constexpr long long INF = 1e18; template<class T>inline bool CHMAX(T&a,T b){if(a<b){a=b;return true;}return false;} template<class T>inline bool CHMIN(T&a,T b){if(a>b){a=b;return true;}return false;} #define IN(a, x, b) (a<=x && x<b) signed main(){ int dir,dis; cin >> dir >> dis; dis *= 100; dis /= 60; if(dis%10<=4)dis -= dis % 10; else dis = (dis / 10 + 1) * 10; dis /= 10; dir *= 10; int level = 0,tmp = 1125; vector<string>s={"N","NNE","NE","ENE","E","ESE","SE","SSE","S","SSW","SW","WSW","W","WNW","NW","NNW"}; while(dir>=tmp){ level++; tmp += 2250; } level = min(level,s.size()-1); vector<int>t = {0,2,15,33,54,79,107,138,171,207,244,284,326}; REP(i,t.size()-1){ //cout << i << " " << t[i] << " " << dis << " " << t[i+1] << endl; if(IN(t[i],dis,t[i+1]+1)){ if(i)cout<<s[level]<<" "<<i<<endl; else cout<<'C'<<" "<<0<<endl; return 0; } } cout<<s[level]<<" "<<12<<endl; }
Submission Info
Submission Time | |
---|---|
Task | C - 風力観測 |
User | chocopuu |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1239 Byte |
Status | CE |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:29:30: error: no matching function for call to ‘min(long long int&, std::vector<std::basic_string<char> >::size_type)’ level = min(level,s.size()-1); ^ In file included from /usr/include/c++/5/bits/char_traits.h:39:0, from /usr/include/c++/5/ios:40, from /usr/include/c++/5/istream:38, from /usr/include/c++/5/sstream:38, from /usr/include/c++/5/complex:45, from /usr/include/c++/5/ccomplex:38, from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52, from ./Main.cpp:1: /usr/include/c++/5/bits/stl_algobase.h:195:5: note: candidate: template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&) min(const _Tp& __a, const _Tp& __b) ^ /usr/include/c++/5/bits/stl_algobase.h:195:5: note: template argument deduction/substitution failed: ./Main.cpp:29:30: note: deduced conflicting types for parame...