QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#523363 | #6385. Swords | flying_dream | Compile Error | / | / | C++23 | 5.1kb | 2024-08-18 09:23:30 | 2024-08-18 09:23:30 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
#pragma GCC target("avx")
#pragma GCC optimize(3,"Ofast","inline")
using namespace std;
template<typename T> inline void read(T &x){
x=0;
int f=1;
char ch=getchar();
while(ch<'0'||ch>'9'){
if(ch=='-') f=-1;
ch=getchar();
}
while(ch>='0'&&ch<='9'){
x=(x<<1)+(x<<3)+(ch^48);
ch=getchar();
}
x*=f;
return;
}
template<typename T,typename... Args> inline void read(T &x,Args &...x_){
read(x);
read(x_...);
return;
}
pair<int,int> a[100010];
bool cmp(pair<int,int> p,pair<int,int> q){
if(p.first==q.first) return p.second<q.second;
return p.first<q.first;
}
int vis[100010];
signed main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int n;
read(n);
for(int i=1;i<=n;i++) read(a[i].first,a[i].second);
sort(a+1,a+1+n,cmp);
int Max=-1;
int cnt=0;
for(int i=n;i>=1;i--){
if(a[i].second>Max){
Max=a[i].second;
cnt++;
}
}
cout<<cnt<<endl;
return 0;
}
/*
\\\\ \\ \\ \\ \\ \\ \\ \\ || || || || || || // // // // // // // ////
\\\\ \\ \\ \\ \\ \\ \\ _ooOoo_ // // // // // // ////
\\\\ \\ \\ \\ \\ \\ o8888888o // // // // // ////
\\\\ \\ \\ \\ \\ 88" . "88 // // // // ////
\\\\ \\ \\ \\ (| -_- |) // // // ////
\\\\ \\ \\ O\ = /O // // ////
\\\\ \\ ____/`---'\____ // ////
\\\\ .' \\| |// `. ////
//== / \\||| : |||// \ ==\\
//== / _||||| -:- |||||- \ ==\\
//== | | \\\ - /// | | ==\\
//== | \_| ''\---/'' | | ==\\
//== \ .-\__ `-` ___/-. / ==\\
//== ___`. .' /--.--\ `. . ___ ==\\
//== ."" '< `.___\_<|>_/___.' >' "". ==\\
//== | | : `- \`.;`\ _ /`;.`/ - ` : | | \\\\
//// \ \ `-. \_ __\ /__ _/ .-` / / \\\\
//// ========`-.____`-.___\_____/___.-`____.-'======== \\\\
//// `=---=' \\\\
//// // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \\ \\\\
//// // // 佛祖保佑 永无BUG 永不修改 \\ \\ \\\\
//// // // // // // || || || || || || || || || || \\ \\ \\ \\ \\ \\\\
*/#include<bits/stdc++.h>
#define int long long
#pragma GCC target("avx")
#pragma GCC optimize(3,"Ofast","inline")
using namespace std;
template<typename T> inline void read(T &x){
x=0;
int f=1;
char ch=getchar();
while(ch<'0'||ch>'9'){
if(ch=='-') f=-1;
ch=getchar();
}
while(ch>='0'&&ch<='9'){
x=(x<<1)+(x<<3)+(ch^48);
ch=getchar();
}
x*=f;
return;
}
template<typename T,typename... Args> inline void read(T &x,Args &...x_){
read(x);
read(x_...);
return;
}
pair<int,int> a[100010];
bool cmp(pair<int,int> p,pair<int,int> q){
if(p.first==q.first) return p.second<q.second;
return p.first<q.first;
}
int vis[100010];
signed main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int n;
read(n);
for(int i=1;i<=n;i++) read(a[i].first,a[i].second);
sort(a+1,a+1+n,cmp);
int Max=-1;
int cnt=0;
for(int i=n;i>=1;i--){
if(a[i].second>Max){
Max=a[i].second;
cnt++;
}
}
cout<<cnt<<endl;
return 0;
}
/*
\\\\ \\ \\ \\ \\ \\ \\ \\ || || || || || || // // // // // // // ////
\\\\ \\ \\ \\ \\ \\ \\ _ooOoo_ // // // // // // ////
\\\\ \\ \\ \\ \\ \\ o8888888o // // // // // ////
\\\\ \\ \\ \\ \\ 88" . "88 // // // // ////
\\\\ \\ \\ \\ (| -_- |) // // // ////
\\\\ \\ \\ O\ = /O // // ////
\\\\ \\ ____/`---'\____ // ////
\\\\ .' \\| |// `. ////
//== / \\||| : |||// \ ==\\
//== / _||||| -:- |||||- \ ==\\
//== | | \\\ - /// | | ==\\
//== | \_| ''\---/'' | | ==\\
//== \ .-\__ `-` ___/-. / ==\\
//== ___`. .' /--.--\ `. . ___ ==\\
//== ."" '< `.___\_<|>_/___.' >' "". ==\\
//== | | : `- \`.;`\ _ /`;.`/ - ` : | | \\\\
//// \ \ `-. \_ __\ /__ _/ .-` / / \\\\
//// ========`-.____`-.___\_____/___.-`____.-'======== \\\\
//// `=---=' \\\\
//// // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \\ \\\\
//// // // 佛祖保佑 永无BUG 永不修改 \\ \\ \\\\
//// // // // // // || || || || || || || || || || \\ \\ \\ \\ \\ \\\\
*/
Details
answer.code:133:69: warning: backslash-newline at end of file 133 | //== / \\||| : |||// \ ==\\ | answer.code:79:34: error: ambiguating new declaration ‘template<class T> void read(T&)’ 79 | template<typename T> inline void read(T &x){ | ^~~~ answer.code:6:34: note: old declaration ‘template<class T> void read(T&)’ 6 | template<typename T> inline void read(T &x){ | ^~~~ answer.code:94:51: error: ambiguating new declaration ‘template<class T, class ... Args> void read(T&, Args& ...)’ 94 | template<typename T,typename... Args> inline void read(T &x,Args &...x_){ | ^~~~ answer.code:21:51: note: old declaration ‘template<class T, class ... Args> void read(T&, Args& ...)’ 21 | template<typename T,typename... Args> inline void read(T &x,Args &...x_){ | ^~~~ answer.code:99:15: error: redefinition of ‘std::pair<long long int, long long int> a [100010]’ 99 | pair<int,int> a[100010]; | ^ answer.code:26:15: note: ‘std::pair<long long int, long long int> a [100010]’ previously defined here 26 | pair<int,int> a[100010]; | ^ answer.code:104:5: error: redefinition of ‘long long int vis [100010]’ 104 | int vis[100010]; | ^~~ answer.code:31:5: note: ‘long long int vis [100010]’ previously declared here 31 | int vis[100010]; | ^~~ answer.code:105:8: error: redefinition of ‘int main()’ 105 | signed main(){ | ^~~~ answer.code:32:8: note: ‘int main()’ previously defined here 32 | signed main(){ | ^~~~ answer.code: In function ‘int main()’: answer.code:112:13: error: no matching function for call to ‘sort(std::pair<long long int, long long int>*, std::pair<long long int, long long int>*, <unresolved overloaded function type>)’ 112 | sort(a+1,a+1+n,cmp); | ~~~~^~~~~~~~~~~~~~~ In file included from /usr/include/c++/13/algorithm:61, from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51, from answer.code:1: /usr/include/c++/13/bits/stl_algo.h:4851:5: note: candidate: ‘template<class _RAIter> constexpr void std::sort(_RAIter, _RAIter)’ 4851 | sort(_RandomAccessIterator __first, _RandomAccessIterator __last) | ^~~~ /usr/include/c++/13/bits/stl_algo.h:4851:5: note: template argument deduction/substitution failed: answer.code:112:13: note: candidate expects 2 arguments, 3 provided 112 | sort(a+1,a+1+n,cmp); | ~~~~^~~~~~~~~~~~~~~ /usr/include/c++/13/bits/stl_algo.h:4882:5: note: candidate: ‘template<class _RAIter, class _Compare> constexpr void std::sort(_RAIter, _RAIter, _Compare)’ 4882 | sort(_RandomAccessIterator __first, _RandomAccessIterator __last, | ^~~~ /usr/include/c++/13/bits/stl_algo.h:4882:5: note: template argument deduction/substitution failed: answer.code:112:13: note: couldn’t deduce template parameter ‘_Compare’ 112 | sort(a+1,a+1+n,cmp); | ~~~~^~~~~~~~~~~~~~~ In file included from /usr/include/c++/13/algorithm:73: /usr/include/c++/13/pstl/glue_algorithm_defs.h:292:1: note: candidate: ‘template<class _ExecutionPolicy, class _RandomAccessIterator, class _Compare> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare)’ 292 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp); | ^~~~ /usr/include/c++/13/pstl/glue_algorithm_defs.h:292:1: note: template argument deduction/substitution failed: answer.code:112:13: note: candidate expects 4 arguments, 3 provided 112 | sort(a+1,a+1+n,cmp); | ~~~~^~~~~~~~~~~~~~~ /usr/include/c++/13/pstl/glue_algorithm_defs.h:296:1: note: candidate: ‘template<class _ExecutionPolicy, class _RandomAccessIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator)’ 296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last); | ^~~~ /usr/include/c++/13/pstl/glue_algorithm_defs.h:296:1: note: template argument deduction/substitution failed: In file included from /usr/include/c++/13/pstl/glue_algorithm_defs.h:15: /usr/include/c++/13/pstl/execution_defs.h: In substitution of ‘template<class _ExecPolicy, class _Tp> using __pstl::__internal::__enable_if_execution_policy = typename std::enable_if<__pstl::execution::v1::is_execution_policy<typename std::remove_cv<typename std::remove_reference<_Tp>::type>::type>::value, _Tp>::type [with _ExecPolicy = std::pair<long long int, long long int>*; _Tp = void]’: /...