結果
問題 | No.1041 直線大学 |
ユーザー | first_vil |
提出日時 | 2020-05-01 21:45:02 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
CE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 2,781 bytes |
コンパイル時間 | 1,922 ms |
コンパイル使用メモリ | 196,052 KB |
最終ジャッジ日時 | 2025-01-10 04:33:32 |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp: In instantiation of ‘std::istream& operator>>(std::istream&, std::vector<_Tp>&) [with T = std::pair<long double, long double>; std::istream = std::basic_istream<char>]’: main.cpp:42:40: required from here main.cpp:30:99: error: no match for ‘operator>>’ (operand types are ‘std::istream’ {aka ‘std::basic_istream<char>’} and ‘std::pair<long double, long double>’) 30 | template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; } | ~~~^~~~~~~~~ In file included from /usr/include/c++/13/sstream:40, from /usr/include/c++/13/complex:45, from /usr/include/c++/13/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:127, from main.cpp:1: /usr/include/c++/13/istream:325:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ 325 | operator>>(void*& __p) | ^~~~~~~~ /usr/include/c++/13/istream:325:25: note: no known conversion for argument 1 from ‘std::pair<long double, long double>’ to ‘void*&’ 325 | operator>>(void*& __p) | ~~~~~~~^~~ /usr/include/c++/13/istream:224:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ 224 | operator>>(long double& __f) | ^~~~~~~~ /usr/include/c++/13/istream:224:31: note: no known conversion for argument 1 from ‘std::pair<long double, long double>’ to ‘long double&’ 224 | operator>>(long double& __f) |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using VI = vector<int>; using VL = vector<ll>; using VS = vector<string>; template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>; #define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i)) #define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i)) #define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i)) #define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i)) #define each(i, a) for(auto &i : a) #define SORT(i) sort((i).begin(),(i).end()) #define rSORT(i,a) sort((i).begin(),(i).end(),(a)) #define all(i) (i).begin(),(i).end() #define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x)) #define line cout << "-----------------------------\n" #define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ") #define stop system("pause") constexpr ll INF = 1000000000; constexpr ll LLINF = 1LL << 60; constexpr ll mod = 1000000007; constexpr ll MOD = 998244353; constexpr ld eps = 1e-10; constexpr ld pi = 3.1415926535897932; 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; } inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); } template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; } template<class T>inline istream& operator>>(istream& is, deque<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; } template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; } template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); } template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); } template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); } template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); } int main() { init(); int n; cin >> n; vector<pair<ld, ld>> xy(n); cin >> xy; int ans = 0; map<pair<int, int>, int> m; map<int, int> X, Y; each(i, xy)++X[i.first], ++Y[i.second]; each(i, X)chmax(ans, i.second); each(i, Y)chmax(ans, i.second); FOR(i, 0, n) { m.clear(); FOR(j, 0, n) { int a = xy[j].first - xy[i].first, b = xy[j].second - xy[i].second; if (a == 0 || b == 0)continue; if (a < 0)a *= -1, b *= -1; int g = gcd(a, b); ++m[{a / g, b / g }]; } each(j, m)chmax(ans, j.second + 1); } cout << ans << "\n"; }