# 2069612, 2024-11-02 11:03:38, -----P---- (10%)
#include<bits/stdc++.h>
using namespace std;
tuple< pair<int,int>,pair<int,int> ,int > Q (vector< pair<int,int> > v){
int min_x = 696969 ;
for( auto e : v ){
if( e.first < min_x ){
min_x = e.first ;
}
}
int min_y = 69696;
for( auto e : v ){
if( e.second < min_x ){
min_x = e.second ;
}
}
int max_x = -696969 ;
for( auto e : v ){
if( e.first < min_x ){
max_x = e.first ;
}
}
int max_y = -69696;
for( auto e : v ){
if( e.second < min_x ){
max_y = e.second ;
}
}
int area = (max_x - min_x) * (max_y - min_y) ;
return make_tuple( make_pair(min_x,min_y) , make_pair(max_x,max_y) ,area);
}
int main(){
int n ;
cin >> n ;
vector< pair<int,int> > q1 ,q2 , q3 , q4 ;
while( n-- ){
int x , y ;
cin >> x >> y ;
if( x > 0 && y > 0 ){
q1.push_back(make_pair(x,y));
}
if( x < 0 && y > 0 ){
q2.push_back(make_pair(x,y));
}
if( x <0 && y < 0 ){
q3.push_back(make_pair(x,y));
}
if( x > 0 && y < 0 ){
q4.push_back(make_pair(x,y)) ;
}
}
for( auto e : q1){
cout << e.first << " " << e.second <<"\n" ;
}
if( q1.empty() && q2.empty() && q3.empty() && q4.empty()){
cout << "No point in any quadrant" <<"\n";
return 0 ;
}
if( !q1.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q1);
cout << "Q1: ";
cout << " (" << get<0>(answer).first << "," << get<0>(answer).second << ") " ;
cout << " (" << get<1>(answer).first << "," << get<1>(answer).second << ") " ;
cout << " " << get<2>(answer) << "\n" ;
}
if( !q2.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q2);
cout << "Q2: " ;
cout << " (" << get<0>(answer).first << "," << get<0>(answer).second << ") " ;
cout << " (" << get<1>(answer).first << "," << get<1>(answer).second << ") " ;
cout << " " << get<2>(answer) << "\n" ;
}
if( !q3.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q3);
cout << "Q3: " ;
cout << " (" << get<0>(answer).first << "," << get<0>(answer).second << ") " ;
cout << " (" << get<1>(answer).first << "," << get<1>(answer).second << ") " ;
cout << " " << get<2>(answer) << "\n" ;
}
if( !q4.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q4);
cout << "Q4: " ;
cout << " (" << get<0>(answer).first << "," << get<0>(answer).second << ") " ;
cout << " (" << get<1>(answer).first << "," << get<1>(answer).second << ") " ;
cout << " " << get<2>(answer) << "\n" ;
}
} | # 2069654, 2024-11-02 11:08:10, -----P---- (10%)
#include<bits/stdc++.h>
using namespace std;
tuple< pair<int,int>,pair<int,int> ,int > Q (vector< pair<int,int> > v){
int min_x = 696969 ;
for( auto e : v ){
if( e.first < min_x ){
min_x = e.first ;
}
}
int min_y = 69696;
for( auto e : v ){
if( e.second < min_y ){
min_y = e.second ;
}
}
int max_x = -696969 ;
for( auto e : v ){
if( e.first > max_x){
max_x = e.first ;
}
}
int max_y = -69696;
for( auto e : v ){
if( e.second > max_y ){
max_y = e.second ;
}
}
int area = (max_x - min_x) * (max_y - min_y) ;
return make_tuple( make_pair(min_x,min_y) , make_pair(max_x,max_y) ,area);
}
int main(){
int n ;
cin >> n ;
vector< pair<int,int> > q1 ,q2 , q3 , q4 ;
while( n-- ){
int x , y ;
cin >> x >> y ;
if( x > 0 && y > 0 ){
q1.push_back(make_pair(x,y));
}
if( x < 0 && y > 0 ){
q2.push_back(make_pair(x,y));
}
if( x <0 && y < 0 ){
q3.push_back(make_pair(x,y));
}
if( x > 0 && y < 0 ){
q4.push_back(make_pair(x,y)) ;
}
}
for( auto e : q1){
cout << e.first << " " << e.second <<"\n" ;
}
if( q1.empty() && q2.empty() && q3.empty() && q4.empty()){
cout << "No point in any quadrant" <<"\n";
return 0 ;
}
if( !q1.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q1);
cout << "Q1: ";
cout << " (" << get<0>(answer).first << "," << get<0>(answer).second << ") " ;
cout << " (" << get<1>(answer).first << "," << get<1>(answer).second << ") " ;
cout << " " << get<2>(answer) << "\n" ;
}
if( !q2.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q2);
cout << "Q2: " ;
cout << " (" << get<0>(answer).first << "," << get<0>(answer).second << ") " ;
cout << " (" << get<1>(answer).first << "," << get<1>(answer).second << ") " ;
cout << " " << get<2>(answer) << "\n" ;
}
if( !q3.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q3);
cout << "Q3: " ;
cout << " (" << get<0>(answer).first << "," << get<0>(answer).second << ") " ;
cout << " (" << get<1>(answer).first << "," << get<1>(answer).second << ") " ;
cout << " " << get<2>(answer) << "\n" ;
}
if( !q4.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q4);
cout << "Q4: " ;
cout << " (" << get<0>(answer).first << "," << get<0>(answer).second << ") " ;
cout << " (" << get<1>(answer).first << "," << get<1>(answer).second << ") " ;
cout << " " << get<2>(answer) << "\n" ;
}
} | # 2069669, 2024-11-02 11:10:19, -P-P-P--P- (40%)
#include<bits/stdc++.h>
using namespace std;
tuple< pair<int,int>,pair<int,int> ,int > Q (vector< pair<int,int> > v){
int min_x = 696969 ;
for( auto e : v ){
if( e.first < min_x ){
min_x = e.first ;
}
}
int min_y = 69696;
for( auto e : v ){
if( e.second < min_y ){
min_y = e.second ;
}
}
int max_x = -696969 ;
for( auto e : v ){
if( e.first > max_x){
max_x = e.first ;
}
}
int max_y = -69696;
for( auto e : v ){
if( e.second > max_y ){
max_y = e.second ;
}
}
int area = (max_x - min_x) * (max_y - min_y) ;
return make_tuple( make_pair(min_x,min_y) , make_pair(max_x,max_y) ,area);
}
int main(){
int n ;
cin >> n ;
vector< pair<int,int> > q1 ,q2 , q3 , q4 ;
while( n-- ){
int x , y ;
cin >> x >> y ;
if( x > 0 && y > 0 ){
q1.push_back(make_pair(x,y));
}
if( x < 0 && y > 0 ){
q2.push_back(make_pair(x,y));
}
if( x <0 && y < 0 ){
q3.push_back(make_pair(x,y));
}
if( x > 0 && y < 0 ){
q4.push_back(make_pair(x,y)) ;
}
}
for( auto e : q1){
cout << e.first << " " << e.second <<"\n" ;
}
if( q1.empty() && q2.empty() && q3.empty() && q4.empty()){
cout << "No point in any quadrant" <<"\n";
return 0 ;
}
if( !q1.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q1);
cout << "Q1:";
cout << " (" << get<0>(answer).first << ", " << get<0>(answer).second << ")" ;
cout << " (" << get<1>(answer).first << ", " << get<1>(answer).second << ")" ;
cout << " " << get<2>(answer) << "\n" ;
}
if( !q2.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q2);
cout << "Q2:" ;
cout << " (" << get<0>(answer).first << ", " << get<0>(answer).second << ")" ;
cout << " (" << get<1>(answer).first << ", " << get<1>(answer).second << ")" ;
cout << " " << get<2>(answer) << "\n" ;
}
if( !q3.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q3);
cout << "Q3:" ;
cout << " (" << get<0>(answer).first << ", " << get<0>(answer).second << ")" ;
cout << " (" << get<1>(answer).first << ", " << get<1>(answer).second << ")" ;
cout << " " << get<2>(answer) << "\n" ;
}
if( !q4.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q4);
cout << "Q4:" ;
cout << " (" << get<0>(answer).first << ", " << get<0>(answer).second << ")" ;
cout << " (" << get<1>(answer).first << ", " << get<1>(answer).second << ")" ;
cout << " " << get<2>(answer) << "\n" ;
}
} | # 2069679, 2024-11-02 11:12:42, -P-P-P--P- (40%)
#include<bits/stdc++.h>
using namespace std;
tuple< pair<int,int>,pair<int,int> ,int > Q (vector< pair<int,int> > v){
int min_x = 696969 ;
for( auto e : v ){
if( e.first < min_x ){
min_x = e.first ;
}
}
int min_y = 69696;
for( auto e : v ){
if( e.second < min_y ){
min_y = e.second ;
}
}
int max_x = -696969 ;
for( auto e : v ){
if( e.first > max_x){
max_x = e.first ;
}
}
int max_y = -69696;
for( auto e : v ){
if( e.second > max_y ){
max_y = e.second ;
}
}
int area = abs((max_x - min_x) * (max_y - min_y)) ;
return make_tuple( make_pair(min_x,min_y) , make_pair(max_x,max_y) ,area);
}
int main(){
int n ;
cin >> n ;
vector< pair<int,int> > q1 ,q2 , q3 , q4 ;
while( n-- ){
int x , y ;
cin >> x >> y ;
if( x > 0 && y > 0 ){
q1.push_back(make_pair(x,y));
}
if( x < 0 && y > 0 ){
q2.push_back(make_pair(x,y));
}
if( x <0 && y < 0 ){
q3.push_back(make_pair(x,y));
}
if( x > 0 && y < 0 ){
q4.push_back(make_pair(x,y)) ;
}
}
for( auto e : q1){
cout << e.first << " " << e.second <<"\n" ;
}
if( q1.empty() && q2.empty() && q3.empty() && q4.empty()){
cout << "No point in any quadrant" <<"\n";
return 0 ;
}
if( !q1.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q1);
cout << "Q1:";
cout << " (" << get<0>(answer).first << ", " << get<0>(answer).second << ")" ;
cout << " (" << get<1>(answer).first << ", " << get<1>(answer).second << ")" ;
cout << " " << get<2>(answer) << "\n" ;
}
if( !q2.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q2);
cout << "Q2:" ;
cout << " (" << get<0>(answer).first << ", " << get<0>(answer).second << ")" ;
cout << " (" << get<1>(answer).first << ", " << get<1>(answer).second << ")" ;
cout << " " << get<2>(answer) << "\n" ;
}
if( !q3.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q3);
cout << "Q3:" ;
cout << " (" << get<0>(answer).first << ", " << get<0>(answer).second << ")" ;
cout << " (" << get<1>(answer).first << ", " << get<1>(answer).second << ")" ;
cout << " " << get<2>(answer) << "\n" ;
}
if( !q4.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q4);
cout << "Q4:" ;
cout << " (" << get<0>(answer).first << ", " << get<0>(answer).second << ")" ;
cout << " (" << get<1>(answer).first << ", " << get<1>(answer).second << ")" ;
cout << " " << get<2>(answer) << "\n" ;
}
} | # 2069694, 2024-11-02 11:14:13, -P-P-P--P- (40%)
#include<bits/stdc++.h>
using namespace std;
tuple< pair<int,int>,pair<int,int> ,int > Q (vector< pair<int,int> > v){
int min_x = 696969 ;
for( auto e : v ){
if( e.first < min_x ){
min_x = e.first ;
}
}
int min_y = 69696;
for( auto e : v ){
if( e.second < min_y ){
min_y = e.second ;
}
}
int max_x = -696969 ;
for( auto e : v ){
if( e.first > max_x){
max_x = e.first ;
}
}
int max_y = -69696;
for( auto e : v ){
if( e.second > max_y ){
max_y = e.second ;
}
}
int area = abs(abs(max_x - min_x) * abs(max_y - min_y)) ;
return make_tuple( make_pair(min_x,min_y) , make_pair(max_x,max_y) ,area);
}
int main(){
int n ;
cin >> n ;
vector< pair<int,int> > q1 ,q2 , q3 , q4 ;
while( n-- ){
int x , y ;
cin >> x >> y ;
if( x > 0 && y > 0 ){
q1.push_back(make_pair(x,y));
}
if( x < 0 && y > 0 ){
q2.push_back(make_pair(x,y));
}
if( x <0 && y < 0 ){
q3.push_back(make_pair(x,y));
}
if( x > 0 && y < 0 ){
q4.push_back(make_pair(x,y)) ;
}
}
for( auto e : q1){
cout << e.first << " " << e.second <<"\n" ;
}
if( q1.empty() && q2.empty() && q3.empty() && q4.empty()){
cout << "No point in any quadrant" <<"\n";
return 0 ;
}
if( !q1.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q1);
cout << "Q1:";
cout << " (" << get<0>(answer).first << ", " << get<0>(answer).second << ")" ;
cout << " (" << get<1>(answer).first << ", " << get<1>(answer).second << ")" ;
cout << " " << get<2>(answer) << "\n" ;
}
if( !q2.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q2);
cout << "Q2:" ;
cout << " (" << get<0>(answer).first << ", " << get<0>(answer).second << ")" ;
cout << " (" << get<1>(answer).first << ", " << get<1>(answer).second << ")" ;
cout << " " << get<2>(answer) << "\n" ;
}
if( !q3.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q3);
cout << "Q3:" ;
cout << " (" << get<0>(answer).first << ", " << get<0>(answer).second << ")" ;
cout << " (" << get<1>(answer).first << ", " << get<1>(answer).second << ")" ;
cout << " " << get<2>(answer) << "\n" ;
}
if( !q4.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q4);
cout << "Q4:" ;
cout << " (" << get<0>(answer).first << ", " << get<0>(answer).second << ")" ;
cout << " (" << get<1>(answer).first << ", " << get<1>(answer).second << ")" ;
cout << " " << get<2>(answer) << "\n" ;
}
} | # 2069927, 2024-11-02 11:37:31, -P-P-P---- (30%)
#include<bits/stdc++.h>
using namespace std;
tuple< pair<int,int>,pair<int,int> ,int > Q (vector< pair<int,int> > v){
int min_x = v[0].first;
for( auto e : v ){
if( e.first < min_x ){
min_x = e.first ;
}
}
int min_y = v[0].second;
for( auto e : v ){
if( e.second < min_y ){
min_y = e.second ;
}
}
int max_x = v[0].first ;
for( auto e : v ){
if( e.first > max_x){
max_x = e.first ;
}
}
int max_y = v[0].second;
for( auto e : v ){
if( e.second > max_y ){
max_y = e.second ;
}
}
int area = abs(abs(max_x - min_x) * abs(max_y - min_y)) ;
return make_tuple( make_pair(min_x,min_y) , make_pair(max_x,max_y) ,area);
}
int main(){
int n ;
cin >> n ;
vector< pair<int,int> > q1 ,q2 , q3 , q4 ;
while( n-- ){
int x , y ;
cin >> x >> y ;
if( x > 0 && y > 0 ){
q1.push_back(make_pair(x,y));
}
if( x < 0 && y > 0 ){
q2.push_back(make_pair(x,y));
}
if( x <0 && y < 0 ){
q3.push_back(make_pair(x,y));
}
if( x > 0 && y < 0 ){
q4.push_back(make_pair(x,y)) ;
}
}
for( auto e : q1){
cout << e.first << " " << e.second <<"\n" ;
}
if( q1.empty() && q2.empty() && q3.empty() && q4.empty()){
cout << "No point in any quadrant" <<"\n";
return 0 ;
}
if( !q1.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q1);
cout << "Q1:";
cout << " (" << get<0>(answer).first << ", " << get<0>(answer).second << ")" ;
cout << " (" << get<1>(answer).first << ", " << get<1>(answer).second << ")" ;
cout << " " << get<2>(answer) << "\n" ;
}
if( !q2.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q2);
cout << "Q2:" ;
cout << " (" << get<0>(answer).first << ", " << get<0>(answer).second << ")" ;
cout << " (" << get<1>(answer).first << ", " << get<1>(answer).second << ")" ;
cout << " " << get<2>(answer) << "\n" ;
}
if( !q3.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q3);
cout << "Q3:" ;
cout << " (" << get<0>(answer).first << ", " << get<0>(answer).second << ")" ;
cout << " (" << get<1>(answer).first << ", " << get<1>(answer).second << ")" ;
cout << " " << get<2>(answer) << "\n" ;
}
} | # 2069960, 2024-11-02 11:40:18, -P-P-P---- (30%)
#include<bits/stdc++.h>
using namespace std;
tuple< pair<int,int>,pair<int,int> ,int > Q (vector< pair<int,int> > v){
int min_x = v[0].first;
for( auto e : v ){
if( e.first < min_x ){
min_x = e.first ;
}
}
int min_y = v[0].second;
for( auto e : v ){
if( e.second < min_y ){
min_y = e.second ;
}
}
int max_x = v[0].first ;
for( auto e : v ){
if( e.first > max_x){
max_x = e.first ;
}
}
int max_y = v[0].second;
for( auto e : v ){
if( e.second > max_y ){
max_y = e.second ;
}
}
int area = (max_x - min_x )* (max_y - min_y) ;
return make_tuple( make_pair(min_x,min_y) , make_pair(max_x,max_y) ,area);
}
int main(){
int n ;
cin >> n ;
vector< pair<int,int> > q1 ,q2 , q3 , q4 ;
while( n-- ){
int x , y ;
cin >> x >> y ;
if( x > 0 && y > 0 ){
q1.push_back(make_pair(x,y));
}
if( x < 0 && y > 0 ){
q2.push_back(make_pair(x,y));
}
if( x <0 && y < 0 ){
q3.push_back(make_pair(x,y));
}
if( x > 0 && y < 0 ){
q4.push_back(make_pair(x,y)) ;
}
}
for( auto e : q1){
cout << e.first << " " << e.second <<"\n" ;
}
if( q1.empty() && q2.empty() && q3.empty() && q4.empty()){
cout << "No point in any quadrant" <<"\n";
return 0 ;
}
if( !q1.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q1);
cout << "Q1:";
cout << " (" << get<0>(answer).first << ", " << get<0>(answer).second << ")" ;
cout << " (" << get<1>(answer).first << ", " << get<1>(answer).second << ")" ;
cout << " " << get<2>(answer) << "\n" ;
}
if( !q2.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q2);
cout << "Q2:" ;
cout << " (" << get<0>(answer).first << ", " << get<0>(answer).second << ")" ;
cout << " (" << get<1>(answer).first << ", " << get<1>(answer).second << ")" ;
cout << " " << get<2>(answer) << "\n" ;
}
if( !q3.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q3);
cout << "Q3:" ;
cout << " (" << get<0>(answer).first << ", " << get<0>(answer).second << ")" ;
cout << " (" << get<1>(answer).first << ", " << get<1>(answer).second << ")" ;
cout << " " << get<2>(answer) << "\n" ;
}
} | # 2070036, 2024-11-02 11:46:13, -P-P-P--P- (40%)
#include<bits/stdc++.h>
using namespace std;
tuple< pair<int,int>,pair<int,int> ,int > Q (vector< pair<int,int> > v){
int min_x = v[0].first;
for( auto e : v ){
if( e.first < min_x ){
min_x = e.first ;
}
}
int min_y = v[0].second;
for( auto e : v ){
if( e.second < min_y ){
min_y = e.second ;
}
}
int max_x = v[0].first ;
for( auto e : v ){
if( e.first > max_x){
max_x = e.first ;
}
}
int max_y = v[0].second;
for( auto e : v ){
if( e.second > max_y ){
max_y = e.second ;
}
}
int area = (max_x - min_x )* (max_y - min_y) ;
return make_tuple( make_pair(min_x,min_y) , make_pair(max_x,max_y) ,area);
}
int main(){
int n ;
cin >> n ;
vector< pair<int,int> > q1 ,q2 , q3 , q4 ;
while( n-- ){
int x , y ;
cin >> x >> y ;
if( x > 0 && y > 0 ){
q1.push_back(make_pair(x,y));
}
if( x < 0 && y > 0 ){
q2.push_back(make_pair(x,y));
}
if( x <0 && y < 0 ){
q3.push_back(make_pair(x,y));
}
if( x > 0 && y < 0 ){
q4.push_back(make_pair(x,y)) ;
}
}
for( auto e : q1){
cout << e.first << " " << e.second <<"\n" ;
}
if( q1.empty() && q2.empty() && q3.empty() && q4.empty()){
cout << "No point in any quadrant" <<"\n";
return 0 ;
}
if( !q1.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q1);
cout << "Q1:";
cout << " (" << get<0>(answer).first << ", " << get<0>(answer).second << ")" ;
cout << " (" << get<1>(answer).first << ", " << get<1>(answer).second << ")" ;
cout << " " << get<2>(answer) << "\n" ;
}
if( !q2.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q2);
cout << "Q2:" ;
cout << " (" << get<0>(answer).first << ", " << get<0>(answer).second << ")" ;
cout << " (" << get<1>(answer).first << ", " << get<1>(answer).second << ")" ;
cout << " " << get<2>(answer) << "\n" ;
}
if( !q3.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q3);
cout << "Q3:" ;
cout << " (" << get<0>(answer).first << ", " << get<0>(answer).second << ")" ;
cout << " (" << get<1>(answer).first << ", " << get<1>(answer).second << ")" ;
cout << " " << get<2>(answer) << "\n" ;
}
if( !q4.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q4);
cout << "Q4:" ;
cout << " (" << get<0>(answer).first << ", " << get<0>(answer).second << ")" ;
cout << " (" << get<1>(answer).first << ", " << get<1>(answer).second << ")" ;
cout << " " << get<2>(answer) << "\n" ;
}
} | # 2070085, 2024-11-02 11:49:49, PPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
tuple< pair<int,int>,pair<int,int> ,int > Q (vector< pair<int,int> > v){
int min_x = v[0].first;
for( auto e : v ){
if( e.first < min_x ){
min_x = e.first ;
}
}
int min_y = v[0].second;
for( auto e : v ){
if( e.second < min_y ){
min_y = e.second ;
}
}
int max_x = v[0].first ;
for( auto e : v ){
if( e.first > max_x){
max_x = e.first ;
}
}
int max_y = v[0].second;
for( auto e : v ){
if( e.second > max_y ){
max_y = e.second ;
}
}
int area = abs((max_x - min_x ) * (max_y - min_y)) ;
return make_tuple( make_pair(min_x,min_y) , make_pair(max_x,max_y) ,area);
}
int main(){
int n ;
cin >> n ;
vector< pair<int,int> > q1 ,q2 , q3 , q4 ;
while( n-- ){
int x , y ;
cin >> x >> y ;
if( x > 0 && y > 0 ){
q1.push_back(make_pair(x,y));
}
if( x < 0 && y > 0 ){
q2.push_back(make_pair(x,y));
}
if( x <0 && y < 0 ){
q3.push_back(make_pair(x,y));
}
if( x > 0 && y < 0 ){
q4.push_back(make_pair(x,y)) ;
}
}
if( q1.empty() && q2.empty() && q3.empty() && q4.empty()){
cout << "No point in any quadrant" <<"\n";
return 0 ;
}
if( !q1.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q1);
cout << "Q1:";
cout << " (" << get<0>(answer).first << ", " << get<0>(answer).second << ")" ;
cout << " (" << get<1>(answer).first << ", " << get<1>(answer).second << ")" ;
cout << " " << get<2>(answer) << "\n" ;
}
if( !q2.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q2);
cout << "Q2:" ;
cout << " (" << get<0>(answer).first << ", " << get<0>(answer).second << ")" ;
cout << " (" << get<1>(answer).first << ", " << get<1>(answer).second << ")" ;
cout << " " << get<2>(answer) << "\n" ;
}
if( !q3.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q3);
cout << "Q3:" ;
cout << " (" << get<0>(answer).first << ", " << get<0>(answer).second << ")" ;
cout << " (" << get<1>(answer).first << ", " << get<1>(answer).second << ")" ;
cout << " " << get<2>(answer) << "\n" ;
}
if( !q4.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q4);
cout << "Q4:" ;
cout << " (" << get<0>(answer).first << ", " << get<0>(answer).second << ")" ;
cout << " (" << get<1>(answer).first << ", " << get<1>(answer).second << ")" ;
cout << " " << get<2>(answer) << "\n" ;
}
} | # 2070098, 2024-11-02 11:50:26, PPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
tuple< pair<int,int>,pair<int,int> ,int > Q (vector< pair<int,int> > v){
int min_x = v[0].first;
for( auto e : v ){
if( e.first < min_x ){
min_x = e.first ;
}
}
int min_y = v[0].second;
for( auto e : v ){
if( e.second < min_y ){
min_y = e.second ;
}
}
int max_x = v[0].first ;
for( auto e : v ){
if( e.first > max_x){
max_x = e.first ;
}
}
int max_y = v[0].second;
for( auto e : v ){
if( e.second > max_y ){
max_y = e.second ;
}
}
int area = (max_x - min_x ) * (max_y - min_y) ;
return make_tuple( make_pair(min_x,min_y) , make_pair(max_x,max_y) ,area);
}
int main(){
int n ;
cin >> n ;
vector< pair<int,int> > q1 ,q2 , q3 , q4 ;
while( n-- ){
int x , y ;
cin >> x >> y ;
if( x > 0 && y > 0 ){
q1.push_back(make_pair(x,y));
}
if( x < 0 && y > 0 ){
q2.push_back(make_pair(x,y));
}
if( x <0 && y < 0 ){
q3.push_back(make_pair(x,y));
}
if( x > 0 && y < 0 ){
q4.push_back(make_pair(x,y)) ;
}
}
if( q1.empty() && q2.empty() && q3.empty() && q4.empty()){
cout << "No point in any quadrant" <<"\n";
return 0 ;
}
if( !q1.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q1);
cout << "Q1:";
cout << " (" << get<0>(answer).first << ", " << get<0>(answer).second << ")" ;
cout << " (" << get<1>(answer).first << ", " << get<1>(answer).second << ")" ;
cout << " " << get<2>(answer) << "\n" ;
}
if( !q2.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q2);
cout << "Q2:" ;
cout << " (" << get<0>(answer).first << ", " << get<0>(answer).second << ")" ;
cout << " (" << get<1>(answer).first << ", " << get<1>(answer).second << ")" ;
cout << " " << get<2>(answer) << "\n" ;
}
if( !q3.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q3);
cout << "Q3:" ;
cout << " (" << get<0>(answer).first << ", " << get<0>(answer).second << ")" ;
cout << " (" << get<1>(answer).first << ", " << get<1>(answer).second << ")" ;
cout << " " << get<2>(answer) << "\n" ;
}
if( !q4.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q4);
cout << "Q4:" ;
cout << " (" << get<0>(answer).first << ", " << get<0>(answer).second << ")" ;
cout << " (" << get<1>(answer).first << ", " << get<1>(answer).second << ")" ;
cout << " " << get<2>(answer) << "\n" ;
}
} | # 2070121, 2024-11-02 11:52:16, -P-P-P--P- (40%)
#include<bits/stdc++.h>
using namespace std;
tuple< pair<int,int>,pair<int,int> ,int > Q (vector< pair<int,int> > v){
int min_x = v[0].first;
for( auto e : v ){
if( e.first < min_x ){
min_x = e.first ;
}
}
int min_y = v[0].second;
for( auto e : v ){
if( e.second < min_y ){
min_y = e.second ;
}
}
int max_x = v[0].first ;
for( auto e : v ){
if( e.first > max_x){
max_x = e.first ;
}
}
int max_y = v[0].second;
for( auto e : v ){
if( e.second > max_y ){
max_y = e.second ;
}
}
int area = (max_x - min_x )* (max_y - min_y) ;
return make_tuple( make_pair(min_x,min_y) , make_pair(max_x,max_y) ,area);
}
int main(){
int n ;
cin >> n ;
vector< pair<int,int> > q1 ,q2 , q3 , q4 ;
while( n-- ){
int x , y ;
cin >> x >> y ;
if( x > 0 && y > 0 ){
q1.push_back(make_pair(x,y));
}
if( x < 0 && y > 0 ){
q2.push_back(make_pair(x,y));
}
if( x <0 && y < 0 ){
q3.push_back(make_pair(x,y));
}
if( x > 0 && y < 0 ){
q4.push_back(make_pair(x,y)) ;
}
}
for( auto e : q1){
cout << e.first << " " << e.second <<"\n" ;
}
if( q1.empty() && q2.empty() && q3.empty() && q4.empty()){
cout << "No point in any quadrant" <<"\n";
return 0 ;
}
if( !q1.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q1);
cout << "Q1:";
cout << " (" << get<0>(answer).first << ", " << get<0>(answer).second << ")" ;
cout << " (" << get<1>(answer).first << ", " << get<1>(answer).second << ")" ;
cout << " " << get<2>(answer) << "\n" ;
}
if( !q2.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q2);
cout << "Q2:" ;
cout << " (" << get<0>(answer).first << ", " << get<0>(answer).second << ")" ;
cout << " (" << get<1>(answer).first << ", " << get<1>(answer).second << ")" ;
cout << " " << get<2>(answer) << "\n" ;
}
if( !q3.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q3);
cout << "Q3:" ;
cout << " (" << get<0>(answer).first << ", " << get<0>(answer).second << ")" ;
cout << " (" << get<1>(answer).first << ", " << get<1>(answer).second << ")" ;
cout << " " << get<2>(answer) << "\n" ;
}
if( !q4.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q4);
cout << "Q4:" ;
cout << " (" << get<0>(answer).first << ", " << get<0>(answer).second << ")" ;
cout << " (" << get<1>(answer).first << ", " << get<1>(answer).second << ")" ;
cout << " " << get<2>(answer) << "\n" ;
}
} | # 2070127, 2024-11-02 11:52:36, PPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
tuple< pair<int,int>,pair<int,int> ,int > Q (vector< pair<int,int> > v){
int min_x = v[0].first;
for( auto e : v ){
if( e.first < min_x ){
min_x = e.first ;
}
}
int min_y = v[0].second;
for( auto e : v ){
if( e.second < min_y ){
min_y = e.second ;
}
}
int max_x = v[0].first ;
for( auto e : v ){
if( e.first > max_x){
max_x = e.first ;
}
}
int max_y = v[0].second;
for( auto e : v ){
if( e.second > max_y ){
max_y = e.second ;
}
}
int area = (max_x - min_x ) * (max_y - min_y) ;
return make_tuple( make_pair(min_x,min_y) , make_pair(max_x,max_y) ,area);
}
int main(){
int n ;
cin >> n ;
vector< pair<int,int> > q1 ,q2 , q3 , q4 ;
while( n-- ){
int x , y ;
cin >> x >> y ;
if( x > 0 && y > 0 ){
q1.push_back(make_pair(x,y));
}
if( x < 0 && y > 0 ){
q2.push_back(make_pair(x,y));
}
if( x <0 && y < 0 ){
q3.push_back(make_pair(x,y));
}
if( x > 0 && y < 0 ){
q4.push_back(make_pair(x,y)) ;
}
}
if( q1.empty() && q2.empty() && q3.empty() && q4.empty()){
cout << "No point in any quadrant" <<"\n";
return 0 ;
}
if( !q1.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q1);
cout << "Q1:";
cout << " (" << get<0>(answer).first << ", " << get<0>(answer).second << ")" ;
cout << " (" << get<1>(answer).first << ", " << get<1>(answer).second << ")" ;
cout << " " << get<2>(answer) << "\n" ;
}
if( !q2.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q2);
cout << "Q2:" ;
cout << " (" << get<0>(answer).first << ", " << get<0>(answer).second << ")" ;
cout << " (" << get<1>(answer).first << ", " << get<1>(answer).second << ")" ;
cout << " " << get<2>(answer) << "\n" ;
}
if( !q3.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q3);
cout << "Q3:" ;
cout << " (" << get<0>(answer).first << ", " << get<0>(answer).second << ")" ;
cout << " (" << get<1>(answer).first << ", " << get<1>(answer).second << ")" ;
cout << " " << get<2>(answer) << "\n" ;
}
if( !q4.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q4);
cout << "Q4:" ;
cout << " (" << get<0>(answer).first << ", " << get<0>(answer).second << ")" ;
cout << " (" << get<1>(answer).first << ", " << get<1>(answer).second << ")" ;
cout << " " << get<2>(answer) << "\n" ;
}
} | # 2070150, 2024-11-02 11:54:22, -P-P-P--P- (40%)
#include<bits/stdc++.h>
using namespace std;
tuple< pair<int,int>,pair<int,int> ,int > Q (vector< pair<int,int> > v){
int min_x = v[0].first;
for( auto e : v ){
if( e.first < min_x ){
min_x = e.first ;
}
}
int min_y = v[0].second;
for( auto e : v ){
if( e.second < min_y ){
min_y = e.second ;
}
}
int max_x = v[0].first ;
for( auto e : v ){
if( e.first > max_x){
max_x = e.first ;
}
}
int max_y = v[0].second;
for( auto e : v ){
if( e.second > max_y ){
max_y = e.second ;
}
}
int area = (max_x - min_x ) * (max_y - min_y) ;
return make_tuple( make_pair(min_x,min_y) , make_pair(max_x,max_y) ,area);
}
int main(){
int n ;
cin >> n ;
vector< pair<int,int> > q1 ,q2 , q3 , q4 ;
while( n-- ){
int x , y ;
cin >> x >> y ;
if( x > 0 && y > 0 ){
q1.push_back(make_pair(x,y));
}
if( x < 0 && y > 0 ){
q2.push_back(make_pair(x,y));
}
if( x <0 && y < 0 ){
q3.push_back(make_pair(x,y));
}
if( x > 0 && y < 0 ){
q4.push_back(make_pair(x,y)) ;
}
}
for( auto e : q1){
cout << e.first << " " << e.second <<"\n" ;
}
if( q1.empty() && q2.empty() && q3.empty() && q4.empty()){
cout << "No point in any quadrant" <<"\n";
return 0 ;
}
if( !q1.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q1);
cout << "Q1:";
cout << " (" << get<0>(answer).first << ", " << get<0>(answer).second << ")" ;
cout << " (" << get<1>(answer).first << ", " << get<1>(answer).second << ")" ;
cout << " " << get<2>(answer) << "\n" ;
}
if( !q2.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q2);
cout << "Q2:" ;
cout << " (" << get<0>(answer).first << ", " << get<0>(answer).second << ")" ;
cout << " (" << get<1>(answer).first << ", " << get<1>(answer).second << ")" ;
cout << " " << get<2>(answer) << "\n" ;
}
if( !q3.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q3);
cout << "Q3:" ;
cout << " (" << get<0>(answer).first << ", " << get<0>(answer).second << ")" ;
cout << " (" << get<1>(answer).first << ", " << get<1>(answer).second << ")" ;
cout << " " << get<2>(answer) << "\n" ;
}
if( !q4.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q4);
cout << "Q4:" ;
cout << " (" << get<0>(answer).first << ", " << get<0>(answer).second << ")" ;
cout << " (" << get<1>(answer).first << ", " << get<1>(answer).second << ")" ;
cout << " " << get<2>(answer) << "\n" ;
}
} | # 2070158, 2024-11-02 11:54:41, PPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
tuple< pair<int,int>,pair<int,int> ,int > Q (vector< pair<int,int> > v){
int min_x = v[0].first;
for( auto e : v ){
if( e.first < min_x ){
min_x = e.first ;
}
}
int min_y = v[0].second;
for( auto e : v ){
if( e.second < min_y ){
min_y = e.second ;
}
}
int max_x = v[0].first ;
for( auto e : v ){
if( e.first > max_x){
max_x = e.first ;
}
}
int max_y = v[0].second;
for( auto e : v ){
if( e.second > max_y ){
max_y = e.second ;
}
}
int area = (max_x - min_x ) * (max_y - min_y) ;
return make_tuple( make_pair(min_x,min_y) , make_pair(max_x,max_y) ,area);
}
int main(){
int n ;
cin >> n ;
vector< pair<int,int> > q1 ,q2 , q3 , q4 ;
while( n-- ){
int x , y ;
cin >> x >> y ;
if( x > 0 && y > 0 ){
q1.push_back(make_pair(x,y));
}
if( x < 0 && y > 0 ){
q2.push_back(make_pair(x,y));
}
if( x <0 && y < 0 ){
q3.push_back(make_pair(x,y));
}
if( x > 0 && y < 0 ){
q4.push_back(make_pair(x,y)) ;
}
}
if( q1.empty() && q2.empty() && q3.empty() && q4.empty()){
cout << "No point in any quadrant" <<"\n";
return 0 ;
}
if( !q1.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q1);
cout << "Q1:";
cout << " (" << get<0>(answer).first << ", " << get<0>(answer).second << ")" ;
cout << " (" << get<1>(answer).first << ", " << get<1>(answer).second << ")" ;
cout << " " << get<2>(answer) << "\n" ;
}
if( !q2.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q2);
cout << "Q2:" ;
cout << " (" << get<0>(answer).first << ", " << get<0>(answer).second << ")" ;
cout << " (" << get<1>(answer).first << ", " << get<1>(answer).second << ")" ;
cout << " " << get<2>(answer) << "\n" ;
}
if( !q3.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q3);
cout << "Q3:" ;
cout << " (" << get<0>(answer).first << ", " << get<0>(answer).second << ")" ;
cout << " (" << get<1>(answer).first << ", " << get<1>(answer).second << ")" ;
cout << " " << get<2>(answer) << "\n" ;
}
if( !q4.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q4);
cout << "Q4:" ;
cout << " (" << get<0>(answer).first << ", " << get<0>(answer).second << ")" ;
cout << " (" << get<1>(answer).first << ", " << get<1>(answer).second << ")" ;
cout << " " << get<2>(answer) << "\n" ;
}
} | # 2070186, 2024-11-02 11:56:09, -P-P-P--P- (40%)
#include<bits/stdc++.h>
using namespace std;
tuple< pair<int,int>,pair<int,int> ,int > Q (vector< pair<int,int> > v){
int min_x = v[0].first;
for( auto e : v ){
if( e.first < min_x ){
min_x = e.first ;
}
}
int min_y = v[0].second;
for( auto e : v ){
if( e.second < min_y ){
min_y = e.second ;
}
}
int max_x = v[0].first ;
for( auto e : v ){
if( e.first > max_x){
max_x = e.first ;
}
}
int max_y = v[0].second;
for( auto e : v ){
if( e.second > max_y ){
max_y = e.second ;
}
}
int area = (max_x - min_x ) * (max_y - min_y) ;
return make_tuple( make_pair(min_x,min_y) , make_pair(max_x,max_y) ,area);
}
int main(){
int n ;
cin >> n ;
vector< pair<int,int> > q1 ,q2 , q3 , q4 ;
while( n-- ){
int x , y ;
cin >> x >> y ;
if( x > 0 && y > 0 ){
q1.push_back(make_pair(x,y));
}
if( x < 0 && y > 0 ){
q2.push_back(make_pair(x,y));
}
if( x <0 && y < 0 ){
q3.push_back(make_pair(x,y));
}
if( x > 0 && y < 0 ){
q4.push_back(make_pair(x,y)) ;
}
}
for( auto e : q1){
cout << e.first << " " << e.second <<"\n" ;
}
if( q1.empty() && q2.empty() && q3.empty() && q4.empty()){
cout << "No point in any quadrant" <<"\n";
return 0 ;
}
if( !q1.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q1);
cout << "Q1:";
cout << " (" << get<0>(answer).first << ", " << get<0>(answer).second << ")" ;
cout << " (" << get<1>(answer).first << ", " << get<1>(answer).second << ")" ;
cout << " " << get<2>(answer) << "\n" ;
}
if( !q2.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q2);
cout << "Q2:" ;
cout << " (" << get<0>(answer).first << ", " << get<0>(answer).second << ")" ;
cout << " (" << get<1>(answer).first << ", " << get<1>(answer).second << ")" ;
cout << " " << get<2>(answer) << "\n" ;
}
if( !q3.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q3);
cout << "Q3:" ;
cout << " (" << get<0>(answer).first << ", " << get<0>(answer).second << ")" ;
cout << " (" << get<1>(answer).first << ", " << get<1>(answer).second << ")" ;
cout << " " << get<2>(answer) << "\n" ;
}
if( !q4.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q4);
cout << "Q4:" ;
cout << " (" << get<0>(answer).first << ", " << get<0>(answer).second << ")" ;
cout << " (" << get<1>(answer).first << ", " << get<1>(answer).second << ")" ;
cout << " " << get<2>(answer) << "\n" ;
}
} | # 2070193, 2024-11-02 11:56:43, -P-P-P--P- (40%)
#include<bits/stdc++.h>
using namespace std;
tuple< pair<int,int>,pair<int,int> ,int > Q (vector< pair<int,int> > v){
int min_x = v[0].first;
for( auto e : v ){
if( e.first < min_x ){
min_x = e.first ;
}
}
int min_y = v[0].second;
for( auto e : v ){
if( e.second < min_y ){
min_y = e.second ;
}
}
int max_x = v[0].first ;
for( auto e : v ){
if( e.first > max_x){
max_x = e.first ;
}
}
int max_y = v[0].second;
for( auto e : v ){
if( e.second > max_y ){
max_y = e.second ;
}
}
int area = abs((max_x - min_x ) * (max_y - min_y)) ;
return make_tuple( make_pair(min_x,min_y) , make_pair(max_x,max_y) ,area);
}
int main(){
int n ;
cin >> n ;
vector< pair<int,int> > q1 ,q2 , q3 , q4 ;
while( n-- ){
int x , y ;
cin >> x >> y ;
if( x > 0 && y > 0 ){
q1.push_back(make_pair(x,y));
}
if( x < 0 && y > 0 ){
q2.push_back(make_pair(x,y));
}
if( x <0 && y < 0 ){
q3.push_back(make_pair(x,y));
}
if( x > 0 && y < 0 ){
q4.push_back(make_pair(x,y)) ;
}
}
for( auto e : q1){
cout << e.first << " " << e.second <<"\n" ;
}
if( q1.empty() && q2.empty() && q3.empty() && q4.empty()){
cout << "No point in any quadrant" <<"\n";
return 0 ;
}
if( !q1.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q1);
cout << "Q1:";
cout << " (" << get<0>(answer).first << ", " << get<0>(answer).second << ")" ;
cout << " (" << get<1>(answer).first << ", " << get<1>(answer).second << ")" ;
cout << " " << get<2>(answer) << "\n" ;
}
if( !q2.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q2);
cout << "Q2:" ;
cout << " (" << get<0>(answer).first << ", " << get<0>(answer).second << ")" ;
cout << " (" << get<1>(answer).first << ", " << get<1>(answer).second << ")" ;
cout << " " << get<2>(answer) << "\n" ;
}
if( !q3.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q3);
cout << "Q3:" ;
cout << " (" << get<0>(answer).first << ", " << get<0>(answer).second << ")" ;
cout << " (" << get<1>(answer).first << ", " << get<1>(answer).second << ")" ;
cout << " " << get<2>(answer) << "\n" ;
}
if( !q4.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q4);
cout << "Q4:" ;
cout << " (" << get<0>(answer).first << ", " << get<0>(answer).second << ")" ;
cout << " (" << get<1>(answer).first << ", " << get<1>(answer).second << ")" ;
cout << " " << get<2>(answer) << "\n" ;
}
} | # 2070205, 2024-11-02 11:57:38, PPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
tuple< pair<int,int>,pair<int,int> ,int > Q (vector< pair<int,int> > v){
int min_x = v[0].first;
for( auto e : v ){
if( e.first < min_x ){
min_x = e.first ;
}
}
int min_y = v[0].second;
for( auto e : v ){
if( e.second < min_y ){
min_y = e.second ;
}
}
int max_x = v[0].first ;
for( auto e : v ){
if( e.first > max_x){
max_x = e.first ;
}
}
int max_y = v[0].second;
for( auto e : v ){
if( e.second > max_y ){
max_y = e.second ;
}
}
int area = (max_x - min_x ) * (max_y - min_y) ;
return make_tuple( make_pair(min_x,min_y) , make_pair(max_x,max_y) ,area);
}
int main(){
int n ;
cin >> n ;
vector< pair<int,int> > q1 ,q2 , q3 , q4 ;
while( n-- ){
int x , y ;
cin >> x >> y ;
if( x > 0 && y > 0 ){
q1.push_back(make_pair(x,y));
}
if( x < 0 && y > 0 ){
q2.push_back(make_pair(x,y));
}
if( x <0 && y < 0 ){
q3.push_back(make_pair(x,y));
}
if( x > 0 && y < 0 ){
q4.push_back(make_pair(x,y)) ;
}
}
if( q1.empty() && q2.empty() && q3.empty() && q4.empty()){
cout << "No point in any quadrant" <<"\n";
return 0 ;
}
if( !q1.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q1);
cout << "Q1:";
cout << " (" << get<0>(answer).first << ", " << get<0>(answer).second << ")" ;
cout << " (" << get<1>(answer).first << ", " << get<1>(answer).second << ")" ;
cout << " " << get<2>(answer) << "\n" ;
}
if( !q2.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q2);
cout << "Q2:" ;
cout << " (" << get<0>(answer).first << ", " << get<0>(answer).second << ")" ;
cout << " (" << get<1>(answer).first << ", " << get<1>(answer).second << ")" ;
cout << " " << get<2>(answer) << "\n" ;
}
if( !q3.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q3);
cout << "Q3:" ;
cout << " (" << get<0>(answer).first << ", " << get<0>(answer).second << ")" ;
cout << " (" << get<1>(answer).first << ", " << get<1>(answer).second << ")" ;
cout << " " << get<2>(answer) << "\n" ;
}
if( !q4.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q4);
cout << "Q4:" ;
cout << " (" << get<0>(answer).first << ", " << get<0>(answer).second << ")" ;
cout << " (" << get<1>(answer).first << ", " << get<1>(answer).second << ")" ;
cout << " " << get<2>(answer) << "\n" ;
}
} | # 2070216, 2024-11-02 11:58:28, PPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
tuple< pair<int,int>,pair<int,int> ,int > Q (vector< pair<int,int> > v){
int min_x = v[0].first;
for( auto e : v ){
if( e.first < min_x ){
min_x = e.first ;
}
}
int min_y = v[0].second;
for( auto e : v ){
if( e.second < min_y ){
min_y = e.second ;
}
}
int max_x = v[0].first ;
for( auto e : v ){
if( e.first > max_x){
max_x = e.first ;
}
}
int max_y = v[0].second;
for( auto e : v ){
if( e.second > max_y ){
max_y = e.second ;
}
}
int area = (max_x - min_x ) * (max_y - min_y) ;
return make_tuple( make_pair(min_x,min_y) , make_pair(max_x,max_y) ,area);
}
int main(){
int n ;
cin >> n ;
vector< pair<int,int> > q1 ,q2 , q3 , q4 ;
while( n-- ){
int x , y ;
cin >> x >> y ;
if( x > 0 && y > 0 ){
q1.push_back(make_pair(x,y));
}
if( x < 0 && y > 0 ){
q2.push_back(make_pair(x,y));
}
if( x <0 && y < 0 ){
q3.push_back(make_pair(x,y));
}
if( x > 0 && y < 0 ){
q4.push_back(make_pair(x,y)) ;
}
}
if( q1.empty() && q2.empty() && q3.empty() && q4.empty()){
cout << "No point in any quadrant" <<"\n";
return 0 ;
}
if( !q1.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q1);
cout << "Q1:";
cout << " (" << get<0>(answer).first << ", " << get<0>(answer).second << ")" ;
cout << " (" << get<1>(answer).first << ", " << get<1>(answer).second << ")" ;
cout << " " << get<2>(answer) << "\n" ;
}
if( !q2.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q2);
cout << "Q2:" ;
cout << " (" << get<0>(answer).first << ", " << get<0>(answer).second << ")" ;
cout << " (" << get<1>(answer).first << ", " << get<1>(answer).second << ")" ;
cout << " " << get<2>(answer) << "\n" ;
}
if( !q3.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q3);
cout << "Q3:" ;
cout << " (" << get<0>(answer).first << ", " << get<0>(answer).second << ")" ;
cout << " (" << get<1>(answer).first << ", " << get<1>(answer).second << ")" ;
cout << " " << get<2>(answer) << "\n" ;
}
if( !q4.empty() ){
tuple< pair<int,int>,pair<int,int> ,int > answer = Q(q4);
cout << "Q4:" ;
cout << " (" << get<0>(answer).first << ", " << get<0>(answer).second << ")" ;
cout << " (" << get<1>(answer).first << ", " << get<1>(answer).second << ")" ;
cout << " " << get<2>(answer) << "\n" ;
}
} |
# 2069134, 2024-11-02 10:16:28, xxxxPx--x- (10%)
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
int main() {
int n;
cin >> n;
vector<pair<int, int>> g;
for (int i = 0; i < n; ++i) {
int x,y;
cin >> x >> y;
g.push_back({x,y});
}
vector<pair<int,int>> q1;
vector<pair<int,int>> q2;
vector<pair<int,int>> q3;
vector<pair<int,int>> q4;
for (int i = 0; i < n; ++i) {
if (g[i].first > 0 && g[i].second > 0) {
q1.push_back({g[i].first,g[i].second});
}
else if (g[i].first < 0 && g[i].second > 0) {
q2.push_back({g[i].first,g[i].second});
}
else if (g[i].first < 0 && g[i].second < 0) {
q3.push_back({g[i].first,g[i].second});
}
else if (g[i].first > 0 && g[i].second < 0) {
q4.push_back({g[i].first,g[i].second});
}
}
vector<int> x1, y1;
for (int i = 0; i < q1.size(); ++i) {
x1.push_back(q1[i].first);
y1.push_back(q1[i].second);
}
sort(x1.begin(),x1.end());
sort(y1.begin(), y1.end());
int minx1 = x1[0], miny1 = y1[0];
int maxx1 = x1[x1.size()-1], maxy1 = y1[y1.size()-1];
int a1 = (maxx1-minx1)*(maxy1-miny1);
cout << "Q1: " << "(" << minx1 << ", " << miny1 << ") " << "(" << maxx1 << ", " << maxy1 << ") " << a1 << endl;
vector<int> x2, y2;
for (int i = 0; i < q2.size(); ++i) {
x2.push_back(q2[i].first);
y2.push_back(q2[i].second);
}
sort(x2.begin(),x2.end());
sort(y2.begin(), y2.end());
int minx2 = x2[0], miny2 = y2[0];
int maxx2 = x2[x2.size()-1], maxy2 = y2[y2.size()-1];
int a2 = (maxx2-minx2)*(maxy2-miny2);
cout << "Q2: " << "(" << minx2 << ", " << miny2 << ") " << "(" << maxx2 << ", " << maxy2 << ") " << a1 << endl;
vector<int> x3, y3;
for (int i = 0; i < q3.size(); ++i) {
x3.push_back(q3[i].first);
y3.push_back(q3[i].second);
}
sort(x3.begin(),x3.end());
sort(y3.begin(), y3.end());
int minx3 = x3[0], miny3 = y3[0];
int maxx3 = x3[x3.size()-1], maxy3 = y3[y3.size()-1];
int a3 = (maxx3-minx3)*(maxy3-miny3);
cout << "Q3: " << "(" << minx3 << ", " << miny3 << ") " << "(" << maxx3 << ", " << maxy3 << ") " << a3 << endl;
vector<int> x4, y4;
for (int i = 0; i < q4.size(); ++i) {
x4.push_back(q4[i].first);
y4.push_back(q4[i].second);
}
sort(x4.begin(),x4.end());
sort(y4.begin(), y4.end());
int minx4 = x4[0], miny4 = y4[0];
int maxx4 = x4[x4.size()-1], maxy4 = y4[y4.size()-1];
int a4 = (maxx4-minx4)*(maxy4-miny4);
cout << "Q4: " << "(" << minx4 << ", " << miny4 << ") " << "(" << maxx4 << ", " << maxy4 << ") " << a4 << endl;
} | # 2069467, 2024-11-02 10:49:44, -----P---- (10%)
#include <iostream>
#include <vector>
using namespace std;
int main () {
int n;
cin >> n;
vector<pair<int, int>> g;
for (int i = 0; i < n; ++i) {
int x,y;
cin >> x >> y;
g.push_back({x,y});
}
cout << "No point in any quadrant" << endl;
} | # 2069539, 2024-11-02 10:56:30, xxxxPx--x- (10%)
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
int main() {
int n;
cin >> n;
vector<pair<int, int>> g;
for (int i = 0; i < n; ++i) {
int x,y;
cin >> x >> y;
g.push_back({x,y});
}
vector<pair<int,int>> q1,q2,q3,q4;
for (int i = 0; i < n; ++i) {
if (g[i].first > 0 && g[i].second > 0) {
q1.push_back({g[i].first,g[i].second});
}
else if (g[i].first < 0 && g[i].second > 0) {
q2.push_back({g[i].first,g[i].second});
}
else if (g[i].first < 0 && g[i].second < 0) {
q3.push_back({g[i].first,g[i].second});
}
else if (g[i].first > 0 && g[i].second < 0) {
q4.push_back({g[i].first,g[i].second});
}
}
vector<int> x1, y1;
int n1 = q1.size();
for (int i = 0; i < n1; ++i) {
x1.push_back(q1[i].first);
y1.push_back(q1[i].second);
}
sort(x1.begin(),x1.end());
sort(y1.begin(), y1.end());
int minx1 = x1[0];
int miny1 = y1[0];
int maxx1 = x1[x1.size()-1];
int maxy1 = y1[y1.size()-1];
int a1 = (maxx1-minx1)*(maxy1-miny1);
cout << "Q1: " << "(" << minx1 << ", " << miny1 << ") " << "(" << maxx1 << ", " << maxy1 << ") " << a1 << endl;
vector<int> x2, y2;
int n2 = q2.size();
for (int i = 0; i < n2; ++i) {
x2.push_back(q2[i].first);
y2.push_back(q2[i].second);
}
sort(x2.begin(),x2.end());
sort(y2.begin(), y2.end());
int minx2 = x2[0];
int miny2 = y2[0];
int maxx2 = x2[x2.size()-1];
int maxy2 = y2[y2.size()-1];
int a2 = (maxx2-minx2)*(maxy2-miny2);
cout << "Q2: " << "(" << minx2 << ", " << miny2 << ") " << "(" << maxx2 << ", " << maxy2 << ") " << a1 << endl;
vector<int> x3, y3;
int n3 = q3.size();
for (int i = 0; i < n3; ++i) {
x3.push_back(q3[i].first);
y3.push_back(q3[i].second);
}
sort(x3.begin(),x3.end());
sort(y3.begin(), y3.end());
int minx3 = x3[0];
int miny3 = y3[0];
int maxx3 = x3[x3.size()-1];
int maxy3 = y3[y3.size()-1];
int a3 = (maxx3-minx3)*(maxy3-miny3);
cout << "Q3: " << "(" << minx3 << ", " << miny3 << ") " << "(" << maxx3 << ", " << maxy3 << ") " << a3 << endl;
vector<int> x4, y4;
int n4 = q4.size();
for (int i = 0; i < n4; ++i) {
x4.push_back(q4[i].first);
y4.push_back(q4[i].second);
}
sort(x4.begin(),x4.end());
sort(y4.begin(), y4.end());
int minx4 = x4[0];
int miny4 = y4[0];
int maxx4 = x4[x4.size()-1];
int maxy4 = y4[y4.size()-1];
int a4 = (maxx4-minx4)*(maxy4-miny4);
cout << "Q4: " << "(" << minx4 << ", " << miny4 << ") " << "(" << maxx4 << ", " << maxy4 << ") " << a4 << endl;
} | # 2069569, 2024-11-02 10:59:05, xxxxPxPPxP (40%)
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
int main() {
int n;
cin >> n;
vector<pair<int, int>> g;
for (int i = 0; i < n; ++i) {
int x,y;
cin >> x >> y;
g.push_back({x,y});
}
vector<pair<int,int>> q1,q2,q3,q4;
for (int i = 0; i < n; ++i) {
if (g[i].first > 0 && g[i].second > 0) {
q1.push_back({g[i].first,g[i].second});
}
else if (g[i].first < 0 && g[i].second > 0) {
q2.push_back({g[i].first,g[i].second});
}
else if (g[i].first < 0 && g[i].second < 0) {
q3.push_back({g[i].first,g[i].second});
}
else if (g[i].first > 0 && g[i].second < 0) {
q4.push_back({g[i].first,g[i].second});
}
}
vector<int> x1, y1;
int n1 = q1.size();
for (int i = 0; i < n1; ++i) {
x1.push_back(q1[i].first);
y1.push_back(q1[i].second);
}
sort(x1.begin(),x1.end());
sort(y1.begin(), y1.end());
int minx1 = x1[0];
int miny1 = y1[0];
int maxx1 = x1[x1.size()-1];
int maxy1 = y1[y1.size()-1];
int a1 = (maxx1-minx1)*(maxy1-miny1);
cout << "Q1: " << "(" << minx1 << ", " << miny1 << ") " << "(" << maxx1 << ", " << maxy1 << ") " << a1 << endl;
vector<int> x2, y2;
int n2 = q2.size();
for (int i = 0; i < n2; ++i) {
x2.push_back(q2[i].first);
y2.push_back(q2[i].second);
}
sort(x2.begin(),x2.end());
sort(y2.begin(), y2.end());
int minx2 = x2[0];
int miny2 = y2[0];
int maxx2 = x2[x2.size()-1];
int maxy2 = y2[y2.size()-1];
int a2 = (maxx2-minx2)*(maxy2-miny2);
cout << "Q2: " << "(" << minx2 << ", " << miny2 << ") " << "(" << maxx2 << ", " << maxy2 << ") " << a2 << endl;
vector<int> x3, y3;
int n3 = q3.size();
for (int i = 0; i < n3; ++i) {
x3.push_back(q3[i].first);
y3.push_back(q3[i].second);
}
sort(x3.begin(),x3.end());
sort(y3.begin(), y3.end());
int minx3 = x3[0];
int miny3 = y3[0];
int maxx3 = x3[x3.size()-1];
int maxy3 = y3[y3.size()-1];
int a3 = (maxx3-minx3)*(maxy3-miny3);
cout << "Q3: " << "(" << minx3 << ", " << miny3 << ") " << "(" << maxx3 << ", " << maxy3 << ") " << a3 << endl;
vector<int> x4, y4;
int n4 = q4.size();
for (int i = 0; i < n4; ++i) {
x4.push_back(q4[i].first);
y4.push_back(q4[i].second);
}
sort(x4.begin(),x4.end());
sort(y4.begin(), y4.end());
int minx4 = x4[0];
int miny4 = y4[0];
int maxx4 = x4[x4.size()-1];
int maxy4 = y4[y4.size()-1];
int a4 = (maxx4-minx4)*(maxy4-miny4);
cout << "Q4: " << "(" << minx4 << ", " << miny4 << ") " << "(" << maxx4 << ", " << maxy4 << ") " << a4 << endl;
} | # 2069599, 2024-11-02 11:02:35, xxxx-xPPxP (30%)
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
int main() {
int n;
cin >> n;
vector<pair<int, int>> g;
for (int i = 0; i < n; ++i) {
int x,y;
cin >> x >> y;
g.push_back({x,y});
}
vector<pair<int,int>> q1,q2,q3,q4,e;
for (int i = 0; i < n; ++i) {
if (g[i].first > 0 && g[i].second > 0) {
q1.push_back({g[i].first,g[i].second});
}
else if (g[i].first <= 0 && g[i].second >= 0) {
q2.push_back({g[i].first,g[i].second});
}
else if (g[i].first < 0 && g[i].second < 0) {
q3.push_back({g[i].first,g[i].second});
}
else if (g[i].first > 0 && g[i].second < 0) {
q4.push_back({g[i].first,g[i].second});
}
else if (g[i].first == 0 || g[i].second == 0) {
e.push_back({g[i].first,g[i].second});
}
}
vector<int> x1, y1;
int n1 = q1.size();
for (int i = 0; i < n1; ++i) {
x1.push_back(q1[i].first);
y1.push_back(q1[i].second);
}
sort(x1.begin(),x1.end());
sort(y1.begin(), y1.end());
int minx1 = x1[0];
int miny1 = y1[0];
int maxx1 = x1[x1.size()-1];
int maxy1 = y1[y1.size()-1];
int a1 = (maxx1-minx1)*(maxy1-miny1);
cout << "Q1: " << "(" << minx1 << ", " << miny1 << ") " << "(" << maxx1 << ", " << maxy1 << ") " << a1 << endl;
vector<int> x2, y2;
int n2 = q2.size();
for (int i = 0; i < n2; ++i) {
x2.push_back(q2[i].first);
y2.push_back(q2[i].second);
}
sort(x2.begin(),x2.end());
sort(y2.begin(), y2.end());
int minx2 = x2[0];
int miny2 = y2[0];
int maxx2 = x2[x2.size()-1];
int maxy2 = y2[y2.size()-1];
int a2 = (maxx2-minx2)*(maxy2-miny2);
cout << "Q2: " << "(" << minx2 << ", " << miny2 << ") " << "(" << maxx2 << ", " << maxy2 << ") " << a2 << endl;
vector<int> x3, y3;
int n3 = q3.size();
for (int i = 0; i < n3; ++i) {
x3.push_back(q3[i].first);
y3.push_back(q3[i].second);
}
sort(x3.begin(),x3.end());
sort(y3.begin(), y3.end());
int minx3 = x3[0];
int miny3 = y3[0];
int maxx3 = x3[x3.size()-1];
int maxy3 = y3[y3.size()-1];
int a3 = (maxx3-minx3)*(maxy3-miny3);
cout << "Q3: " << "(" << minx3 << ", " << miny3 << ") " << "(" << maxx3 << ", " << maxy3 << ") " << a3 << endl;
vector<int> x4, y4;
int n4 = q4.size();
for (int i = 0; i < n4; ++i) {
x4.push_back(q4[i].first);
y4.push_back(q4[i].second);
}
sort(x4.begin(),x4.end());
sort(y4.begin(), y4.end());
int minx4 = x4[0];
int miny4 = y4[0];
int maxx4 = x4[x4.size()-1];
int maxy4 = y4[y4.size()-1];
int a4 = (maxx4-minx4)*(maxy4-miny4);
cout << "Q4: " << "(" << minx4 << ", " << miny4 << ") " << "(" << maxx4 << ", " << maxy4 << ") " << a4 << endl;
} | # 2069615, 2024-11-02 11:04:00, xxxx-xPPxP (30%)
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
int main() {
int n;
cin >> n;
vector<pair<int, int>> g;
for (int i = 0; i < n; ++i) {
int x,y;
cin >> x >> y;
g.push_back({x,y});
}
vector<pair<int,int>> q1,q2,q3,q4,e;
for (int i = 0; i < n; ++i) {
if (g[i].first > 0 && g[i].second > 0) {
q1.push_back({g[i].first,g[i].second});
}
else if (g[i].first <= 0 && g[i].second >= 0) {
q2.push_back({g[i].first,g[i].second});
}
else if (g[i].first < 0 && g[i].second < 0) {
q3.push_back({g[i].first,g[i].second});
}
else if (g[i].first > 0 && g[i].second < 0) {
q4.push_back({g[i].first,g[i].second});
}
else if (g[i].first == 0 || g[i].second == 0) {
e.push_back({g[i].first,g[i].second});
}
}
if (e.size() == n) {
cout << "No point in any quadrant" << endl;
}
else {
vector<int> x1, y1;
int n1 = q1.size();
for (int i = 0; i < n1; ++i) {
x1.push_back(q1[i].first);
y1.push_back(q1[i].second);
}
sort(x1.begin(),x1.end());
sort(y1.begin(), y1.end());
int minx1 = x1[0];
int miny1 = y1[0];
int maxx1 = x1[x1.size()-1];
int maxy1 = y1[y1.size()-1];
int a1 = (maxx1-minx1)*(maxy1-miny1);
cout << "Q1: " << "(" << minx1 << ", " << miny1 << ") " << "(" << maxx1 << ", " << maxy1 << ") " << a1 << endl;
vector<int> x2, y2;
int n2 = q2.size();
for (int i = 0; i < n2; ++i) {
x2.push_back(q2[i].first);
y2.push_back(q2[i].second);
}
sort(x2.begin(),x2.end());
sort(y2.begin(), y2.end());
int minx2 = x2[0];
int miny2 = y2[0];
int maxx2 = x2[x2.size()-1];
int maxy2 = y2[y2.size()-1];
int a2 = (maxx2-minx2)*(maxy2-miny2);
cout << "Q2: " << "(" << minx2 << ", " << miny2 << ") " << "(" << maxx2 << ", " << maxy2 << ") " << a2 << endl;
vector<int> x3, y3;
int n3 = q3.size();
for (int i = 0; i < n3; ++i) {
x3.push_back(q3[i].first);
y3.push_back(q3[i].second);
}
sort(x3.begin(),x3.end());
sort(y3.begin(), y3.end());
int minx3 = x3[0];
int miny3 = y3[0];
int maxx3 = x3[x3.size()-1];
int maxy3 = y3[y3.size()-1];
int a3 = (maxx3-minx3)*(maxy3-miny3);
cout << "Q3: " << "(" << minx3 << ", " << miny3 << ") " << "(" << maxx3 << ", " << maxy3 << ") " << a3 << endl;
vector<int> x4, y4;
int n4 = q4.size();
for (int i = 0; i < n4; ++i) {
x4.push_back(q4[i].first);
y4.push_back(q4[i].second);
}
sort(x4.begin(),x4.end());
sort(y4.begin(), y4.end());
int minx4 = x4[0];
int miny4 = y4[0];
int maxx4 = x4[x4.size()-1];
int maxy4 = y4[y4.size()-1];
int a4 = (maxx4-minx4)*(maxy4-miny4);
cout << "Q4: " << "(" << minx4 << ", " << miny4 << ") " << "(" << maxx4 << ", " << maxy4 << ") " << a4 << endl;
}
} | # 2069672, 2024-11-02 11:11:10, xxxx-xP-xP (20%)
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
int main() {
int n;
cin >> n;
vector<pair<int, int>> g;
for (int i = 0; i < n; ++i) {
int x,y;
cin >> x >> y;
g.push_back({x,y});
}
vector<pair<int,int>> q1,q2,q3,q4;
vector<int> e;
for (int i = 0; i < n; ++i) {
if (g[i].first > 0 && g[i].second > 0) {
q1.push_back({g[i].first,g[i].second});
}
else if (g[i].first <= 0 && g[i].second >= 0) {
q2.push_back({g[i].first,g[i].second});
}
else if (g[i].first < 0 && g[i].second < 0) {
q3.push_back({g[i].first,g[i].second});
}
else if (g[i].first > 0 && g[i].second < 0) {
q4.push_back({g[i].first,g[i].second});
}
else if (g[i].first == 0 || g[i].second == 0) {
e.push_back(g[i].first);
}
}
int am = e.size();
if (am == n) {
cout << "No point in any quadrant" << endl;
}
else {
vector<int> x1, y1;
int n1 = q1.size();
for (int i = 0; i < n1; ++i) {
x1.push_back(q1[i].first);
y1.push_back(q1[i].second);
}
sort(x1.begin(),x1.end());
sort(y1.begin(), y1.end());
int minx1 = x1[0];
int miny1 = y1[0];
int maxx1 = x1[x1.size()-1];
int maxy1 = y1[y1.size()-1];
int a1 = (maxx1-minx1)*(maxy1-miny1);
if (minx1 != maxx1 || miny1 != maxy1) {
cout << "Q1: " << "(" << minx1 << ", " << miny1 << ") " << "(" << maxx1 << ", " << maxy1 << ") " << a1 << endl;
}
vector<int> x2, y2;
int n2 = q2.size();
for (int i = 0; i < n2; ++i) {
x2.push_back(q2[i].first);
y2.push_back(q2[i].second);
}
sort(x2.begin(),x2.end());
sort(y2.begin(), y2.end());
int minx2 = x2[0];
int miny2 = y2[0];
int maxx2 = x2[x2.size()-1];
int maxy2 = y2[y2.size()-1];
int a2 = (maxx2-minx2)*(maxy2-miny2);
if (minx2 != maxx2 || miny2 != maxy2) {
cout << "Q2: " << "(" << minx2 << ", " << miny2 << ") " << "(" << maxx2 << ", " << maxy2 << ") " << a2 << endl;
}
vector<int> x3, y3;
int n3 = q3.size();
for (int i = 0; i < n3; ++i) {
x3.push_back(q3[i].first);
y3.push_back(q3[i].second);
}
sort(x3.begin(),x3.end());
sort(y3.begin(), y3.end());
int minx3 = x3[0];
int miny3 = y3[0];
int maxx3 = x3[x3.size()-1];
int maxy3 = y3[y3.size()-1];
int a3 = (maxx3-minx3)*(maxy3-miny3);
cout << "Q3: " << "(" << minx3 << ", " << miny3 << ") " << "(" << maxx3 << ", " << maxy3 << ") " << a3 << endl;
vector<int> x4, y4;
int n4 = q4.size();
for (int i = 0; i < n4; ++i) {
x4.push_back(q4[i].first);
y4.push_back(q4[i].second);
}
sort(x4.begin(),x4.end());
sort(y4.begin(), y4.end());
int minx4 = x4[0];
int miny4 = y4[0];
int maxx4 = x4[x4.size()-1];
int maxy4 = y4[y4.size()-1];
int a4 = (maxx4-minx4)*(maxy4-miny4);
cout << "Q4: " << "(" << minx4 << ", " << miny4 << ") " << "(" << maxx4 << ", " << maxy4 << ") " << a4 << endl;
}
} | # 2069701, 2024-11-02 11:15:04, xxxx-xPPxP (30%)
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
int main() {
int n;
cin >> n;
vector<pair<int, int>> g;
for (int i = 0; i < n; ++i) {
int x,y;
cin >> x >> y;
g.push_back({x,y});
}
vector<pair<int,int>> q1,q2,q3,q4;
vector<int> e;
for (int i = 0; i < n; ++i) {
if (g[i].first > 0 && g[i].second > 0) {
q1.push_back({g[i].first,g[i].second});
}
else if (g[i].first <= 0 && g[i].second >= 0) {
q2.push_back({g[i].first,g[i].second});
}
else if (g[i].first < 0 && g[i].second < 0) {
q3.push_back({g[i].first,g[i].second});
}
else if (g[i].first > 0 && g[i].second < 0) {
q4.push_back({g[i].first,g[i].second});
}
else if (g[i].first == 0 || g[i].second == 0) {
e.push_back(g[i].first);
}
}
int am = e.size();
if (am == n) {
cout << "No point in any quadrant" << endl;
}
else {
vector<int> x1, y1;
int n1 = q1.size();
for (int i = 0; i < n1; ++i) {
x1.push_back(q1[i].first);
y1.push_back(q1[i].second);
}
sort(x1.begin(),x1.end());
sort(y1.begin(), y1.end());
int minx1 = x1[0];
int miny1 = y1[0];
int maxx1 = x1[x1.size()-1];
int maxy1 = y1[y1.size()-1];
int a1 = (maxx1-minx1)*(maxy1-miny1);
if (q1.size() != 0) {
cout << "Q1: " << "(" << minx1 << ", " << miny1 << ") " << "(" << maxx1 << ", " << maxy1 << ") " << a1 << endl;
}
vector<int> x2, y2;
int n2 = q2.size();
for (int i = 0; i < n2; ++i) {
x2.push_back(q2[i].first);
y2.push_back(q2[i].second);
}
sort(x2.begin(),x2.end());
sort(y2.begin(), y2.end());
int minx2 = x2[0];
int miny2 = y2[0];
int maxx2 = x2[x2.size()-1];
int maxy2 = y2[y2.size()-1];
int a2 = (maxx2-minx2)*(maxy2-miny2);
if (q2.size() != 0) {
cout << "Q2: " << "(" << minx2 << ", " << miny2 << ") " << "(" << maxx2 << ", " << maxy2 << ") " << a2 << endl;
}
vector<int> x3, y3;
int n3 = q3.size();
for (int i = 0; i < n3; ++i) {
x3.push_back(q3[i].first);
y3.push_back(q3[i].second);
}
sort(x3.begin(),x3.end());
sort(y3.begin(), y3.end());
int minx3 = x3[0];
int miny3 = y3[0];
int maxx3 = x3[x3.size()-1];
int maxy3 = y3[y3.size()-1];
int a3 = (maxx3-minx3)*(maxy3-miny3);
if (q3.size() != 0) {
cout << "Q3: " << "(" << minx3 << ", " << miny3 << ") " << "(" << maxx3 << ", " << maxy3 << ") " << a3 << endl;
}
vector<int> x4, y4;
int n4 = q4.size();
for (int i = 0; i < n4; ++i) {
x4.push_back(q4[i].first);
y4.push_back(q4[i].second);
}
sort(x4.begin(),x4.end());
sort(y4.begin(), y4.end());
int minx4 = x4[0];
int miny4 = y4[0];
int maxx4 = x4[x4.size()-1];
int maxy4 = y4[y4.size()-1];
int a4 = (maxx4-minx4)*(maxy4-miny4);
if (q4.size() != 0) {
cout << "Q4: " << "(" << minx4 << ", " << miny4 << ") " << "(" << maxx4 << ", " << maxy4 << ") " << a4 << endl;
}
}
} | # 2069744, 2024-11-02 11:21:09, xxxxPPPPxP (50%)
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
int main() {
int n;
cin >> n;
vector<pair<int, int>> g;
for (int i = 0; i < n; ++i) {
int x,y;
cin >> x >> y;
g.push_back({x,y});
}
vector<pair<int,int>> q1,q2,q3,q4;
vector<int> e;
for (int i = 0; i < n; ++i) {
if (g[i].first > 0 && g[i].second > 0) {
q1.push_back({g[i].first,g[i].second});
}
else if (g[i].first < 0 && g[i].second > 0) {
q2.push_back({g[i].first,g[i].second});
}
else if (g[i].first < 0 && g[i].second < 0) {
q3.push_back({g[i].first,g[i].second});
}
else if (g[i].first > 0 && g[i].second < 0) {
q4.push_back({g[i].first,g[i].second});
}
else if (g[i].first == 0 || g[i].second == 0) {
e.push_back(g[i].first);
}
}
int am = e.size();
if (am == n) {
cout << "No point in any quadrant" << endl;
}
else {
vector<int> x1, y1;
int n1 = q1.size();
for (int i = 0; i < n1; ++i) {
x1.push_back(q1[i].first);
y1.push_back(q1[i].second);
}
sort(x1.begin(),x1.end());
sort(y1.begin(), y1.end());
int minx1 = x1[0];
int miny1 = y1[0];
int maxx1 = x1[x1.size()-1];
int maxy1 = y1[y1.size()-1];
int a1 = (maxx1-minx1)*(maxy1-miny1);
if (q1.size() != 0) {
cout << "Q1: " << "(" << minx1 << ", " << miny1 << ") " << "(" << maxx1 << ", " << maxy1 << ") " << a1 << endl;
}
vector<int> x2, y2;
int n2 = q2.size();
for (int i = 0; i < n2; ++i) {
x2.push_back(q2[i].first);
y2.push_back(q2[i].second);
}
sort(x2.begin(),x2.end());
sort(y2.begin(), y2.end());
int minx2 = x2[0];
int miny2 = y2[0];
int maxx2 = x2[x2.size()-1];
int maxy2 = y2[y2.size()-1];
int a2 = (maxx2-minx2)*(maxy2-miny2);
if (q2.size() != 0) {
cout << "Q2: " << "(" << minx2 << ", " << miny2 << ") " << "(" << maxx2 << ", " << maxy2 << ") " << a2 << endl;
}
vector<int> x3, y3;
int n3 = q3.size();
for (int i = 0; i < n3; ++i) {
x3.push_back(q3[i].first);
y3.push_back(q3[i].second);
}
sort(x3.begin(),x3.end());
sort(y3.begin(), y3.end());
int minx3 = x3[0];
int miny3 = y3[0];
int maxx3 = x3[x3.size()-1];
int maxy3 = y3[y3.size()-1];
int a3 = (maxx3-minx3)*(maxy3-miny3);
if (q3.size() != 0) {
cout << "Q3: " << "(" << minx3 << ", " << miny3 << ") " << "(" << maxx3 << ", " << maxy3 << ") " << a3 << endl;
}
vector<int> x4, y4;
int n4 = q4.size();
for (int i = 0; i < n4; ++i) {
x4.push_back(q4[i].first);
y4.push_back(q4[i].second);
}
sort(x4.begin(),x4.end());
sort(y4.begin(), y4.end());
int minx4 = x4[0];
int miny4 = y4[0];
int maxx4 = x4[x4.size()-1];
int maxy4 = y4[y4.size()-1];
int a4 = (maxx4-minx4)*(maxy4-miny4);
if (q4.size() != 0) {
cout << "Q4: " << "(" << minx4 << ", " << miny4 << ") " << "(" << maxx4 << ", " << maxy4 << ") " << a4 << endl;
}
}
} | # 2069864, 2024-11-02 11:30:59, PPPPPPPPPP (100%)
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
int main() {
int n;
cin >> n;
vector<pair<int, int>> g;
for (int i = 0; i < n; ++i) {
int x,y;
cin >> x >> y;
g.push_back({x,y});
}
vector<pair<int,int>> q1,q2,q3,q4;
vector<int> e;
for (int i = 0; i < n; ++i) {
if (g[i].first > 0 && g[i].second > 0) {
q1.push_back({g[i].first,g[i].second});
}
else if (g[i].first < 0 && g[i].second > 0) {
q2.push_back({g[i].first,g[i].second});
}
else if (g[i].first < 0 && g[i].second < 0) {
q3.push_back({g[i].first,g[i].second});
}
else if (g[i].first > 0 && g[i].second < 0) {
q4.push_back({g[i].first,g[i].second});
}
else if (g[i].first == 0 || g[i].second == 0) {
e.push_back(g[i].first);
}
}
int am = e.size();
if (am == n) {
cout << "No point in any quadrant" << endl;
}
else {
vector<int> x1, y1;
int n1 = q1.size();
for (int i = 0; i < n1; ++i) {
x1.push_back(q1[i].first);
y1.push_back(q1[i].second);
}
if (x1.size() > 0) {
sort(x1.begin(),x1.end());
sort(y1.begin(), y1.end());
int minx1 = x1[0];
int miny1 = y1[0];
int maxx1 = x1[x1.size()-1];
int maxy1 = y1[y1.size()-1];
int a1 = (maxx1-minx1)*(maxy1-miny1);
if (q1.size() != 0) {
cout << "Q1: " << "(" << minx1 << ", " << miny1 << ") " << "(" << maxx1 << ", " << maxy1 << ") " << a1 << endl;
}
}
vector<int> x2, y2;
int n2 = q2.size();
for (int i = 0; i < n2; ++i) {
x2.push_back(q2[i].first);
y2.push_back(q2[i].second);
}
if (x2.size() > 0) {
sort(x2.begin(),x2.end());
sort(y2.begin(), y2.end());
int minx2 = x2[0];
int miny2 = y2[0];
int maxx2 = x2[x2.size()-1];
int maxy2 = y2[y2.size()-1];
int a2 = (maxx2-minx2)*(maxy2-miny2);
if (q2.size() != 0) {
cout << "Q2: " << "(" << minx2 << ", " << miny2 << ") " << "(" << maxx2 << ", " << maxy2 << ") " << a2 << endl;
}
}
vector<int> x3, y3;
int n3 = q3.size();
for (int i = 0; i < n3; ++i) {
x3.push_back(q3[i].first);
y3.push_back(q3[i].second);
}
if (x3.size() > 0) {
sort(x3.begin(),x3.end());
sort(y3.begin(), y3.end());
int minx3 = x3[0];
int miny3 = y3[0];
int maxx3 = x3[x3.size()-1];
int maxy3 = y3[y3.size()-1];
int a3 = (maxx3-minx3)*(maxy3-miny3);
if (q3.size() != 0) {
cout << "Q3: " << "(" << minx3 << ", " << miny3 << ") " << "(" << maxx3 << ", " << maxy3 << ") " << a3 << endl;
}
}
vector<int> x4, y4;
int n4 = q4.size();
for (int i = 0; i < n4; ++i) {
x4.push_back(q4[i].first);
y4.push_back(q4[i].second);
}
if (x4.size() > 0) {
sort(x4.begin(),x4.end());
sort(y4.begin(), y4.end());
int minx4 = x4[0];
int miny4 = y4[0];
int maxx4 = x4[x4.size()-1];
int maxy4 = y4[y4.size()-1];
int a4 = (maxx4-minx4)*(maxy4-miny4);
if (q4.size() != 0) {
cout << "Q4: " << "(" << minx4 << ", " << miny4 << ") " << "(" << maxx4 << ", " << maxy4 << ") " << a4 << endl;
}
}
}
} |
# 2071238, 2024-11-02 14:11:41, -----P---- (10%)
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
using namespace std;
int main(){
int n,x,y;
cin>>n;
vector<pair<int,int> > v;
for(int i=0;i<n;i++){
cin>>x>>y;
}
cout<<"No point in any quadrant";
} | # 2071277, 2024-11-02 14:18:02, -----P---- (10%)
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
using namespace std;
int main(){
int n,x,y;
cin>>n;
vector<pair<int,int> > Q1,Q2,Q3,Q4;
for(int i=0;i<n;i++){
cin>>x>>y;
if(x>0&&y>0){
Q1.push_back(make_pair(x,y));
}else if(x<0&&y>0){
Q2.push_back(make_pair(x,y));
}else if(x<0&&y<0){
Q3.push_back(make_pair(x,y));
}else if(x>0&&y>0){
Q4.push_back(make_pair(x,y));
}
}
if(Q1.size()==0&&Q2.size()==0&&Q3.size()==0&&Q4.size()==0){
cout<<"No point in any quadrant";
}
} | # 2071348, 2024-11-02 14:25:17, -----P---- (10%)
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
using namespace std;
int main(){
int n,x,y;
int max1,max2,max3,max4;
max1=max2=max3=max4=0;
cin>>n;
vector<pair<int,int> > Q1,Q2,Q3,Q4;
for(int i=0;i<n;i++){
cin>>x>>y;
if(x>0&&y>0){
Q1.push_back(make_pair(x,y));
}else if(x<0&&y>0){
Q2.push_back(make_pair(x,y));
}else if(x<0&&y<0){
Q3.push_back(make_pair(x,y));
}else if(x>0&&y>0){
Q4.push_back(make_pair(x,y));
}
}
if(Q1.size()==0&&Q2.size()==0&&Q3.size()==0&&Q4.size()==0){
cout<<"No point in any quadrant";
}
if(Q1.size()!=0){
if(Q1.size()==1){
cout<<"Q1: ("<<Q1[0].first<<", "<<Q1[0].second<<") ("<<Q1[0].first<<", "<<Q1[0].second<<") 0"<<endl;
}
}
if(Q2.size()!=0){
if(Q2.size()==1){
cout<<"Q2: ("<<Q2[0].first<<", "<<Q2[0].second<<") ("<<Q2[0].first<<", "<<Q2[0].second<<") 0"<<endl;
}
}
if(Q3.size()!=0){
if(Q3.size()==1){
cout<<"Q3: ("<<Q3[0].first<<", "<<Q3[0].second<<") ("<<Q3[0].first<<", "<<Q3[0].second<<") 0"<<endl;
}
}
if(Q4.size()!=0){
if(Q4.size()==1){
cout<<"Q4: ("<<Q4[0].first<<", "<<Q4[0].second<<") ("<<Q4[0].first<<", "<<Q4[0].second<<") 0"<<endl;
}
}
} | # 2071365, 2024-11-02 14:27:32, ----PP---- (20%)
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
using namespace std;
int main(){
int n,x,y;
int max1,max2,max3,max4;
max1=max2=max3=max4=0;
cin>>n;
vector<pair<int,int> > Q1,Q2,Q3,Q4;
for(int i=0;i<n;i++){
cin>>x>>y;
if(x>0&&y>0){
Q1.push_back(make_pair(x,y));
}else if(x<0&&y>0){
Q2.push_back(make_pair(x,y));
}else if(x<0&&y<0){
Q3.push_back(make_pair(x,y));
}else if(x>0&&y<0){
Q4.push_back(make_pair(x,y));
}
}
if(Q1.size()==0&&Q2.size()==0&&Q3.size()==0&&Q4.size()==0){
cout<<"No point in any quadrant";
}
if(Q1.size()!=0){
if(max1==0){
cout<<"Q1: ("<<Q1[0].first<<", "<<Q1[0].second<<") ("<<Q1[0].first<<", "<<Q1[0].second<<") 0"<<endl;
}
}
if(Q2.size()!=0){
if(max2==0){
cout<<"Q2: ("<<Q2[0].first<<", "<<Q2[0].second<<") ("<<Q2[0].first<<", "<<Q2[0].second<<") 0"<<endl;
}
}
if(Q3.size()!=0){
if(max3==0){
cout<<"Q3: ("<<Q3[0].first<<", "<<Q3[0].second<<") ("<<Q3[0].first<<", "<<Q3[0].second<<") 0"<<endl;
}
}
if(Q4.size()!=0){
if(max4==0){
cout<<"Q4: ("<<Q4[0].first<<", "<<Q4[0].second<<") ("<<Q4[0].first<<", "<<Q4[0].second<<") 0"<<endl;
}
}
} | # 2071489, 2024-11-02 14:41:36, TTTTTPTTTT (10%)
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<cmath>
using namespace std;
int main(){
int n,x,y;
int max1,max2,max3,max4;
int po1,po2,po3,po4,Po1,Po2,Po3,Po4;
max1=max2=max3=max4=0;
cin>>n;
vector<pair<int,int> > Q1,Q2,Q3,Q4;
for(int i=0;i<n;i++){
cin>>x>>y;
if(x>0&&y>0){
Q1.push_back(make_pair(x,y));
}else if(x<0&&y>0){
Q2.push_back(make_pair(x,y));
}else if(x<0&&y<0){
Q3.push_back(make_pair(x,y));
}else if(x>0&&y<0){
Q4.push_back(make_pair(x,y));
}
}
//check for Q1
for(int i=0;i<Q1.size();i++){
for(int j=0;j<Q1.size();i++){
int area = abs((Q1[i].first-Q1[j].first)*(Q1[i].second-Q1[j].second));
if(area>=max1){
max1=area;
po1=i;
Po1=j;
}
}
}
//Q2
for(int i=0;i<Q2.size();i++){
for(int j=0;j<Q2.size();i++){
int area = abs((Q2[i].first-Q2[j].first)*(Q2[i].second-Q2[j].second));
if(area>=max1){
max1=area;
po2=i;
Po2=j;
}
}
}
//Q3
for(int i=0;i<Q3.size();i++){
for(int j=0;j<Q3.size();i++){
int area = abs((Q3[i].first-Q3[j].first)*(Q3[i].second-Q3[j].second));
if(area>=max1){
max1=area;
po3=i;
Po3=j;
}
}
}
//Q4
for(int i=0;i<Q4.size();i++){
for(int j=0;j<Q4.size();i++){
int area = (Q4[i].first-Q4[j].first)*(Q4[i].second-Q4[j].second);
if(area>=max1){
max1=area;
po4=i;
Po4=j;
}
}
}
/////
if(Q1.size()==0&&Q2.size()==0&&Q3.size()==0&&Q4.size()==0){
cout<<"No point in any quadrant";
}
if(Q1.size()!=0){
if(max1==0){
cout<<"Q1: ("<<Q1[0].first<<", "<<Q1[0].second<<") ("<<Q1[0].first<<", "<<Q1[0].second<<") 0"<<endl;
}else{
cout<<"Q1: ("<<Q1[po1].first<<", "<<Q1[po1].second<<") ("<<Q1[Po1].first<<", "<<Q1[Po1].second<<") "<<max1<<endl;
}
}
if(Q2.size()!=0){
if(max2==0){
cout<<"Q2: ("<<Q2[0].first<<", "<<Q2[0].second<<") ("<<Q2[0].first<<", "<<Q2[0].second<<") 0"<<endl;
}else{
cout<<"Q2: ("<<Q2[po2].first<<", "<<Q2[po2].second<<") ("<<Q2[Po2].first<<", "<<Q2[Po2].second<<") "<<max2<<endl;
}
}
if(Q3.size()!=0){
if(max3==0){
cout<<"Q3: ("<<Q3[0].first<<", "<<Q3[0].second<<") ("<<Q3[0].first<<", "<<Q3[0].second<<") 0"<<endl;
}else{
cout<<"Q3: ("<<Q3[po3].first<<", "<<Q3[po3].second<<") ("<<Q3[Po3].first<<", "<<Q3[Po3].second<<") "<<max3<<endl;
}
}
if(Q4.size()!=0){
if(max4==0){
cout<<"Q4: ("<<Q4[0].first<<", "<<Q4[0].second<<") ("<<Q4[0].first<<", "<<Q4[0].second<<") 0"<<endl;
}else{
cout<<"Q4: ("<<Q4[po4].first<<", "<<Q4[po4].second<<") ("<<Q4[Po4].first<<", "<<Q4[Po4].second<<") "<<max4<<endl;
}
}
} | # 2071506, 2024-11-02 14:43:00, ----PP---- (20%)
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<cmath>
using namespace std;
int main(){
int n,x,y;
int max1,max2,max3,max4;
int po1,po2,po3,po4,Po1,Po2,Po3,Po4;
max1=max2=max3=max4=0;
cin>>n;
vector<pair<int,int> > Q1,Q2,Q3,Q4;
for(int i=0;i<n;i++){
cin>>x>>y;
if(x>0&&y>0){
Q1.push_back(make_pair(x,y));
}else if(x<0&&y>0){
Q2.push_back(make_pair(x,y));
}else if(x<0&&y<0){
Q3.push_back(make_pair(x,y));
}else if(x>0&&y<0){
Q4.push_back(make_pair(x,y));
}
}
//check for Q1
for(int i=0;i<Q1.size();i++){
for(int j=0;j<Q1.size();j++){
int area = abs((Q1[i].first-Q1[j].first)*(Q1[i].second-Q1[j].second));
if(area>=max1){
max1=area;
po1=i;
Po1=j;
}
}
}
//Q2
for(int i=0;i<Q2.size();i++){
for(int j=0;j<Q2.size();j++){
int area = abs((Q2[i].first-Q2[j].first)*(Q2[i].second-Q2[j].second));
if(area>=max1){
max1=area;
po2=i;
Po2=j;
}
}
}
//Q3
for(int i=0;i<Q3.size();i++){
for(int j=0;j<Q3.size();j++){
int area = abs((Q3[i].first-Q3[j].first)*(Q3[i].second-Q3[j].second));
if(area>=max1){
max1=area;
po3=i;
Po3=j;
}
}
}
//Q4
for(int i=0;i<Q4.size();i++){
for(int j=0;j<Q4.size();j++){
int area = (Q4[i].first-Q4[j].first)*(Q4[i].second-Q4[j].second);
if(area>=max1){
max1=area;
po4=i;
Po4=j;
}
}
}
/////
if(Q1.size()==0&&Q2.size()==0&&Q3.size()==0&&Q4.size()==0){
cout<<"No point in any quadrant";
}
if(Q1.size()!=0){
if(max1==0){
cout<<"Q1: ("<<Q1[0].first<<", "<<Q1[0].second<<") ("<<Q1[0].first<<", "<<Q1[0].second<<") 0"<<endl;
}else{
cout<<"Q1: ("<<Q1[po1].first<<", "<<Q1[po1].second<<") ("<<Q1[Po1].first<<", "<<Q1[Po1].second<<") "<<max1<<endl;
}
}
if(Q2.size()!=0){
if(max2==0){
cout<<"Q2: ("<<Q2[0].first<<", "<<Q2[0].second<<") ("<<Q2[0].first<<", "<<Q2[0].second<<") 0"<<endl;
}else{
cout<<"Q2: ("<<Q2[po2].first<<", "<<Q2[po2].second<<") ("<<Q2[Po2].first<<", "<<Q2[Po2].second<<") "<<max2<<endl;
}
}
if(Q3.size()!=0){
if(max3==0){
cout<<"Q3: ("<<Q3[0].first<<", "<<Q3[0].second<<") ("<<Q3[0].first<<", "<<Q3[0].second<<") 0"<<endl;
}else{
cout<<"Q3: ("<<Q3[po3].first<<", "<<Q3[po3].second<<") ("<<Q3[Po3].first<<", "<<Q3[Po3].second<<") "<<max3<<endl;
}
}
if(Q4.size()!=0){
if(max4==0){
cout<<"Q4: ("<<Q4[0].first<<", "<<Q4[0].second<<") ("<<Q4[0].first<<", "<<Q4[0].second<<") 0"<<endl;
}else{
cout<<"Q4: ("<<Q4[po4].first<<", "<<Q4[po4].second<<") ("<<Q4[Po4].first<<", "<<Q4[Po4].second<<") "<<max4<<endl;
}
}
} | # 2071732, 2024-11-02 15:09:35, PPPPPPPPPP (100%)
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<cmath>
using namespace std;
int main(){
int n,x,y;
int minx1,minx2,minx3,minx4,miny1,miny2,miny3,miny4, maxx1,maxx2,maxx3,maxx4,maxy1,maxy2,maxy3,maxy4;
int po1,po2,po3,po4,Po1,Po2,Po3,Po4;
minx1=minx2=minx3=minx4=10000000;
miny1=miny2=miny3=miny4=10000000;
maxx1=maxx2=maxx3=maxx4=maxy1=maxy2=maxy3=maxy4=-10000000;
cin>>n;
vector<pair<int,int> > Q1,Q2,Q3,Q4;
for(int i=0;i<n;i++){
cin>>x>>y;
if(x>0&&y>0){
Q1.push_back(make_pair(x,y));
}else if(x<0&&y>0){
Q2.push_back(make_pair(x,y));
}else if(x<0&&y<0){
Q3.push_back(make_pair(x,y));
}else if(x>0&&y<0){
Q4.push_back(make_pair(x,y));
}
}
//check for Q1
for(int i=0;i<Q1.size();i++){
if(Q1[i].first<=minx1) minx1=Q1[i].first;
if(Q1[i].second<=miny1) miny1=Q1[i].second;
if(Q1[i].first>=maxx1) maxx1=Q1[i].first;
if(Q1[i].second>=maxy1) maxy1=Q1[i].second;
}
//Q2
for(int i=0;i<Q2.size();i++){
if(Q2[i].first<=minx2) minx2=Q2[i].first;
if(Q2[i].second<=miny2) miny2=Q2[i].second;
if(Q2[i].first>=maxx2) maxx2=Q2[i].first;
if(Q2[i].second>=maxy2) maxy2=Q2[i].second;
}
//Q3
for(int i=0;i<Q3.size();i++){
if(Q3[i].first<=minx3) minx3=Q3[i].first;
if(Q3[i].second<=miny3) miny3=Q3[i].second;
if(Q3[i].first>=maxx3) maxx3=Q3[i].first;
if(Q3[i].second>=maxy3) maxy3=Q3[i].second;
}
//Q4
for(int i=0;i<Q4.size();i++){
if(Q4[i].first<=minx4) minx4=Q4[i].first;
if(Q4[i].second<=miny4) miny4=Q4[i].second;
if(Q4[i].first>=maxx4) maxx4=Q4[i].first;
if(Q4[i].second>=maxy4) maxy4=Q4[i].second;
}
/////
if(Q1.size()==0&&Q2.size()==0&&Q3.size()==0&&Q4.size()==0){
cout<<"No point in any quadrant";
}
if(Q1.size()!=0){
int area1= abs((maxx1-minx1)*(maxy1-miny1));
if(area1==0){
cout<<"Q1: ("<<minx1<<", "<<miny1<<") ("<<maxx1<<", "<<maxy1<<") "<<area1<<endl;
}else{
cout<<"Q1: ("<<minx1<<", "<<miny1<<") ("<<maxx1<<", "<<maxy1<<") "<<area1<<endl;
}
}
if(Q2.size()!=0){
int area2= abs((maxx2-minx2)*(maxy2-miny2));
if(area2==0){
cout<<"Q2: ("<<minx2<<", "<<miny2<<") ("<<maxx2<<", "<<maxy2<<") "<<area2<<endl;
}else{
cout<<"Q2: ("<<minx2<<", "<<miny2<<") ("<<maxx2<<", "<<maxy2<<") "<<area2<<endl;
}
}
if(Q3.size()!=0){
int area3= abs((maxx3-minx3)*(maxy3-miny3));
if(area3==0){
cout<<"Q3: ("<<minx3<<", "<<miny3<<") ("<<maxx3<<", "<<maxy3<<") "<<area3<<endl;
}else{
cout<<"Q3: ("<<minx3<<", "<<miny3<<") ("<<maxx3<<", "<<maxy3<<") "<<area3<<endl;
}
}
if(Q4.size()!=0){
int area4= abs((maxx4-minx4)*(maxy4-miny4));
if(area4==0){
cout<<"Q4: ("<<minx4<<", "<<miny4<<") ("<<maxx4<<", "<<maxy4<<") "<<area4<<endl;
}else{
cout<<"Q4: ("<<minx4<<", "<<miny4<<") ("<<maxx4<<", "<<maxy4<<") "<<area4<<endl;
}
}
} |
# 2070780, 2024-11-02 13:16:09, -----P---- (10%)
#include<bits/stdc++.h>
using namespace std;
int main(){
cout<<"No point in any quadrant";
} | # 2070951, 2024-11-02 13:37:35, xxxxPxPPxP (40%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,x,y;
set<int> xq1;
set<int> xq2;
set<int> xq3;
set<int> xq4;
set<int> yq1;
set<int> yq2;
set<int> yq3;
set<int> yq4;
cin>>n;
while(n--){
cin>>x>>y;
if(x>0&&y>0&&x!=0&&y!=0){xq1.insert(x); yq1.insert(y);}
if(x<0&&y>0&&x!=0&&y!=0){xq2.insert(x); yq2.insert(y);}
if(x<0&&y<0&&x!=0&&y!=0){xq3.insert(x); yq3.insert(y);}
if(x>0&&y<0&&x!=0&&y!=0){xq4.insert(x); yq4.insert(y);}
}
int max1=0,max2=0,max3=0,max4=0;
auto b1x=xq1.begin();
auto e1x=xq1.rbegin();
auto b1y=yq1.begin();
auto e1y=yq1.rbegin();
max1= (abs((*(e1x))-(*(b1x))))*(abs((*(e1y))-(*(b1y))));
auto b2x=xq2.begin();
auto e2x=xq2.rbegin();
auto b2y=yq2.begin();
auto e2y=yq2.rbegin();
max2= (abs((*(e2x))-(*(b2x))))*(abs((*(e2y))-(*(b2y))));
auto b3x=xq3.begin();
auto e3x=xq3.rbegin();
auto b3y=yq3.begin();
auto e3y=yq3.rbegin();
max3= (abs((*(e3x))-(*(b3x))))*(abs((*(e3y))-(*(b3y))));
auto b4x=xq4.begin();
auto e4x=xq4.rbegin();
auto b4y=yq4.begin();
auto e4y=yq4.rbegin();
max4= (abs((*(e4x))-(*(b4x))))*(abs((*(e4y))-(*(b4y))));
cout<<"Q1: "<<"("<<*b1x<<", "<<*b1y<<") ("<<*e1x<<", "<<*e1y<<") "<<max1<<endl;
cout<<"Q2: "<<"("<<*b2x<<", "<<*b2y<<") ("<<*e2x<<", "<<*e2y<<") "<<max2<<endl;
cout<<"Q3: "<<"("<<*b3x<<", "<<*b3y<<") ("<<*e3x<<", "<<*e3y<<") "<<max3<<endl;
cout<<"Q4: "<<"("<<*b4x<<", "<<*b4y<<") ("<<*e4x<<", "<<*e4y<<") "<<max4<<endl;
} | # 2071012, 2024-11-02 13:44:15, xxxx-xP-xP (20%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,x,y;
bool bq1,bq2,bq3,bq4;
set<int> xq1;
set<int> xq2;
set<int> xq3;
set<int> xq4;
set<int> yq1;
set<int> yq2;
set<int> yq3;
set<int> yq4;
cin>>n;
while(n--){
cin>>x>>y;
if(x>0&&y>0&&x!=0&&y!=0){xq1.insert(x); yq1.insert(y);}
if(x<0&&y>0&&x!=0&&y!=0){xq2.insert(x); yq2.insert(y);}
if(x<0&&y<0&&x!=0&&y!=0){xq3.insert(x); yq3.insert(y);}
if(x>0&&y<0&&x!=0&&y!=0){xq4.insert(x); yq4.insert(y);}
}
int max1=0,max2=0,max3=0,max4=0;
if(xq1.size()>1){
bq1=true;
}
else{
bq1=false;
}
if(xq2.size()>1){
bq2=true;
}
else{
bq2=false;
}
if(xq3.size()>1){
bq3=true;
}
else{
bq3=false;
}
if(xq4.size()>1){
bq4=true;
}
else{
bq4=false;
}
auto b1x=xq1.begin();
auto e1x=xq1.rbegin();
auto b1y=yq1.begin();
auto e1y=yq1.rbegin();
max1= (abs((*(e1x))-(*(b1x))))*(abs((*(e1y))-(*(b1y))));
auto b2x=xq2.begin();
auto e2x=xq2.rbegin();
auto b2y=yq2.begin();
auto e2y=yq2.rbegin();
max2= (abs((*(e2x))-(*(b2x))))*(abs((*(e2y))-(*(b2y))));
auto b3x=xq3.begin();
auto e3x=xq3.rbegin();
auto b3y=yq3.begin();
auto e3y=yq3.rbegin();
max3= (abs((*(e3x))-(*(b3x))))*(abs((*(e3y))-(*(b3y))));
auto b4x=xq4.begin();
auto e4x=xq4.rbegin();
auto b4y=yq4.begin();
auto e4y=yq4.rbegin();
max4= (abs((*(e4x))-(*(b4x))))*(abs((*(e4y))-(*(b4y))));
if(bq1==true)cout<<"Q1: "<<"("<<*b1x<<", "<<*b1y<<") ("<<*e1x<<", "<<*e1y<<") "<<max1<<endl;
if(bq2==true)cout<<"Q2: "<<"("<<*b2x<<", "<<*b2y<<") ("<<*e2x<<", "<<*e2y<<") "<<max2<<endl;
if(bq3==true)cout<<"Q3: "<<"("<<*b3x<<", "<<*b3y<<") ("<<*e3x<<", "<<*e3y<<") "<<max3<<endl;
if(bq4==true)cout<<"Q4: "<<"("<<*b4x<<", "<<*b4y<<") ("<<*e4x<<", "<<*e4y<<") "<<max4<<endl;
if(bq1==false&&bq2==false&&bq3==false&&bq4==false)cout<<"No point in any quadrant";
} | # 2071033, 2024-11-02 13:47:47, xxxx-xPPxP (30%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,x,y;
bool bq1,bq2,bq3,bq4;
set<int> xq1;
set<int> xq2;
set<int> xq3;
set<int> xq4;
set<int> yq1;
set<int> yq2;
set<int> yq3;
set<int> yq4;
cin>>n;
while(n--){
cin>>x>>y;
if(x>0&&y>0&&x!=0&&y!=0){xq1.insert(x); yq1.insert(y);}
if(x<0&&y>0&&x!=0&&y!=0){xq2.insert(x); yq2.insert(y);}
if(x<0&&y<0&&x!=0&&y!=0){xq3.insert(x); yq3.insert(y);}
if(x>0&&y<0&&x!=0&&y!=0){xq4.insert(x); yq4.insert(y);}
}
int max1=0,max2=0,max3=0,max4=0;
if(xq1.size()>1){
bq1=true;
}
else{
bq1=false;
}
if(xq2.size()>1){
bq2=true;
}
else{
bq2=false;
}
if(xq3.size()>1){
bq3=true;
}
else{
bq3=false;
}
if(xq4.size()>1){
bq4=true;
}
else{
bq4=false;
}
auto b1x=xq1.begin();
auto e1x=xq1.rbegin();
auto b1y=yq1.begin();
auto e1y=yq1.rbegin();
max1= (abs((*(e1x))-(*(b1x))))*(abs((*(e1y))-(*(b1y))));
auto b2x=xq2.begin();
auto e2x=xq2.rbegin();
auto b2y=yq2.begin();
auto e2y=yq2.rbegin();
max2= (abs((*(e2x))-(*(b2x))))*(abs((*(e2y))-(*(b2y))));
auto b3x=xq3.begin();
auto e3x=xq3.rbegin();
auto b3y=yq3.begin();
auto e3y=yq3.rbegin();
max3= (abs((*(e3x))-(*(b3x))))*(abs((*(e3y))-(*(b3y))));
auto b4x=xq4.begin();
auto e4x=xq4.rbegin();
auto b4y=yq4.begin();
auto e4y=yq4.rbegin();
max4= (abs((*(e4x))-(*(b4x))))*(abs((*(e4y))-(*(b4y))));
cout<<"Q1: "<<"("<<*b1x<<", "<<*b1y<<") ("<<*e1x<<", "<<*e1y<<") "<<max1<<endl;
cout<<"Q2: "<<"("<<*b2x<<", "<<*b2y<<") ("<<*e2x<<", "<<*e2y<<") "<<max2<<endl;
cout<<"Q3: "<<"("<<*b3x<<", "<<*b3y<<") ("<<*e3x<<", "<<*e3y<<") "<<max3<<endl;
cout<<"Q4: "<<"("<<*b4x<<", "<<*b4y<<") ("<<*e4x<<", "<<*e4y<<") "<<max4<<endl;
if(bq1==false&&bq2==false&&bq3==false&&bq4==false)cout<<"No point in any quadrant";
} | # 2071054, 2024-11-02 13:49:32, xxxx-xP-xP (20%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,x,y;
bool bq1,bq2,bq3,bq4;
set<int> xq1;
set<int> xq2;
set<int> xq3;
set<int> xq4;
set<int> yq1;
set<int> yq2;
set<int> yq3;
set<int> yq4;
cin>>n;
while(n--){
cin>>x>>y;
if(x>0&&y>0&&x!=0&&y!=0){xq1.insert(x); yq1.insert(y);}
if(x<0&&y>0&&x!=0&&y!=0){xq2.insert(x); yq2.insert(y);}
if(x<0&&y<0&&x!=0&&y!=0){xq3.insert(x); yq3.insert(y);}
if(x>0&&y<0&&x!=0&&y!=0){xq4.insert(x); yq4.insert(y);}
}
int max1=0,max2=0,max3=0,max4=0;
if(xq1.size()>1){
bq1=true;
}
else{
bq1=false;
}
if(xq2.size()>1){
bq2=true;
}
else{
bq2=false;
}
if(xq3.size()>1){
bq3=true;
}
else{
bq3=false;
}
if(xq4.size()>1){
bq4=true;
}
else{
bq4=false;
}
auto b1x=xq1.begin();
auto e1x=xq1.rbegin();
auto b1y=yq1.begin();
auto e1y=yq1.rbegin();
max1= (abs((*(e1x))-(*(b1x))))*(abs((*(e1y))-(*(b1y))));
auto b2x=xq2.begin();
auto e2x=xq2.rbegin();
auto b2y=yq2.begin();
auto e2y=yq2.rbegin();
max2= (abs((*(e2x))-(*(b2x))))*(abs((*(e2y))-(*(b2y))));
auto b3x=xq3.begin();
auto e3x=xq3.rbegin();
auto b3y=yq3.begin();
auto e3y=yq3.rbegin();
max3= (abs((*(e3x))-(*(b3x))))*(abs((*(e3y))-(*(b3y))));
auto b4x=xq4.begin();
auto e4x=xq4.rbegin();
auto b4y=yq4.begin();
auto e4y=yq4.rbegin();
max4= (abs((*(e4x))-(*(b4x))))*(abs((*(e4y))-(*(b4y))));
if(bq1==true)cout<<"Q1: "<<"("<<*b1x<<", "<<*b1y<<") ("<<*e1x<<", "<<*e1y<<") "<<max1<<endl;
if(bq2==true)cout<<"Q2: "<<"("<<*b2x<<", "<<*b2y<<") ("<<*e2x<<", "<<*e2y<<") "<<max2<<endl;
if(bq3==true)cout<<"Q3: "<<"("<<*b3x<<", "<<*b3y<<") ("<<*e3x<<", "<<*e3y<<") "<<max3<<endl;
if(bq4==true)cout<<"Q4: "<<"("<<*b4x<<", "<<*b4y<<") ("<<*e4x<<", "<<*e4y<<") "<<max4<<endl;
//if(bq1==false&&bq2==false&&bq3==false&&bq4==false)cout<<"No point in any quadrant";
} | # 2071063, 2024-11-02 13:50:09, xxxxPxPPxP (40%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,x,y;
bool bq1,bq2,bq3,bq4;
set<int> xq1;
set<int> xq2;
set<int> xq3;
set<int> xq4;
set<int> yq1;
set<int> yq2;
set<int> yq3;
set<int> yq4;
cin>>n;
while(n--){
cin>>x>>y;
if(x>0&&y>0&&x!=0&&y!=0){xq1.insert(x); yq1.insert(y);}
if(x<0&&y>0&&x!=0&&y!=0){xq2.insert(x); yq2.insert(y);}
if(x<0&&y<0&&x!=0&&y!=0){xq3.insert(x); yq3.insert(y);}
if(x>0&&y<0&&x!=0&&y!=0){xq4.insert(x); yq4.insert(y);}
}
int max1=0,max2=0,max3=0,max4=0;
if(xq1.size()>1){
bq1=true;
}
else{
bq1=false;
}
if(xq2.size()>1){
bq2=true;
}
else{
bq2=false;
}
if(xq3.size()>1){
bq3=true;
}
else{
bq3=false;
}
if(xq4.size()>1){
bq4=true;
}
else{
bq4=false;
}
auto b1x=xq1.begin();
auto e1x=xq1.rbegin();
auto b1y=yq1.begin();
auto e1y=yq1.rbegin();
max1= (abs((*(e1x))-(*(b1x))))*(abs((*(e1y))-(*(b1y))));
auto b2x=xq2.begin();
auto e2x=xq2.rbegin();
auto b2y=yq2.begin();
auto e2y=yq2.rbegin();
max2= (abs((*(e2x))-(*(b2x))))*(abs((*(e2y))-(*(b2y))));
auto b3x=xq3.begin();
auto e3x=xq3.rbegin();
auto b3y=yq3.begin();
auto e3y=yq3.rbegin();
max3= (abs((*(e3x))-(*(b3x))))*(abs((*(e3y))-(*(b3y))));
auto b4x=xq4.begin();
auto e4x=xq4.rbegin();
auto b4y=yq4.begin();
auto e4y=yq4.rbegin();
max4= (abs((*(e4x))-(*(b4x))))*(abs((*(e4y))-(*(b4y))));
cout<<"Q1: "<<"("<<*b1x<<", "<<*b1y<<") ("<<*e1x<<", "<<*e1y<<") "<<max1<<endl;
cout<<"Q2: "<<"("<<*b2x<<", "<<*b2y<<") ("<<*e2x<<", "<<*e2y<<") "<<max2<<endl;
cout<<"Q3: "<<"("<<*b3x<<", "<<*b3y<<") ("<<*e3x<<", "<<*e3y<<") "<<max3<<endl;
cout<<"Q4: "<<"("<<*b4x<<", "<<*b4y<<") ("<<*e4x<<", "<<*e4y<<") "<<max4<<endl;
//if(bq1==false&&bq2==false&&bq3==false&&bq4==false)cout<<"No point in any quadrant";
} | # 2071791, 2024-11-02 15:16:01, PPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,x,y;
bool bq1,bq2,bq3,bq4;
vector<int> xq1;
vector<int> xq2;
vector<int> xq3;
vector<int> xq4;
vector<int> yq1;
vector<int> yq2;
vector<int> yq3;
vector<int> yq4;
cin>>n;
while(n--){
cin>>x>>y;
if(x>0&&y>0&&x!=0&&y!=0){xq1.push_back(x); yq1.push_back(y);}
if(x<0&&y>0&&x!=0&&y!=0){xq2.push_back(x); yq2.push_back(y);}
if(x<0&&y<0&&x!=0&&y!=0){xq3.push_back(x); yq3.push_back(y);}
if(x>0&&y<0&&x!=0&&y!=0){xq4.push_back(x); yq4.push_back(y);}
}
int max1=0,max2=0,max3=0,max4=0;
if(xq1.size()>=1){
bq1=true;
}
else{
bq1=false;
}
if(xq2.size()>=1){
bq2=true;
}
else{
bq2=false;
}
if(xq3.size()>=1){
bq3=true;
}
else{
bq3=false;
}
if(xq4.size()>=1){
bq4=true;
}
else{
bq4=false;
}
sort(xq1.begin(),xq1.end());
sort(xq2.begin(),xq2.end());
sort(xq3.begin(),xq3.end());
sort(xq4.begin(),xq4.end());
sort(yq1.begin(),yq1.end());
sort(yq2.begin(),yq2.end());
sort(yq3.begin(),yq3.end());
sort(yq4.begin(),yq4.end());
int b1x,e1x,b1y,e1y,b2x,e2x,b2y,e2y,b3x,e3x,b3y,e3y,b4x,e4x,b4y,e4y;
if(bq1==true){
b1x=xq1[0];
e1x=xq1[xq1.size()-1];
b1y=yq1[0];
e1y=yq1[yq1.size()-1];
max1= abs((abs(e1x))-abs((b1x)))*abs((abs(e1y))-abs((b1y)));
}
if(bq2==true){
b2x=xq2[0];
e2x=xq2[xq2.size()-1];
b2y=yq2[0];
e2y=yq2[yq2.size()-1];
max2= abs((abs(e2x))-abs((b2x)))*abs((abs(e2y))-abs((b2y)));
}
if(bq3==true){
b3x=xq3[0];
e3x=xq3[xq3.size()-1];
b3y=yq3[0];
e3y=yq3[yq3.size()-1];
max3= abs((abs(e3x))-abs((b3x)))*abs((abs(e3y))-abs((b3y)));
}
if(bq4==true){
b4x=xq4[0];
e4x=xq4[xq4.size()-1];
b4y=yq4[0];
e4y=yq4[yq4.size()-1];
max4= abs((abs(e4x))-abs((b4x)))*abs((abs(e4y))-abs((b4y)));
}
if(bq1==true)cout<<"Q1: "<<"("<<b1x<<", "<<b1y<<") ("<<e1x<<", "<<e1y<<") "<<max1<<endl;
if(bq2==true)cout<<"Q2: "<<"("<<b2x<<", "<<b2y<<") ("<<e2x<<", "<<e2y<<") "<<max2<<endl;
if(bq3==true)cout<<"Q3: "<<"("<<b3x<<", "<<b3y<<") ("<<e3x<<", "<<e3y<<") "<<max3<<endl;
if(bq4==true)cout<<"Q4: "<<"("<<b4x<<", "<<b4y<<") ("<<e4x<<", "<<e4y<<") "<<max4<<endl;
if(bq1==false&&bq2==false&&bq3==false&&bq4==false)cout<<"No point in any quadrant";
} |
# 2071314, 2024-11-02 14:22:06, ---------- (0%)
#include<iostream>
#include<string>
#include<cmath>
#include<vector>
#include<tuple>
#include <algorithm>
#include <map>
#include <set>
using namespace std;
void haha(vector<set<pair<int,int>>> & map){
for(int i = 0 ; i < 4 ; i++){
if(map[i].size()!= 0){
int min = (*map[i].begin()).second , max = (*--map[i].end()).second;
for(auto j = ++map[i].begin() , en = map[i].end() ; j != en ; j++){
if(min > (*j).second)min = (*j).second;
if(max < (*j).second)max = (*j).second;
}
map[i].insert({ (*map[i].begin()).first , min} ) ;
map[i].insert({ (*--map[i].end()).first , max}) ;
}
}
}
int main(){
vector<set<pair<int,int>>> map = { {} , {} , {} , {}};
int num ;
cin>> num ;
int x , y ;
while(num--){
cin >> x >> y ;
if(x==0 || y==0)continue;
if(x>0 && y>0){map[0].insert({x,y});}
else if(x<0 && y>0){map[1].insert({x,y});}
else if(x<0 && y<0){map[2].insert({x,y});}
else if(x>0 && y<0){map[3].insert({x,y});}
}
cout << "yyyyyyy" << endl;
haha(map);
bool check = 0;
for(int i = 0 ; i < 4 ; i++){
if(map[i].size()!= 0){check = 1;
auto k = map[i].begin(); auto end = --map[i].end();
cout << "Q"<<i+1<<": ("<< (*k).first<<", "<< (*k).second<<") ";
cout <<"("<< (*end).first<<", " << (*end).second<<") ";
cout << ((*end).first - (*k).first) * ((*end).second - (*k).second) << endl;
}
}
if(check == 0)cout << "No point in any quadrant" << endl;
cout << "DOne" << endl;
return 0;
} | # 2071315, 2024-11-02 14:22:22, ---------- (0%)
#include<iostream>
#include<string>
#include<cmath>
#include<vector>
#include<tuple>
#include <algorithm>
#include <map>
#include <set>
using namespace std;
void haha(vector<set<pair<int,int>>> & map){
for(int i = 0 ; i < 4 ; i++){
if(map[i].size()!= 0){
int min = (*map[i].begin()).second , max = (*--map[i].end()).second;
for(auto j = ++map[i].begin() , en = map[i].end() ; j != en ; j++){
if(min > (*j).second)min = (*j).second;
if(max < (*j).second)max = (*j).second;
}
map[i].insert({ (*map[i].begin()).first , min} ) ;
map[i].insert({ (*--map[i].end()).first , max}) ;
}
}
}
int main(){
vector<set<pair<int,int>>> map = { {} , {} , {} , {}};
int num ;
cin>> num ;
int x , y ;
while(num--){
cin >> x >> y ;
if(x==0 || y==0)continue;
if(x>0 && y>0){map[0].insert({x,y});}
else if(x<0 && y>0){map[1].insert({x,y});}
else if(x<0 && y<0){map[2].insert({x,y});}
else if(x>0 && y<0){map[3].insert({x,y});}
}
cout << "yyyyyyy" << endl;
haha(map);
bool check = 0;
for(int i = 0 ; i < 4 ; i++){
if(map[i].size()!= 0){check = 1;
auto k = map[i].begin(); auto end = --map[i].end();
cout << "Q"<<i+1<<": ("<< (*k).first<<", "<< (*k).second<<") ";
cout <<"("<< (*end).first<<", " << (*end).second<<") ";
cout << ((*end).first - (*k).first) * ((*end).second - (*k).second) << endl;
}
}
if(check == 0)cout << "No point in any quadrant" << endl;
return 0;
} | # 2071318, 2024-11-02 14:22:32, P-P-PP--PP (60%)
#include<iostream>
#include<string>
#include<cmath>
#include<vector>
#include<tuple>
#include <algorithm>
#include <map>
#include <set>
using namespace std;
void haha(vector<set<pair<int,int>>> & map){
for(int i = 0 ; i < 4 ; i++){
if(map[i].size()!= 0){
int min = (*map[i].begin()).second , max = (*--map[i].end()).second;
for(auto j = ++map[i].begin() , en = map[i].end() ; j != en ; j++){
if(min > (*j).second)min = (*j).second;
if(max < (*j).second)max = (*j).second;
}
map[i].insert({ (*map[i].begin()).first , min} ) ;
map[i].insert({ (*--map[i].end()).first , max}) ;
}
}
}
int main(){
vector<set<pair<int,int>>> map = { {} , {} , {} , {}};
int num ;
cin>> num ;
int x , y ;
while(num--){
cin >> x >> y ;
if(x==0 || y==0)continue;
if(x>0 && y>0){map[0].insert({x,y});}
else if(x<0 && y>0){map[1].insert({x,y});}
else if(x<0 && y<0){map[2].insert({x,y});}
else if(x>0 && y<0){map[3].insert({x,y});}
}
haha(map);
bool check = 0;
for(int i = 0 ; i < 4 ; i++){
if(map[i].size()!= 0){check = 1;
auto k = map[i].begin(); auto end = --map[i].end();
cout << "Q"<<i+1<<": ("<< (*k).first<<", "<< (*k).second<<") ";
cout <<"("<< (*end).first<<", " << (*end).second<<") ";
cout << ((*end).first - (*k).first) * ((*end).second - (*k).second) << endl;
}
}
if(check == 0)cout << "No point in any quadrant" << endl;
return 0;
} | # 2071367, 2024-11-02 14:27:53, P-P-PP--PP (60%)
#include<iostream>
#include<string>
#include<cmath>
#include<vector>
#include<tuple>
#include <algorithm>
#include <map>
#include <set>
using namespace std;
void haha(vector<set<pair<int,int>>> & map){
for(int i = 0 ; i < 4 ; i++){
if(map[i].size()!= 0){
int min = (*map[i].begin()).second , max = (*--map[i].end()).second;
for(auto j = ++map[i].begin() , en = map[i].end() ; j != en ; j++){
if(min > (*j).second)min = (*j).second;
if(max < (*j).second)max = (*j).second;
}
map[i].insert({ (*map[i].begin()).first , min} ) ;
map[i].insert({ (*--map[i].end()).first , max}) ;
}
}
}
int main(){
vector<set<pair<int,int>>> map = { {} , {} , {} , {}};
int num ;
cin>> num ;
int x , y ;
while(num--){
cin >> x >> y ;
if(x==0 || y==0)continue;
if(x>0 && y>0){map[0].insert({x,y});}
else if(x<0 && y>0){map[1].insert({x,y});}
else if(x<0 && y<0){map[2].insert({x,y});}
else if(x>0 && y<0){map[3].insert({x,y});}
}
haha(map);
bool check = 0;
for(int i = 0 ; i < 4 ; i++){
if(map[i].size()!= 0){check = 1;
auto k = map[i].begin(); auto end = --map[i].end();
cout << "Q"<<i+1<<": ("<< (*k).first<<", "<< (*k).second<<") ";
cout <<"("<< (*end).first<<", " << (*end).second<<") ";
cout << ((*end).first - (*k).first) * ((*end).second - (*k).second) << endl;
}
}
if(check == 0)cout << "No point in any quadrant" << endl;
return 0;
} | # 2071382, 2024-11-02 14:29:38, P-P-PP--PP (60%)
#include<iostream>
#include<string>
#include<cmath>
#include<vector>
#include<tuple>
#include <algorithm>
#include <map>
#include <set>
using namespace std;
void haha(vector<set<pair<double,double>>> & map){
for(int i = 0 ; i < 4 ; i++){
if(map[i].size()!= 0){
double min = (*map[i].begin()).second , max = (*--map[i].end()).second;
for(auto j = ++map[i].begin() , en = map[i].end() ; j != en ; j++){
if(min > (*j).second)min = (*j).second;
if(max < (*j).second)max = (*j).second;
}
map[i].insert({ (*map[i].begin()).first , min} ) ;
map[i].insert({ (*--map[i].end()).first , max}) ;
}
}
}
int main(){
vector<set<pair<double,double>>> map = { {} , {} , {} , {}};
int num ;
cin>> num ;
double x , y ;
while(num--){
cin >> x >> y ;
if(x==0 || y==0)continue;
if(x>0 && y>0){map[0].insert({x,y});}
else if(x<0 && y>0){map[1].insert({x,y});}
else if(x<0 && y<0){map[2].insert({x,y});}
else if(x>0 && y<0){map[3].insert({x,y});}
}
haha(map);
bool check = 0;
for(int i = 0 ; i < 4 ; i++){
if(map[i].size()!= 0){check = 1;
auto k = map[i].begin(); auto end = --map[i].end();
cout << "Q"<<i+1<<": ("<< (*k).first<<", "<< (*k).second<<") ";
cout <<"("<< (*end).first<<", " << (*end).second<<") ";
cout << ((*end).first - (*k).first) * ((*end).second - (*k).second) << endl;
}
}
if(check == 0)cout << "No point in any quadrant" << endl;
return 0;
} | # 2071413, 2024-11-02 14:32:44, PP---P---- (30%)
#include<iostream>
#include<string>
#include<cmath>
#include<vector>
#include<tuple>
#include <algorithm>
#include <map>
#include <set>
using namespace std;
void haha(vector<set<pair<double,double>>> & map){
for(int i = 0 ; i < 4 ; i++){
if(map[i].size()!= 0){
double min = (*map[i].begin()).second , max = (*--map[i].end()).second;
for(auto j = map[i].begin() , en = map[i].end() ; j != en ; j++){
if(min > (*j).second)min = (*j).second;
if(max < (*j).second)max = (*j).second;
}
map[i].insert({ (*map[i].begin()).first , min} ) ;
map[i].insert({ (*--map[i].end()).first , max}) ;
}
}
}
int main(){
vector<set<pair<double,double>>> map = { {} , {} , {} , {}};
int num ;
cin>> num ;
double x , y ;
while(num--){
cin >> x >> y ;
if(x==0 || y==0)continue;
if(x>0 && y>0){map[0].insert({x,y});}
else if(x<0 && y>0){map[1].insert({x,y});}
else if(x<0 && y<0){map[2].insert({x,y});}
else if(x>0 && y<0){map[3].insert({x,y});}
}
haha(map);
bool check = 0;
for(int i = 0 ; i < 4 ; i++){
if(map[i].size()!= 0){check = 1;
auto k = map[i].begin(); auto end = --map[i].end();
cout << "Q"<<i+1<<": ("<< (*k).first<<", "<< (*k).second<<") ";
cout <<"("<< (*end).first<<", " << (*end).second<<") ";
cout << ((*end).first - (*k).first) * ((*end).second - (*k).second) ;
}
}
if(check == 0)cout << "No point in any quadrant" << endl;
return 0;
} | # 2071416, 2024-11-02 14:32:59, PPPPPPPPPP (100%)
#include<iostream>
#include<string>
#include<cmath>
#include<vector>
#include<tuple>
#include <algorithm>
#include <map>
#include <set>
using namespace std;
void haha(vector<set<pair<double,double>>> & map){
for(int i = 0 ; i < 4 ; i++){
if(map[i].size()!= 0){
double min = (*map[i].begin()).second , max = (*--map[i].end()).second;
for(auto j = map[i].begin() , en = map[i].end() ; j != en ; j++){
if(min > (*j).second)min = (*j).second;
if(max < (*j).second)max = (*j).second;
}
map[i].insert({ (*map[i].begin()).first , min} ) ;
map[i].insert({ (*--map[i].end()).first , max}) ;
}
}
}
int main(){
vector<set<pair<double,double>>> map = { {} , {} , {} , {}};
int num ;
cin>> num ;
double x , y ;
while(num--){
cin >> x >> y ;
if(x==0 || y==0)continue;
if(x>0 && y>0){map[0].insert({x,y});}
else if(x<0 && y>0){map[1].insert({x,y});}
else if(x<0 && y<0){map[2].insert({x,y});}
else if(x>0 && y<0){map[3].insert({x,y});}
}
haha(map);
bool check = 0;
for(int i = 0 ; i < 4 ; i++){
if(map[i].size()!= 0){check = 1;
auto k = map[i].begin(); auto end = --map[i].end();
cout << "Q"<<i+1<<": ("<< (*k).first<<", "<< (*k).second<<") ";
cout <<"("<< (*end).first<<", " << (*end).second<<") ";
cout << ((*end).first - (*k).first) * ((*end).second - (*k).second) <<endl;
}
}
if(check == 0)cout << "No point in any quadrant" << endl;
return 0;
} |
# 2071116, 2024-11-02 13:57:18, P----P---- (20%)
#include <bits/stdc++.h>
using namespace std;
int main () {
vector <int> q1x ;
vector <int> q1y ;
vector <int> q2x ;
vector <int> q2y ;
vector <int> q3x ;
vector <int> q3y ;
vector <int> q4x ;
vector <int> q4y ;
int num ,x ,y;
cin >> num ;
for ( int i = 0 ; i < num ; i++)
{
cin >> x >> y ;
if (x == 0 || y == 0 )
{
continue;
}
if ( x > 0 && y > 0)
{
q1x.emplace_back(x);
q1y.emplace_back(y);
}
if ( x < 0 && y > 0)
{
q2x.emplace_back(x);
q2y.emplace_back(y);
}
if ( x < 0 && y < 0)
{
q3x.emplace_back(x);
q3y.emplace_back(y);
}
if ( x > 0 && y < 0)
{
q4x.emplace_back(x);
q4y.emplace_back(y);
}
}
if (q1x.size() != 0)
{
int q1x_max ;
for (int i = 0 ;i < q1x.size() ;i++)
{
if (i == 0)
{
q1x_max = q1x[i] ;
continue;
}
if (q1x[i] > q1x_max)
{
q1x_max =q1x[i] ;
}
}
int q1x_min ;
for (int i = 0 ;i < q1x.size() ;i++)
{
if (i == 0)
{
q1x_min = q1x[i] ;
continue;
}
if (q1x[i] < q1x_min)
{
q1x_min =q1x[i] ;
}
}
int q1y_max ;
for (int i = 0 ;i < q1y.size() ;i++)
{
if (i == 0)
{
q1y_max = q1y[i] ;
continue;
}
if (q1y[i] > q1y_max)
{
q1y_max =q1y[i] ;
}
}
int q1y_min ;
for (int i = 0 ;i < q1y.size() ;i++)
{
if (i == 0)
{
q1y_min = q1y[i] ;
continue;
}
if (q1y[i] < q1y_min)
{
q1y_min =q1y[i] ;
}
}
cout << "Q1: ("<<q1x_min<<", "<<q1y_min<<") (" << q1x_max <<", " <<q1y_max << ") " << (q1x_max - q1x_min) * (q1y_max - q1y_min) << "\n";
}
if (q1x.size() == 0 && q2x.size() == 0 && q3x.size() == 0 && q4x.size() == 0)
{
cout <<"No point in any quadrant" ;
}
return 0 ;
} | # 2071161, 2024-11-02 14:02:46, Compilation error (0%)
#include <bits/stdc++.h>
using namespace std;
int main () {
vector <int> q1x ;
vector <int> q1y ;
vector <int> q2x ;
vector <int> q2y ;
vector <int> q3x ;
vector <int> q3y ;
vector <int> q4x ;
vector <int> q4y ;
int num ,x ,y;
cin >> num ;
for ( int i = 0 ; i < num ; i++)
{
cin >> x >> y ;
if (x == 0 || y == 0 )
{
continue;
}
if ( x > 0 && y > 0)
{
q1x.emplace_back(x);
q1y.emplace_back(y);
}
if ( x < 0 && y > 0)
{
q2x.emplace_back(x);
q2y.emplace_back(y);
}
if ( x < 0 && y < 0)
{
q3x.emplace_back(x);
q3y.emplace_back(y);
}
if ( x > 0 && y < 0)
{
q4x.emplace_back(x);
q4y.emplace_back(y);
}
}
if (q1x.size() != 0)
{
int q1x_max ;
for (int i = 0 ;i < q1x.size() ;i++)
{
if (i == 0)
{
q1x_max = q1x[i] ;
continue;
}
if (q1x[i] > q1x_max)
{
q1x_max =q1x[i] ;
}
}
int q1x_min ;
for (int i = 0 ;i < q1x.size() ;i++)
{
if (i == 0)
{
q1x_min = q1x[i] ;
continue;
}
if (q1x[i] < q1x_min)
{
q1x_min =q1x[i] ;
}
}
int q1y_max ;
for (int i = 0 ;i < q1y.size() ;i++)
{
if (i == 0)
{
q1y_max = q1y[i] ;
continue;
}
if (q1y[i] > q1y_max)
{
q1y_max =q1y[i] ;
}
}
int q1y_min ;
for (int i = 0 ;i < q1y.size() ;i++)
{
if (i == 0)
{
q1y_min = q1y[i] ;
continue;
}
if (q1y[i] < q1y_min)
{
q1y_min =q1y[i] ;
}
}
cout << "Q1: ("<<q1x_min<<", "<<q1y_min<<") (" << q1x_max <<", " <<q1y_max << ") " << (q1x_max - q1x_min) * (q1y_max - q1y_min) << "\n";
}
//q2
if (q2x.size() != 0)
{
int q2x_max ;
for (int i = 0 ;i < q2x.size() ;i++)
{
if (i == 0)
{
q2x_max = q2x[i] ;
continue;
}
if (q2x[i] > q2x_max)
{
q2x_max =q2x[i] ;
}
}
int q2x_min ;
for (int i = 0 ;i < q2x.size() ;i++)
{
if (i == 0)
{
q2x_min = q2x[i] ;
continue;
}
if (q2x[i] < q2x_min)
{
q1x_min =q1x[i] ;
}
}
int q2y_max ;
for (int i = 0 ;i < q2y.size() ;i++)
{
if (i == 0)
{
q2y_max = q2y[i] ;
continue;
}
if (q2y[i] > q2y_max)
{
q2y_max =q2y[i] ;
}
}
int q2y_min ;
for (int i = 0 ;i < q2y.size() ;i++)
{
if (i == 0)
{
q2y_min = q2y[i] ;
continue;
}
if (q2y[i] < q2y_min)
{
q2y_min =q2y[i] ;
}
}
cout << "Q2: ("<<q2x_min<<", "<<q2y_min<<") (" << q2x_max <<", " <<q2y_max << ") " << (q2x_max - q2x_min) * (q2y_max - q2y_min) << "\n";
}
if (q1x.size() == 0 && q2x.size() == 0 && q3x.size() == 0 && q4x.size() == 0)
{
cout <<"No point in any quadrant" ;
}
return 0 ;
} | # 2071165, 2024-11-02 14:03:12, Px-x-P--x- (20%)
#include <bits/stdc++.h>
using namespace std;
int main () {
vector <int> q1x ;
vector <int> q1y ;
vector <int> q2x ;
vector <int> q2y ;
vector <int> q3x ;
vector <int> q3y ;
vector <int> q4x ;
vector <int> q4y ;
int num ,x ,y;
cin >> num ;
for ( int i = 0 ; i < num ; i++)
{
cin >> x >> y ;
if (x == 0 || y == 0 )
{
continue;
}
if ( x > 0 && y > 0)
{
q1x.emplace_back(x);
q1y.emplace_back(y);
}
if ( x < 0 && y > 0)
{
q2x.emplace_back(x);
q2y.emplace_back(y);
}
if ( x < 0 && y < 0)
{
q3x.emplace_back(x);
q3y.emplace_back(y);
}
if ( x > 0 && y < 0)
{
q4x.emplace_back(x);
q4y.emplace_back(y);
}
}
if (q1x.size() != 0)
{
int q1x_max ;
for (int i = 0 ;i < q1x.size() ;i++)
{
if (i == 0)
{
q1x_max = q1x[i] ;
continue;
}
if (q1x[i] > q1x_max)
{
q1x_max =q1x[i] ;
}
}
int q1x_min ;
for (int i = 0 ;i < q1x.size() ;i++)
{
if (i == 0)
{
q1x_min = q1x[i] ;
continue;
}
if (q1x[i] < q1x_min)
{
q1x_min =q1x[i] ;
}
}
int q1y_max ;
for (int i = 0 ;i < q1y.size() ;i++)
{
if (i == 0)
{
q1y_max = q1y[i] ;
continue;
}
if (q1y[i] > q1y_max)
{
q1y_max =q1y[i] ;
}
}
int q1y_min ;
for (int i = 0 ;i < q1y.size() ;i++)
{
if (i == 0)
{
q1y_min = q1y[i] ;
continue;
}
if (q1y[i] < q1y_min)
{
q1y_min =q1y[i] ;
}
}
cout << "Q1: ("<<q1x_min<<", "<<q1y_min<<") (" << q1x_max <<", " <<q1y_max << ") " << (q1x_max - q1x_min) * (q1y_max - q1y_min) << "\n";
}
//q2
if (q2x.size() != 0)
{
int q2x_max ;
for (int i = 0 ;i < q2x.size() ;i++)
{
if (i == 0)
{
q2x_max = q2x[i] ;
continue;
}
if (q2x[i] > q2x_max)
{
q2x_max =q2x[i] ;
}
}
int q2x_min ;
for (int i = 0 ;i < q2x.size() ;i++)
{
if (i == 0)
{
q2x_min = q2x[i] ;
continue;
}
if (q2x[i] < q2x_min)
{
q2x_min =q1x[i] ;
}
}
int q2y_max ;
for (int i = 0 ;i < q2y.size() ;i++)
{
if (i == 0)
{
q2y_max = q2y[i] ;
continue;
}
if (q2y[i] > q2y_max)
{
q2y_max =q2y[i] ;
}
}
int q2y_min ;
for (int i = 0 ;i < q2y.size() ;i++)
{
if (i == 0)
{
q2y_min = q2y[i] ;
continue;
}
if (q2y[i] < q2y_min)
{
q2y_min =q2y[i] ;
}
}
cout << "Q2: ("<<q2x_min<<", "<<q2y_min<<") (" << q2x_max <<", " <<q2y_max << ") " << (q2x_max - q2x_min) * (q2y_max - q2y_min) << "\n";
}
if (q1x.size() == 0 && q2x.size() == 0 && q3x.size() == 0 && q4x.size() == 0)
{
cout <<"No point in any quadrant" ;
}
return 0 ;
} | # 2071213, 2024-11-02 14:08:12, PPP--P---- (40%)
#include <bits/stdc++.h>
using namespace std;
int main () {
vector <int> q1x ;
vector <int> q1y ;
vector <int> q2x ;
vector <int> q2y ;
vector <int> q3x ;
vector <int> q3y ;
vector <int> q4x ;
vector <int> q4y ;
int num ,x ,y;
cin >> num ;
for ( int i = 0 ; i < num ; i++)
{
cin >> x >> y ;
if (x == 0 || y == 0 )
{
continue;
}
if ( x > 0 && y > 0)
{
q1x.emplace_back(x);
q1y.emplace_back(y);
}
if ( x < 0 && y > 0)
{
q2x.emplace_back(x);
q2y.emplace_back(y);
}
if ( x < 0 && y < 0)
{
q3x.emplace_back(x);
q3y.emplace_back(y);
}
if ( x > 0 && y < 0)
{
q4x.emplace_back(x);
q4y.emplace_back(y);
}
}
if (q1x.size() != 0)
{
int q1x_max ;
for (int i = 0 ;i < q1x.size() ;i++)
{
if (i == 0)
{
q1x_max = q1x[i] ;
continue;
}
if (q1x[i] > q1x_max)
{
q1x_max =q1x[i] ;
}
}
int q1x_min ;
for (int i = 0 ;i < q1x.size() ;i++)
{
if (i == 0)
{
q1x_min = q1x[i] ;
continue;
}
if (q1x[i] < q1x_min)
{
q1x_min =q1x[i] ;
}
}
int q1y_max ;
for (int i = 0 ;i < q1y.size() ;i++)
{
if (i == 0)
{
q1y_max = q1y[i] ;
continue;
}
if (q1y[i] > q1y_max)
{
q1y_max =q1y[i] ;
}
}
int q1y_min ;
for (int i = 0 ;i < q1y.size() ;i++)
{
if (i == 0)
{
q1y_min = q1y[i] ;
continue;
}
if (q1y[i] < q1y_min)
{
q1y_min =q1y[i] ;
}
}
cout << "Q1: ("<<q1x_min<<", "<<q1y_min<<") (" << q1x_max <<", " <<q1y_max << ") " << (q1x_max - q1x_min) * (q1y_max - q1y_min) << "\n";
}
//q2
if (q2x.size() != 0)
{
int q2x_max ;
for (int i = 0 ;i < q2x.size() ;i++)
{
if (i == 0)
{
q2x_max = q2x[i] ;
continue;
}
if (q2x[i] > q2x_max)
{
q2x_max =q2x[i] ;
}
}
int q2x_min ;
for (int i = 0 ;i < q2x.size() ;i++)
{
if (i == 0)
{
q2x_min = q2x[i] ;
continue;
}
if (q2x[i] < q2x_min)
{
q2x_min =q2x[i] ;
}
}
int q2y_max ;
for (int i = 0 ;i < q2y.size() ;i++)
{
if (i == 0)
{
q2y_max = q2y[i] ;
continue;
}
if (q2y[i] > q2y_max)
{
q2y_max =q2y[i] ;
}
}
int q2y_min ;
for (int i = 0 ;i < q2y.size() ;i++)
{
if (i == 0)
{
q2y_min = q2y[i] ;
continue;
}
if (q2y[i] < q2y_min)
{
q2y_min =q2y[i] ;
}
}
cout << "Q2: ("<<q2x_min<<", "<<q2y_min<<") (" << q2x_max <<", " <<q2y_max << ") " << (q2x_max - q2x_min) * (q2y_max - q2y_min) << "\n";
}
if (q1x.size() == 0 && q2x.size() == 0 && q3x.size() == 0 && q4x.size() == 0)
{
cout <<"No point in any quadrant" ;
}
return 0 ;
} | # 2071242, 2024-11-02 14:12:28, PPPP-P---- (50%)
#include <bits/stdc++.h>
using namespace std;
int main () {
vector <int> q1x ;
vector <int> q1y ;
vector <int> q2x ;
vector <int> q2y ;
vector <int> q3x ;
vector <int> q3y ;
vector <int> q4x ;
vector <int> q4y ;
int num ,x ,y;
cin >> num ;
for ( int i = 0 ; i < num ; i++)
{
cin >> x >> y ;
if (x == 0 || y == 0 )
{
continue;
}
if ( x > 0 && y > 0)
{
q1x.emplace_back(x);
q1y.emplace_back(y);
}
if ( x < 0 && y > 0)
{
q2x.emplace_back(x);
q2y.emplace_back(y);
}
if ( x < 0 && y < 0)
{
q3x.emplace_back(x);
q3y.emplace_back(y);
}
if ( x > 0 && y < 0)
{
q4x.emplace_back(x);
q4y.emplace_back(y);
}
}
if (q1x.size() != 0)
{
int q1x_max ;
for (int i = 0 ;i < q1x.size() ;i++)
{
if (i == 0)
{
q1x_max = q1x[i] ;
continue;
}
if (q1x[i] > q1x_max)
{
q1x_max =q1x[i] ;
}
}
int q1x_min ;
for (int i = 0 ;i < q1x.size() ;i++)
{
if (i == 0)
{
q1x_min = q1x[i] ;
continue;
}
if (q1x[i] < q1x_min)
{
q1x_min =q1x[i] ;
}
}
int q1y_max ;
for (int i = 0 ;i < q1y.size() ;i++)
{
if (i == 0)
{
q1y_max = q1y[i] ;
continue;
}
if (q1y[i] > q1y_max)
{
q1y_max =q1y[i] ;
}
}
int q1y_min ;
for (int i = 0 ;i < q1y.size() ;i++)
{
if (i == 0)
{
q1y_min = q1y[i] ;
continue;
}
if (q1y[i] < q1y_min)
{
q1y_min =q1y[i] ;
}
}
cout << "Q1: ("<<q1x_min<<", "<<q1y_min<<") (" << q1x_max <<", " <<q1y_max << ") " << (q1x_max - q1x_min) * (q1y_max - q1y_min) << "\n";
}
//q2
if (q2x.size() != 0)
{
int q2x_max ;
for (int i = 0 ;i < q2x.size() ;i++)
{
if (i == 0)
{
q2x_max = q2x[i] ;
continue;
}
if (q2x[i] > q2x_max)
{
q2x_max =q2x[i] ;
}
}
int q2x_min ;
for (int i = 0 ;i < q2x.size() ;i++)
{
if (i == 0)
{
q2x_min = q2x[i] ;
continue;
}
if (q2x[i] < q2x_min)
{
q2x_min =q2x[i] ;
}
}
int q2y_max ;
for (int i = 0 ;i < q2y.size() ;i++)
{
if (i == 0)
{
q2y_max = q2y[i] ;
continue;
}
if (q2y[i] > q2y_max)
{
q2y_max =q2y[i] ;
}
}
int q2y_min ;
for (int i = 0 ;i < q2y.size() ;i++)
{
if (i == 0)
{
q2y_min = q2y[i] ;
continue;
}
if (q2y[i] < q2y_min)
{
q2y_min =q2y[i] ;
}
}
cout << "Q2: ("<<q2x_min<<", "<<q2y_min<<") (" << q2x_max <<", " <<q2y_max << ") " << (q2x_max - q2x_min) * (q2y_max - q2y_min) << "\n";
}
//q3
if (q3x.size() != 0)
{
int q3x_max ;
for (int i = 0 ;i < q3x.size() ;i++)
{
if (i == 0)
{
q3x_max = q3x[i] ;
continue;
}
if (q3x[i] > q3x_max)
{
q3x_max =q3x[i] ;
}
}
int q3x_min ;
for (int i = 0 ;i < q3x.size() ;i++)
{
if (i == 0)
{
q3x_min = q3x[i] ;
continue;
}
if (q3x[i] < q3x_min)
{
q3x_min =q3x[i] ;
}
}
int q3y_max ;
for (int i = 0 ;i < q3y.size() ;i++)
{
if (i == 0)
{
q3y_max = q3y[i] ;
continue;
}
if (q3y[i] > q3y_max)
{
q3y_max =q3y[i] ;
}
}
int q3y_min ;
for (int i = 0 ;i < q3y.size() ;i++)
{
if (i == 0)
{
q3y_min = q3y[i] ;
continue;
}
if (q3y[i] < q3y_min)
{
q3y_min =q3y[i] ;
}
}
cout << "Q3: ("<<q3x_min<<", "<<q3y_min<<") (" << q3x_max <<", " <<q3y_max << ") " << (q3x_max - q3x_min) * (q3y_max - q3y_min) << "\n";
}
if (q1x.size() == 0 && q2x.size() == 0 && q3x.size() == 0 && q4x.size() == 0)
{
cout <<"No point in any quadrant" ;
}
return 0 ;
} | # 2071272, 2024-11-02 14:16:29, PPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std;
int main () {
vector <int> q1x ;
vector <int> q1y ;
vector <int> q2x ;
vector <int> q2y ;
vector <int> q3x ;
vector <int> q3y ;
vector <int> q4x ;
vector <int> q4y ;
int num ,x ,y;
cin >> num ;
for ( int i = 0 ; i < num ; i++)
{
cin >> x >> y ;
if (x == 0 || y == 0 )
{
continue;
}
if ( x > 0 && y > 0)
{
q1x.emplace_back(x);
q1y.emplace_back(y);
}
if ( x < 0 && y > 0)
{
q2x.emplace_back(x);
q2y.emplace_back(y);
}
if ( x < 0 && y < 0)
{
q3x.emplace_back(x);
q3y.emplace_back(y);
}
if ( x > 0 && y < 0)
{
q4x.emplace_back(x);
q4y.emplace_back(y);
}
}
if (q1x.size() != 0)
{
int q1x_max ;
for (int i = 0 ;i < q1x.size() ;i++)
{
if (i == 0)
{
q1x_max = q1x[i] ;
continue;
}
if (q1x[i] > q1x_max)
{
q1x_max =q1x[i] ;
}
}
int q1x_min ;
for (int i = 0 ;i < q1x.size() ;i++)
{
if (i == 0)
{
q1x_min = q1x[i] ;
continue;
}
if (q1x[i] < q1x_min)
{
q1x_min =q1x[i] ;
}
}
int q1y_max ;
for (int i = 0 ;i < q1y.size() ;i++)
{
if (i == 0)
{
q1y_max = q1y[i] ;
continue;
}
if (q1y[i] > q1y_max)
{
q1y_max =q1y[i] ;
}
}
int q1y_min ;
for (int i = 0 ;i < q1y.size() ;i++)
{
if (i == 0)
{
q1y_min = q1y[i] ;
continue;
}
if (q1y[i] < q1y_min)
{
q1y_min =q1y[i] ;
}
}
cout << "Q1: ("<<q1x_min<<", "<<q1y_min<<") (" << q1x_max <<", " <<q1y_max << ") " << (q1x_max - q1x_min) * (q1y_max - q1y_min) << "\n";
}
//q2
if (q2x.size() != 0)
{
int q2x_max ;
for (int i = 0 ;i < q2x.size() ;i++)
{
if (i == 0)
{
q2x_max = q2x[i] ;
continue;
}
if (q2x[i] > q2x_max)
{
q2x_max =q2x[i] ;
}
}
int q2x_min ;
for (int i = 0 ;i < q2x.size() ;i++)
{
if (i == 0)
{
q2x_min = q2x[i] ;
continue;
}
if (q2x[i] < q2x_min)
{
q2x_min =q2x[i] ;
}
}
int q2y_max ;
for (int i = 0 ;i < q2y.size() ;i++)
{
if (i == 0)
{
q2y_max = q2y[i] ;
continue;
}
if (q2y[i] > q2y_max)
{
q2y_max =q2y[i] ;
}
}
int q2y_min ;
for (int i = 0 ;i < q2y.size() ;i++)
{
if (i == 0)
{
q2y_min = q2y[i] ;
continue;
}
if (q2y[i] < q2y_min)
{
q2y_min =q2y[i] ;
}
}
cout << "Q2: ("<<q2x_min<<", "<<q2y_min<<") (" << q2x_max <<", " <<q2y_max << ") " << (q2x_max - q2x_min) * (q2y_max - q2y_min) << "\n";
}
//q3
if (q3x.size() != 0)
{
int q3x_max ;
for (int i = 0 ;i < q3x.size() ;i++)
{
if (i == 0)
{
q3x_max = q3x[i] ;
continue;
}
if (q3x[i] > q3x_max)
{
q3x_max =q3x[i] ;
}
}
int q3x_min ;
for (int i = 0 ;i < q3x.size() ;i++)
{
if (i == 0)
{
q3x_min = q3x[i] ;
continue;
}
if (q3x[i] < q3x_min)
{
q3x_min =q3x[i] ;
}
}
int q3y_max ;
for (int i = 0 ;i < q3y.size() ;i++)
{
if (i == 0)
{
q3y_max = q3y[i] ;
continue;
}
if (q3y[i] > q3y_max)
{
q3y_max =q3y[i] ;
}
}
int q3y_min ;
for (int i = 0 ;i < q3y.size() ;i++)
{
if (i == 0)
{
q3y_min = q3y[i] ;
continue;
}
if (q3y[i] < q3y_min)
{
q3y_min =q3y[i] ;
}
}
cout << "Q3: ("<<q3x_min<<", "<<q3y_min<<") (" << q3x_max <<", " <<q3y_max << ") " << (q3x_max - q3x_min) * (q3y_max - q3y_min) << "\n";
}
//q4
if (q4x.size() != 0)
{
int q4x_max ;
for (int i = 0 ;i < q4x.size() ;i++)
{
if (i == 0)
{
q4x_max = q4x[i] ;
continue;
}
if (q4x[i] > q4x_max)
{
q4x_max =q4x[i] ;
}
}
int q4x_min ;
for (int i = 0 ;i < q4x.size() ;i++)
{
if (i == 0)
{
q4x_min = q4x[i] ;
continue;
}
if (q4x[i] < q4x_min)
{
q4x_min =q4x[i] ;
}
}
int q4y_max ;
for (int i = 0 ;i < q4y.size() ;i++)
{
if (i == 0)
{
q4y_max = q4y[i] ;
continue;
}
if (q4y[i] > q4y_max)
{
q4y_max =q4y[i] ;
}
}
int q4y_min ;
for (int i = 0 ;i < q4y.size() ;i++)
{
if (i == 0)
{
q4y_min = q4y[i] ;
continue;
}
if (q4y[i] < q4y_min)
{
q4y_min =q4y[i] ;
}
}
cout << "Q4: ("<<q4x_min<<", "<<q4y_min<<") (" << q4x_max <<", " <<q4y_max << ") " << (q4x_max - q4x_min) * (q4y_max - q4y_min) << "\n";
}
if (q1x.size() == 0 && q2x.size() == 0 && q3x.size() == 0 && q4x.size() == 0)
{
cout <<"No point in any quadrant" ;
}
return 0 ;
} |
# 2071500, 2024-11-02 14:42:36, -x-x----x- (0%)
#include <iostream>
#include <vector>
using namespace std;
int main() {
int N;
cin >> N;
vector<pair<int, int>> q1,q2,q3,q4;
int x,y;
for(int i=0; i<N; i++) {
cin >> x >> y;
if(x>0 && y>0) {
q1.push_back(make_pair(x,y));
}else if(x<0 && y>0) {
q2.push_back(make_pair(x,y));
}else if(x<0 && y<0) {
q3.push_back(make_pair(x,y));
}else if(x>0 && y<0) {
q4.push_back(make_pair(x,y));
}
}
int q1xmax,q1ymax,q2xmax,q2ymax,q3xmax,q3ymax,q4xmax,q4ymax;
if(q1.size()!=0) {
q1xmax=q1[0].first;
q1ymax=q1[0].second;
}
if(q2.size()!=0) {
q2xmax=q2[0].first;
q2ymax=q2[0].second;
}
if(q3.size()!=0) {
q3xmax=q3[0].first;
q3ymax=q3[0].second;
}
if(q4.size()!=0) {
q4xmax=q4[0].first;
q4ymax=q4[0].second;
}
for(int i=1; i<q1.size(); i++) {
if(q1[i].first>q1xmax) q1xmax=q1[i].first;
}
for(int i=1; i<q1.size(); i++) {
if(q1[i].second>q1ymax) q1ymax=q1[i].second;
}
for(int i=1; i<q2.size(); i++) {
if(q2[i].first>q2xmax) q2xmax=q2[i].first;
}
for(int i=1; i<q2.size(); i++) {
if(q2[i].second>q2ymax) q2ymax=q2[i].second;
}
for(int i=1; i<q3.size(); i++) {
if(q3[i].first>q3xmax) q3xmax=q3[i].first;
}
for(int i=1; i<q3.size(); i++) {
if(q3[i].second>q3ymax) q3ymax=q3[i].second;
}
for(int i=1; i<q4.size(); i++) {
if(q4[i].first>q4xmax) q4xmax=q4[i].first;
}
for(int i=1; i<q4.size(); i++) {
if(q4[i].second>q4ymax) q4ymax=q4[i].second;
}
int q1xmin,q1ymin,q2xmin,q2ymin,q3xmin,q3ymin,q4xmin,q4ymin;
if(q1.size()!=0) {
q1xmin=q1[0].first;
q1ymin=q1[0].second;
}
if(q2.size()!=0) {
q2xmin=q1[0].first;
q2ymin=q1[0].second;
}
if(q3.size()!=0) {
q3xmin=q1[0].first;
q3ymin=q1[0].second;
}
if(q4.size()!=0) {
q4xmin=q1[0].first;
q4ymin=q1[0].second;
}
for(int i=1; i<q1.size(); i++) {
if(q1[i].first<q1xmin) q1xmin=q1[i].first;
}
for(int i=1; i<q1.size(); i++) {
if(q1[i].second<q1ymin) q1ymin=q1[i].second;
}
for(int i=1; i<q2.size(); i++) {
if(q2[i].first<q2xmin) q2xmin=q2[i].first;
}
for(int i=1; i<q2.size(); i++) {
if(q2[i].second<q2ymin) q2ymin=q2[i].second;
}
for(int i=1; i<q3.size(); i++) {
if(q3[i].first<q3xmin) q3xmin=q3[i].first;
}
for(int i=1; i<q3.size(); i++) {
if(q3[i].second<q3ymin) q3ymin=q3[i].second;
}
for(int i=1; i<q4.size(); i++) {
if(q4[i].first<q4xmin) q4xmin=q4[i].first;
}
for(int i=1; i<q4.size(); i++) {
if(q4[i].second<q4ymin) q4ymin=q4[i].second;
}
int q1size, q2size, q3size, q4size;
q1size = (q1xmax-q1xmin) * (q1ymax-q1ymin);
q2size = (q2xmax-q2xmin) * (q2ymax-q2ymin);
q3size = (q3xmax-q3xmin) * (q3ymax-q3ymin);
q4size = (q4xmax-q4xmin) * (q4ymax-q4ymin);
cout << "Q1: (" << q1xmin << ", " << q1ymin << ") (" << q1xmax << "," << q1ymax << ") " << q1size << endl;
cout << "Q2: (" << q2xmin << ", " << q2ymin << ") (" << q2xmax << "," << q2ymax << ") " << q2size << endl;
cout << "Q3: (" << q3xmin << ", " << q3ymin << ") (" << q3xmax << "," << q3ymax << ") " << q3size << endl;
cout << "Q4: (" << q4xmin << ", " << q4ymin << ") (" << q4xmax << "," << q4ymax << ") " << q4size << endl;
} | # 2071540, 2024-11-02 14:46:54, ---------- (0%)
#include <iostream>
#include <vector>
using namespace std;
int main() {
int N;
cin >> N;
vector<pair<int, int>> q1,q2,q3,q4;
int x,y;
for(int i=0; i<N; i++) {
cin >> x >> y;
if(x>0 && y>0) {
q1.push_back(make_pair(x,y));
}else if(x<0 && y>0) {
q2.push_back(make_pair(x,y));
}else if(x<0 && y<0) {
q3.push_back(make_pair(x,y));
}else if(x>0 && y<0) {
q4.push_back(make_pair(x,y));
}
}
int q1xmax,q1ymax,q2xmax,q2ymax,q3xmax,q3ymax,q4xmax,q4ymax;
if(q1.size()!=0) {
q1xmax=q1[0].first;
q1ymax=q1[0].second;
}
if(q2.size()!=0) {
q2xmax=q2[0].first;
q2ymax=q2[0].second;
}
if(q3.size()!=0) {
q3xmax=q3[0].first;
q3ymax=q3[0].second;
}
if(q4.size()!=0) {
q4xmax=q4[0].first;
q4ymax=q4[0].second;
}
for(int i=1; i<q1.size(); i++) {
if(q1[i].first>q1xmax) q1xmax=q1[i].first;
}
for(int i=1; i<q1.size(); i++) {
if(q1[i].second>q1ymax) q1ymax=q1[i].second;
}
for(int i=1; i<q2.size(); i++) {
if(q2[i].first>q2xmax) q2xmax=q2[i].first;
}
for(int i=1; i<q2.size(); i++) {
if(q2[i].second>q2ymax) q2ymax=q2[i].second;
}
for(int i=1; i<q3.size(); i++) {
if(q3[i].first>q3xmax) q3xmax=q3[i].first;
}
for(int i=1; i<q3.size(); i++) {
if(q3[i].second>q3ymax) q3ymax=q3[i].second;
}
for(int i=1; i<q4.size(); i++) {
if(q4[i].first>q4xmax) q4xmax=q4[i].first;
}
for(int i=1; i<q4.size(); i++) {
if(q4[i].second>q4ymax) q4ymax=q4[i].second;
}
int q1xmin,q1ymin,q2xmin,q2ymin,q3xmin,q3ymin,q4xmin,q4ymin;
if(q1.size()!=0) {
q1xmin=q1[0].first;
q1ymin=q1[0].second;
}
if(q2.size()!=0) {
q2xmin=q2[0].first;
q2ymin=q2[0].second;
}
if(q3.size()!=0) {
q3xmin=q3[0].first;
q3ymin=q3[0].second;
}
if(q4.size()!=0) {
q4xmin=q4[0].first;
q4ymin=q4[0].second;
}
for(int i=1; i<q1.size(); i++) {
if(q1[i].first<q1xmin) q1xmin=q1[i].first;
}
for(int i=1; i<q1.size(); i++) {
if(q1[i].second<q1ymin) q1ymin=q1[i].second;
}
for(int i=1; i<q2.size(); i++) {
if(q2[i].first<q2xmin) q2xmin=q2[i].first;
}
for(int i=1; i<q2.size(); i++) {
if(q2[i].second<q2ymin) q2ymin=q2[i].second;
}
for(int i=1; i<q3.size(); i++) {
if(q3[i].first<q3xmin) q3xmin=q3[i].first;
}
for(int i=1; i<q3.size(); i++) {
if(q3[i].second<q3ymin) q3ymin=q3[i].second;
}
for(int i=1; i<q4.size(); i++) {
if(q4[i].first<q4xmin) q4xmin=q4[i].first;
}
for(int i=1; i<q4.size(); i++) {
if(q4[i].second<q4ymin) q4ymin=q4[i].second;
}
int q1size, q2size, q3size, q4size;
q1size = (q1xmax-q1xmin) * (q1ymax-q1ymin);
q2size = (q2xmax-q2xmin) * (q2ymax-q2ymin);
q3size = (q3xmax-q3xmin) * (q3ymax-q3ymin);
q4size = (q4xmax-q4xmin) * (q4ymax-q4ymin);
cout << "Q1: (" << q1xmin << ", " << q1ymin << ") (" << q1xmax << "," << q1ymax << ") " << q1size << endl;
cout << "Q2: (" << q2xmin << ", " << q2ymin << ") (" << q2xmax << "," << q2ymax << ") " << q2size << endl;
cout << "Q3: (" << q3xmin << ", " << q3ymin << ") (" << q3xmax << "," << q3ymax << ") " << q3size << endl;
cout << "Q4: (" << q4xmin << ", " << q4ymin << ") (" << q4xmax << "," << q4ymax << ") " << q4size << endl;
} | # 2071557, 2024-11-02 14:48:33, PPPPP-PPPP (90%)
#include <iostream>
#include <vector>
using namespace std;
int main() {
int N;
cin >> N;
vector<pair<int, int>> q1,q2,q3,q4;
int x,y;
for(int i=0; i<N; i++) {
cin >> x >> y;
if(x>0 && y>0) {
q1.push_back(make_pair(x,y));
}else if(x<0 && y>0) {
q2.push_back(make_pair(x,y));
}else if(x<0 && y<0) {
q3.push_back(make_pair(x,y));
}else if(x>0 && y<0) {
q4.push_back(make_pair(x,y));
}
}
int q1xmax,q1ymax,q2xmax,q2ymax,q3xmax,q3ymax,q4xmax,q4ymax;
if(q1.size()!=0) {
q1xmax=q1[0].first;
q1ymax=q1[0].second;
}
if(q2.size()!=0) {
q2xmax=q2[0].first;
q2ymax=q2[0].second;
}
if(q3.size()!=0) {
q3xmax=q3[0].first;
q3ymax=q3[0].second;
}
if(q4.size()!=0) {
q4xmax=q4[0].first;
q4ymax=q4[0].second;
}
for(int i=1; i<q1.size(); i++) {
if(q1[i].first>q1xmax) q1xmax=q1[i].first;
}
for(int i=1; i<q1.size(); i++) {
if(q1[i].second>q1ymax) q1ymax=q1[i].second;
}
for(int i=1; i<q2.size(); i++) {
if(q2[i].first>q2xmax) q2xmax=q2[i].first;
}
for(int i=1; i<q2.size(); i++) {
if(q2[i].second>q2ymax) q2ymax=q2[i].second;
}
for(int i=1; i<q3.size(); i++) {
if(q3[i].first>q3xmax) q3xmax=q3[i].first;
}
for(int i=1; i<q3.size(); i++) {
if(q3[i].second>q3ymax) q3ymax=q3[i].second;
}
for(int i=1; i<q4.size(); i++) {
if(q4[i].first>q4xmax) q4xmax=q4[i].first;
}
for(int i=1; i<q4.size(); i++) {
if(q4[i].second>q4ymax) q4ymax=q4[i].second;
}
int q1xmin,q1ymin,q2xmin,q2ymin,q3xmin,q3ymin,q4xmin,q4ymin;
if(q1.size()!=0) {
q1xmin=q1[0].first;
q1ymin=q1[0].second;
}
if(q2.size()!=0) {
q2xmin=q2[0].first;
q2ymin=q2[0].second;
}
if(q3.size()!=0) {
q3xmin=q3[0].first;
q3ymin=q3[0].second;
}
if(q4.size()!=0) {
q4xmin=q4[0].first;
q4ymin=q4[0].second;
}
for(int i=1; i<q1.size(); i++) {
if(q1[i].first<q1xmin) q1xmin=q1[i].first;
}
for(int i=1; i<q1.size(); i++) {
if(q1[i].second<q1ymin) q1ymin=q1[i].second;
}
for(int i=1; i<q2.size(); i++) {
if(q2[i].first<q2xmin) q2xmin=q2[i].first;
}
for(int i=1; i<q2.size(); i++) {
if(q2[i].second<q2ymin) q2ymin=q2[i].second;
}
for(int i=1; i<q3.size(); i++) {
if(q3[i].first<q3xmin) q3xmin=q3[i].first;
}
for(int i=1; i<q3.size(); i++) {
if(q3[i].second<q3ymin) q3ymin=q3[i].second;
}
for(int i=1; i<q4.size(); i++) {
if(q4[i].first<q4xmin) q4xmin=q4[i].first;
}
for(int i=1; i<q4.size(); i++) {
if(q4[i].second<q4ymin) q4ymin=q4[i].second;
}
int q1size, q2size, q3size, q4size;
q1size = (q1xmax-q1xmin) * (q1ymax-q1ymin);
q2size = (q2xmax-q2xmin) * (q2ymax-q2ymin);
q3size = (q3xmax-q3xmin) * (q3ymax-q3ymin);
q4size = (q4xmax-q4xmin) * (q4ymax-q4ymin);
if(q1.size()!=0) cout << "Q1: (" << q1xmin << ", " << q1ymin << ") (" << q1xmax << ", " << q1ymax << ") " << q1size << endl;
if(q2.size()!=0) cout << "Q2: (" << q2xmin << ", " << q2ymin << ") (" << q2xmax << ", " << q2ymax << ") " << q2size << endl;
if(q3.size()!=0) cout << "Q3: (" << q3xmin << ", " << q3ymin << ") (" << q3xmax << ", " << q3ymax << ") " << q3size << endl;
if(q4.size()!=0) cout << "Q4: (" << q4xmin << ", " << q4ymin << ") (" << q4xmax << ", " << q4ymax << ") " << q4size << endl;
} | # 2071574, 2024-11-02 14:50:22, PPPP----P- (50%)
#include <iostream>
#include <vector>
using namespace std;
int main() {
int N;
cin >> N;
vector<pair<int, int>> q1,q2,q3,q4;
int x,y;
for(int i=0; i<N; i++) {
cin >> x >> y;
if(x>0 && y>0) {
q1.push_back(make_pair(x,y));
}else if(x<0 && y>0) {
q2.push_back(make_pair(x,y));
}else if(x<0 && y<0) {
q3.push_back(make_pair(x,y));
}else if(x>0 && y<0) {
q4.push_back(make_pair(x,y));
}
}
int q1xmax,q1ymax,q2xmax,q2ymax,q3xmax,q3ymax,q4xmax,q4ymax;
if(q1.size()!=0) {
q1xmax=q1[0].first;
q1ymax=q1[0].second;
}
if(q2.size()!=0) {
q2xmax=q2[0].first;
q2ymax=q2[0].second;
}
if(q3.size()!=0) {
q3xmax=q3[0].first;
q3ymax=q3[0].second;
}
if(q4.size()!=0) {
q4xmax=q4[0].first;
q4ymax=q4[0].second;
}
for(int i=1; i<q1.size(); i++) {
if(q1[i].first>q1xmax) q1xmax=q1[i].first;
}
for(int i=1; i<q1.size(); i++) {
if(q1[i].second>q1ymax) q1ymax=q1[i].second;
}
for(int i=1; i<q2.size(); i++) {
if(q2[i].first>q2xmax) q2xmax=q2[i].first;
}
for(int i=1; i<q2.size(); i++) {
if(q2[i].second>q2ymax) q2ymax=q2[i].second;
}
for(int i=1; i<q3.size(); i++) {
if(q3[i].first>q3xmax) q3xmax=q3[i].first;
}
for(int i=1; i<q3.size(); i++) {
if(q3[i].second>q3ymax) q3ymax=q3[i].second;
}
for(int i=1; i<q4.size(); i++) {
if(q4[i].first>q4xmax) q4xmax=q4[i].first;
}
for(int i=1; i<q4.size(); i++) {
if(q4[i].second>q4ymax) q4ymax=q4[i].second;
}
int q1xmin,q1ymin,q2xmin,q2ymin,q3xmin,q3ymin,q4xmin,q4ymin;
if(q1.size()!=0) {
q1xmin=q1[0].first;
q1ymin=q1[0].second;
}
if(q2.size()!=0) {
q2xmin=q2[0].first;
q2ymin=q2[0].second;
}
if(q3.size()!=0) {
q3xmin=q3[0].first;
q3ymin=q3[0].second;
}
if(q4.size()!=0) {
q4xmin=q4[0].first;
q4ymin=q4[0].second;
}
for(int i=1; i<q1.size(); i++) {
if(q1[i].first<q1xmin) q1xmin=q1[i].first;
}
for(int i=1; i<q1.size(); i++) {
if(q1[i].second<q1ymin) q1ymin=q1[i].second;
}
for(int i=1; i<q2.size(); i++) {
if(q2[i].first<q2xmin) q2xmin=q2[i].first;
}
for(int i=1; i<q2.size(); i++) {
if(q2[i].second<q2ymin) q2ymin=q2[i].second;
}
for(int i=1; i<q3.size(); i++) {
if(q3[i].first<q3xmin) q3xmin=q3[i].first;
}
for(int i=1; i<q3.size(); i++) {
if(q3[i].second<q3ymin) q3ymin=q3[i].second;
}
for(int i=1; i<q4.size(); i++) {
if(q4[i].first<q4xmin) q4xmin=q4[i].first;
}
for(int i=1; i<q4.size(); i++) {
if(q4[i].second<q4ymin) q4ymin=q4[i].second;
}
int q1size, q2size, q3size, q4size;
q1size = (q1xmax-q1xmin) * (q1ymax-q1ymin);
q2size = (q2xmax-q2xmin) * (q2ymax-q2ymin);
q3size = (q3xmax-q3xmin) * (q3ymax-q3ymin);
q4size = (q4xmax-q4xmin) * (q4ymax-q4ymin);
if(q1.size()!=0) cout << "Q1: (" << q1xmin << ", " << q1ymin << ") (" << q1xmax << ", " << q1ymax << ") " << q1size << endl;
if(q2.size()!=0) cout << "Q2: (" << q2xmin << ", " << q2ymin << ") (" << q2xmax << ", " << q2ymax << ") " << q2size << endl;
if(q3.size()!=0) cout << "Q3: (" << q3xmin << ", " << q3ymin << ") (" << q3xmax << ", " << q3ymax << ") " << q3size << endl;
if(q4.size()!=0) cout << "Q4: (" << q4xmin << ", " << q4ymin << ") (" << q4xmax << ", " << q4ymax << ") " << q4size << endl;
if(q1.size()!=0 && q2.size()!=0 && q3.size()!=0 && q4.size()!=0) cout << "No point in any quadrant";
} | # 2071581, 2024-11-02 14:50:56, PPPPP-PPPP (90%)
#include <iostream>
#include <vector>
using namespace std;
int main() {
int N;
cin >> N;
vector<pair<int, int>> q1,q2,q3,q4;
int x,y;
for(int i=0; i<N; i++) {
cin >> x >> y;
if(x>0 && y>0) {
q1.push_back(make_pair(x,y));
}else if(x<0 && y>0) {
q2.push_back(make_pair(x,y));
}else if(x<0 && y<0) {
q3.push_back(make_pair(x,y));
}else if(x>0 && y<0) {
q4.push_back(make_pair(x,y));
}
}
int q1xmax,q1ymax,q2xmax,q2ymax,q3xmax,q3ymax,q4xmax,q4ymax;
if(q1.size()!=0) {
q1xmax=q1[0].first;
q1ymax=q1[0].second;
}
if(q2.size()!=0) {
q2xmax=q2[0].first;
q2ymax=q2[0].second;
}
if(q3.size()!=0) {
q3xmax=q3[0].first;
q3ymax=q3[0].second;
}
if(q4.size()!=0) {
q4xmax=q4[0].first;
q4ymax=q4[0].second;
}
for(int i=1; i<q1.size(); i++) {
if(q1[i].first>q1xmax) q1xmax=q1[i].first;
}
for(int i=1; i<q1.size(); i++) {
if(q1[i].second>q1ymax) q1ymax=q1[i].second;
}
for(int i=1; i<q2.size(); i++) {
if(q2[i].first>q2xmax) q2xmax=q2[i].first;
}
for(int i=1; i<q2.size(); i++) {
if(q2[i].second>q2ymax) q2ymax=q2[i].second;
}
for(int i=1; i<q3.size(); i++) {
if(q3[i].first>q3xmax) q3xmax=q3[i].first;
}
for(int i=1; i<q3.size(); i++) {
if(q3[i].second>q3ymax) q3ymax=q3[i].second;
}
for(int i=1; i<q4.size(); i++) {
if(q4[i].first>q4xmax) q4xmax=q4[i].first;
}
for(int i=1; i<q4.size(); i++) {
if(q4[i].second>q4ymax) q4ymax=q4[i].second;
}
int q1xmin,q1ymin,q2xmin,q2ymin,q3xmin,q3ymin,q4xmin,q4ymin;
if(q1.size()!=0) {
q1xmin=q1[0].first;
q1ymin=q1[0].second;
}
if(q2.size()!=0) {
q2xmin=q2[0].first;
q2ymin=q2[0].second;
}
if(q3.size()!=0) {
q3xmin=q3[0].first;
q3ymin=q3[0].second;
}
if(q4.size()!=0) {
q4xmin=q4[0].first;
q4ymin=q4[0].second;
}
for(int i=1; i<q1.size(); i++) {
if(q1[i].first<q1xmin) q1xmin=q1[i].first;
}
for(int i=1; i<q1.size(); i++) {
if(q1[i].second<q1ymin) q1ymin=q1[i].second;
}
for(int i=1; i<q2.size(); i++) {
if(q2[i].first<q2xmin) q2xmin=q2[i].first;
}
for(int i=1; i<q2.size(); i++) {
if(q2[i].second<q2ymin) q2ymin=q2[i].second;
}
for(int i=1; i<q3.size(); i++) {
if(q3[i].first<q3xmin) q3xmin=q3[i].first;
}
for(int i=1; i<q3.size(); i++) {
if(q3[i].second<q3ymin) q3ymin=q3[i].second;
}
for(int i=1; i<q4.size(); i++) {
if(q4[i].first<q4xmin) q4xmin=q4[i].first;
}
for(int i=1; i<q4.size(); i++) {
if(q4[i].second<q4ymin) q4ymin=q4[i].second;
}
int q1size, q2size, q3size, q4size;
q1size = (q1xmax-q1xmin) * (q1ymax-q1ymin);
q2size = (q2xmax-q2xmin) * (q2ymax-q2ymin);
q3size = (q3xmax-q3xmin) * (q3ymax-q3ymin);
q4size = (q4xmax-q4xmin) * (q4ymax-q4ymin);
if(q1.size()!=0) cout << "Q1: (" << q1xmin << ", " << q1ymin << ") (" << q1xmax << ", " << q1ymax << ") " << q1size << endl;
if(q2.size()!=0) cout << "Q2: (" << q2xmin << ", " << q2ymin << ") (" << q2xmax << ", " << q2ymax << ") " << q2size << endl;
if(q3.size()!=0) cout << "Q3: (" << q3xmin << ", " << q3ymin << ") (" << q3xmax << ", " << q3ymax << ") " << q3size << endl;
if(q4.size()!=0) cout << "Q4: (" << q4xmin << ", " << q4ymin << ") (" << q4xmax << ", " << q4ymax << ") " << q4size << endl;
//if(q1.size()!=0 && q2.size()!=0 && q3.size()!=0 && q4.size()!=0) cout << "No point in any quadrant";
} | # 2071586, 2024-11-02 14:51:51, PPPPPPPPPP (100%)
#include <iostream>
#include <vector>
using namespace std;
int main() {
int N;
cin >> N;
vector<pair<int, int>> q1,q2,q3,q4;
int x,y;
for(int i=0; i<N; i++) {
cin >> x >> y;
if(x>0 && y>0) {
q1.push_back(make_pair(x,y));
}else if(x<0 && y>0) {
q2.push_back(make_pair(x,y));
}else if(x<0 && y<0) {
q3.push_back(make_pair(x,y));
}else if(x>0 && y<0) {
q4.push_back(make_pair(x,y));
}
}
int q1xmax,q1ymax,q2xmax,q2ymax,q3xmax,q3ymax,q4xmax,q4ymax;
if(q1.size()!=0) {
q1xmax=q1[0].first;
q1ymax=q1[0].second;
}
if(q2.size()!=0) {
q2xmax=q2[0].first;
q2ymax=q2[0].second;
}
if(q3.size()!=0) {
q3xmax=q3[0].first;
q3ymax=q3[0].second;
}
if(q4.size()!=0) {
q4xmax=q4[0].first;
q4ymax=q4[0].second;
}
for(int i=1; i<q1.size(); i++) {
if(q1[i].first>q1xmax) q1xmax=q1[i].first;
}
for(int i=1; i<q1.size(); i++) {
if(q1[i].second>q1ymax) q1ymax=q1[i].second;
}
for(int i=1; i<q2.size(); i++) {
if(q2[i].first>q2xmax) q2xmax=q2[i].first;
}
for(int i=1; i<q2.size(); i++) {
if(q2[i].second>q2ymax) q2ymax=q2[i].second;
}
for(int i=1; i<q3.size(); i++) {
if(q3[i].first>q3xmax) q3xmax=q3[i].first;
}
for(int i=1; i<q3.size(); i++) {
if(q3[i].second>q3ymax) q3ymax=q3[i].second;
}
for(int i=1; i<q4.size(); i++) {
if(q4[i].first>q4xmax) q4xmax=q4[i].first;
}
for(int i=1; i<q4.size(); i++) {
if(q4[i].second>q4ymax) q4ymax=q4[i].second;
}
int q1xmin,q1ymin,q2xmin,q2ymin,q3xmin,q3ymin,q4xmin,q4ymin;
if(q1.size()!=0) {
q1xmin=q1[0].first;
q1ymin=q1[0].second;
}
if(q2.size()!=0) {
q2xmin=q2[0].first;
q2ymin=q2[0].second;
}
if(q3.size()!=0) {
q3xmin=q3[0].first;
q3ymin=q3[0].second;
}
if(q4.size()!=0) {
q4xmin=q4[0].first;
q4ymin=q4[0].second;
}
for(int i=1; i<q1.size(); i++) {
if(q1[i].first<q1xmin) q1xmin=q1[i].first;
}
for(int i=1; i<q1.size(); i++) {
if(q1[i].second<q1ymin) q1ymin=q1[i].second;
}
for(int i=1; i<q2.size(); i++) {
if(q2[i].first<q2xmin) q2xmin=q2[i].first;
}
for(int i=1; i<q2.size(); i++) {
if(q2[i].second<q2ymin) q2ymin=q2[i].second;
}
for(int i=1; i<q3.size(); i++) {
if(q3[i].first<q3xmin) q3xmin=q3[i].first;
}
for(int i=1; i<q3.size(); i++) {
if(q3[i].second<q3ymin) q3ymin=q3[i].second;
}
for(int i=1; i<q4.size(); i++) {
if(q4[i].first<q4xmin) q4xmin=q4[i].first;
}
for(int i=1; i<q4.size(); i++) {
if(q4[i].second<q4ymin) q4ymin=q4[i].second;
}
int q1size, q2size, q3size, q4size;
q1size = (q1xmax-q1xmin) * (q1ymax-q1ymin);
q2size = (q2xmax-q2xmin) * (q2ymax-q2ymin);
q3size = (q3xmax-q3xmin) * (q3ymax-q3ymin);
q4size = (q4xmax-q4xmin) * (q4ymax-q4ymin);
if(q1.size()!=0) cout << "Q1: (" << q1xmin << ", " << q1ymin << ") (" << q1xmax << ", " << q1ymax << ") " << q1size << endl;
if(q2.size()!=0) cout << "Q2: (" << q2xmin << ", " << q2ymin << ") (" << q2xmax << ", " << q2ymax << ") " << q2size << endl;
if(q3.size()!=0) cout << "Q3: (" << q3xmin << ", " << q3ymin << ") (" << q3xmax << ", " << q3ymax << ") " << q3size << endl;
if(q4.size()!=0) cout << "Q4: (" << q4xmin << ", " << q4ymin << ") (" << q4xmax << ", " << q4ymax << ") " << q4size << endl;
if(q1.size()==0 && q2.size()==0 && q3.size()==0 && q4.size()==0) cout << "No point in any quadrant";
} |
# 2069003, 2024-11-02 10:02:20, ---------- (0%)
#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
#include <set>
#include <tuple>
#include <utility>
#include <cmath>
using namespace std;
int main(){
int n;
cin >> n;
int maxq1x=-1000, minq1x=1000, maxq1y=-1000, minq1y=1000, maxq2x=-1000, minq2x=1000, maxq2y=-1000, minq2y=1000,maxq3x=-1000, minq3x=1000, maxq3y=-1000, minq3y=1000, maxq4x=-1000, minq4x=1000, maxq4y=-1000, minq4y=1000;
int x, y;
for(int i=0; i < n; i++){
cin >> x >> y;
if(x > 0 && y > 0){
fmax(x,maxq1x);
fmin(x,minq1x);
fmax(y,maxq1y);
fmin(y,maxq1y);
}
else if(x < 0 && y > 0){
fmax(x,maxq2x);
fmin(x,minq2x);
fmax(y,maxq2y);
fmin(y,maxq2y);
}
else if(x < 0 && y < 0){
fmax(x,maxq3x);
fmin(x,minq3x);
fmax(y,maxq3y);
fmin(y,maxq3y);
}
else if(x > 0 && y < 0){
fmax(x,maxq4x);
fmin(x,minq4x);
fmax(y,maxq4y);
fmin(y,maxq4y);
}
}
if(maxq1x != -1000 && minq1x != 1000 && maxq1y != -1000 && minq1y != 1000 ){
cout << "Q1: " << "(" << minq1x << ", " << minq1y << ") (" << maxq1x << ", " << maxq1y << ") " << (maxq1x - minq1x)*(maxq1y - minq1y) << endl;
}
if(maxq2x != -1000 && minq2x != 1000 && maxq2y != -1000 && minq2y != 1000 ){
cout << "Q2: " << "(" << minq2x << ", " << minq2y << ") (" << maxq2x << ", " << maxq2y << ") " << (maxq2x - minq2x)*(maxq2y - minq2y) << endl;
}
if(maxq3x != -1000 && minq3x != 1000 && maxq3y != -1000 && minq3y != 1000 ){
cout << "Q3: " << "(" << minq3x << ", " << minq3y << ") (" << maxq3x << ", " << maxq3y << ") " << (maxq3x - minq3x)*(maxq3y - minq3y) << endl;
}
if(maxq4x != -1000 && minq4x != 1000 && maxq4y != -1000 && minq4y != 1000 ){
cout << "Q4: " << "(" << minq4x << ", " << minq4y << ") (" << maxq4x << ", " << maxq4y << ") " << (maxq4x - minq4x)*(maxq4y - minq4y) << endl;
}
return 0;
} | # 2069037, 2024-11-02 10:06:00, ---------- (0%)
#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
#include <set>
#include <tuple>
#include <utility>
#include <cmath>
using namespace std;
int main(){
int n;
cin >> n;
float maxq1x=-1000, minq1x=1000, maxq1y=-1000, minq1y=1000, maxq2x=-1000, minq2x=1000, maxq2y=-1000, minq2y=1000,maxq3x=-1000, minq3x=1000, maxq3y=-1000, minq3y=1000, maxq4x=-1000, minq4x=1000, maxq4y=-1000, minq4y=1000;
float x, y;
for(int i=0; i < n; i++){
cin >> x >> y;
if(x > 0 && y > 0){
fmax(x,maxq1x);
fmin(x,minq1x);
fmax(y,maxq1y);
fmin(y,maxq1y);
}
else if(x < 0 && y > 0){
fmax(x,maxq2x);
fmin(x,minq2x);
fmax(y,maxq2y);
fmin(y,maxq2y);
}
else if(x < 0 && y < 0){
fmax(x,maxq3x);
fmin(x,minq3x);
fmax(y,maxq3y);
fmin(y,maxq3y);
}
else if(x > 0 && y < 0){
fmax(x,maxq4x);
fmin(x,minq4x);
fmax(y,maxq4y);
fmin(y,maxq4y);
}
}
if(maxq1x != -1000 && minq1x != 1000 && maxq1y != -1000 && minq1y != 1000 ){
cout << "Q1: " << "(" << minq1x << ", " << minq1y << ") (" << maxq1x << ", " << maxq1y << ") " << (maxq1x - minq1x)*(maxq1y - minq1y) << endl;
}
if(maxq2x != -1000 && minq2x != 1000 && maxq2y != -1000 && minq2y != 1000 ){
cout << "Q2: " << "(" << minq2x << ", " << minq2y << ") (" << maxq2x << ", " << maxq2y << ") " << (maxq2x - minq2x)*(maxq2y - minq2y) << endl;
}
if(maxq3x != -1000 && minq3x != 1000 && maxq3y != -1000 && minq3y != 1000 ){
cout << "Q3: " << "(" << minq3x << ", " << minq3y << ") (" << maxq3x << ", " << maxq3y << ") " << (maxq3x - minq3x)*(maxq3y - minq3y) << endl;
}
if(maxq4x != -1000 && minq4x != 1000 && maxq4y != -1000 && minq4y != 1000 ){
cout << "Q4: " << "(" << minq4x << ", " << minq4y << ") (" << maxq4x << ", " << maxq4y << ") " << (maxq4x - minq4x)*(maxq4y - minq4y) << endl;
}
return 0;
} | # 2069339, 2024-11-02 10:37:53, ---------- (0%)
#include <iostream>
#include <cmath>
using namespace std;
int main(){
int n;
cin >> n;
float maxq1x=-1000, minq1x=1000, maxq1y=-1000, minq1y=1000, maxq2x=-1000, minq2x=1000, maxq2y=-1000, minq2y=1000,maxq3x=-1000, minq3x=1000, maxq3y=-1000, minq3y=1000, maxq4x=-1000, minq4x=1000, maxq4y=-1000, minq4y=1000;
float x, y;
for(int i=0; i < n; i++){
cin >> x >> y;
if(x > 0 && y > 0){
maxq1x = fmax(x,maxq1x);
minq1x = fmin(x,minq1x);
maxq1y = fmax(y,maxq1y);
minq1y = fmin(y,maxq1y);
}
else if(x < 0 && y > 0){
maxq2x = fmax(x,maxq2x);
minq2x = fmin(x,minq2x);
maxq2y = fmax(y,maxq2y);
minq2y = fmin(y,maxq2y);
}
else if(x < 0 && y < 0){
maxq3x = fmax(x,maxq3x);
minq3x = fmin(x,minq3x);
maxq3y = fmax(y,maxq3y);
maxq3y = fmin(y,maxq3y);
}
else if(x > 0 && y < 0){
maxq4x = fmax(x,maxq4x);
minq4x = fmin(x,minq4x);
maxq4y = fmax(y,maxq4y);
maxq4y = fmin(y,maxq4y);
}
}
cout << maxq1x;
if(maxq1x != -1000 && minq1x != 1000 && maxq1y != -1000 && minq1y != 1000 ){
cout << "Q1: " << "(" << minq1x << ", " << minq1y << ") (" << maxq1x << ", " << maxq1y << ") " << (maxq1x - minq1x)*(maxq1y - minq1y) << endl;
}
if(maxq2x != -1000 && minq2x != 1000 && maxq2y != -1000 && minq2y != 1000 ){
cout << "Q2: " << "(" << minq2x << ", " << minq2y << ") (" << maxq2x << ", " << maxq2y << ") " << (maxq2x - minq2x)*(maxq2y - minq2y) << endl;
}
if(maxq3x != -1000 && minq3x != 1000 && maxq3y != -1000 && minq3y != 1000 ){
cout << "Q3: " << "(" << minq3x << ", " << minq3y << ") (" << maxq3x << ", " << maxq3y << ") " << (maxq3x - minq3x)*(maxq3y - minq3y) << endl;
}
if(maxq4x != -1000 && minq4x != 1000 && maxq4y != -1000 && minq4y != 1000 ){
cout << "Q4: " << "(" << minq4x << ", " << minq4y << ") (" << maxq4x << ", " << maxq4y << ") " << (maxq4x - minq4x)*(maxq4y - minq4y) << endl;
}
} | # 2069374, 2024-11-02 10:41:27, PPP------- (30%)
#include <iostream>
#include <cmath>
using namespace std;
int main(){
int n;
cin >> n;
float maxq1x=-1000, minq1x=1000, maxq1y=-1000, minq1y=1000, maxq2x=-1000, minq2x=1000, maxq2y=-1000, minq2y=1000,maxq3x=-1000, minq3x=1000, maxq3y=-1000, minq3y=1000, maxq4x=-1000, minq4x=1000, maxq4y=-1000, minq4y=1000;
float x, y;
for(int i=0; i < n; i++){
cin >> x >> y;
if(x > 0 && y > 0){
maxq1x = fmax(x,maxq1x);
minq1x = fmin(x,minq1x);
maxq1y = fmax(y,maxq1y);
minq1y = fmin(y,minq1y);
}
else if(x < 0 && y > 0){
maxq2x = fmax(x,maxq2x);
minq2x = fmin(x,minq2x);
maxq2y = fmax(y,maxq2y);
minq2y = fmin(y,minq2y);
}
else if(x < 0 && y < 0){
maxq3x = fmax(x,maxq3x);
minq3x = fmin(x,minq3x);
maxq3y = fmax(y,maxq3y);
maxq3y = fmin(y,minq3y);
}
else if(x > 0 && y < 0){
maxq4x = fmax(x,maxq4x);
minq4x = fmin(x,minq4x);
maxq4y = fmax(y,maxq4y);
maxq4y = fmin(y,minq4y);
}
}
//cout << maxq1x << minq1x << maxq1y << minq1y;
if(maxq1x != -1000 && minq1x != 1000 && maxq1y != -1000 && minq1y != 1000 ){
cout << "Q1: " << "(" << minq1x << ", " << minq1y << ") (" << maxq1x << ", " << maxq1y << ") " << (maxq1x - minq1x)*(maxq1y - minq1y) << endl;
}
if(maxq2x != -1000 && minq2x != 1000 && maxq2y != -1000 && minq2y != 1000 ){
cout << "Q2: " << "(" << minq2x << ", " << minq2y << ") (" << maxq2x << ", " << maxq2y << ") " << (maxq2x - minq2x)*(maxq2y - minq2y) << endl;
}
if(maxq3x != -1000 && minq3x != 1000 && maxq3y != -1000 && minq3y != 1000 ){
cout << "Q3: " << "(" << minq3x << ", " << minq3y << ") (" << maxq3x << ", " << maxq3y << ") " << (maxq3x - minq3x)*(maxq3y - minq3y) << endl;
}
if(maxq4x != -1000 && minq4x != 1000 && maxq4y != -1000 && minq4y != 1000 ){
cout << "Q4: " << "(" << minq4x << ", " << minq4y << ") (" << maxq4x << ", " << maxq4y << ") " << (maxq4x - minq4x)*(maxq4y - minq4y) << endl;
}
} | # 2069404, 2024-11-02 10:43:54, PPP--P---- (40%)
#include <iostream>
#include <cmath>
using namespace std;
int main(){
int n;
cin >> n;
float maxq1x=-1000, minq1x=1000, maxq1y=-1000, minq1y=1000, maxq2x=-1000, minq2x=1000, maxq2y=-1000, minq2y=1000,maxq3x=-1000, minq3x=1000, maxq3y=-1000, minq3y=1000, maxq4x=-1000, minq4x=1000, maxq4y=-1000, minq4y=1000;
float x, y;
int no=0;
for(int i=0; i < n; i++){
cin >> x >> y;
if(x > 0 && y > 0){
maxq1x = fmax(x,maxq1x);
minq1x = fmin(x,minq1x);
maxq1y = fmax(y,maxq1y);
minq1y = fmin(y,minq1y);
}
else if(x < 0 && y > 0){
maxq2x = fmax(x,maxq2x);
minq2x = fmin(x,minq2x);
maxq2y = fmax(y,maxq2y);
minq2y = fmin(y,minq2y);
}
else if(x < 0 && y < 0){
maxq3x = fmax(x,maxq3x);
minq3x = fmin(x,minq3x);
maxq3y = fmax(y,maxq3y);
maxq3y = fmin(y,minq3y);
}
else if(x > 0 && y < 0){
maxq4x = fmax(x,maxq4x);
minq4x = fmin(x,minq4x);
maxq4y = fmax(y,maxq4y);
maxq4y = fmin(y,minq4y);
}
else no++;
}
//cout << maxq1x << minq1x << maxq1y << minq1y;
if(maxq1x != -1000 && minq1x != 1000 && maxq1y != -1000 && minq1y != 1000 ){
cout << "Q1: " << "(" << minq1x << ", " << minq1y << ") (" << maxq1x << ", " << maxq1y << ") " << (maxq1x - minq1x)*(maxq1y - minq1y) << endl;
}
if(maxq2x != -1000 && minq2x != 1000 && maxq2y != -1000 && minq2y != 1000 ){
cout << "Q2: " << "(" << minq2x << ", " << minq2y << ") (" << maxq2x << ", " << maxq2y << ") " << (maxq2x - minq2x)*(maxq2y - minq2y) << endl;
}
if(maxq3x != -1000 && minq3x != 1000 && maxq3y != -1000 && minq3y != 1000 ){
cout << "Q3: " << "(" << minq3x << ", " << minq3y << ") (" << maxq3x << ", " << maxq3y << ") " << (maxq3x - minq3x)*(maxq3y - minq3y) << endl;
}
if(maxq4x != -1000 && minq4x != 1000 && maxq4y != -1000 && minq4y != 1000 ){
cout << "Q4: " << "(" << minq4x << ", " << minq4y << ") (" << maxq4x << ", " << maxq4y << ") " << (maxq4x - minq4x)*(maxq4y - minq4y) << endl;
}
if(no == n) cout << "No point in any quadrant";
} | # 2069460, 2024-11-02 10:48:48, PPPPPPPPPP (100%)
#include <iostream>
#include <cmath>
using namespace std;
int main(){
int n;
cin >> n;
float maxq1x=-1000, minq1x=1000, maxq1y=-1000, minq1y=1000, maxq2x=-1000, minq2x=1000, maxq2y=-1000, minq2y=1000,maxq3x=-1000, minq3x=1000, maxq3y=-1000, minq3y=1000, maxq4x=-1000, minq4x=1000, maxq4y=-1000, minq4y=1000;
float x, y;
int no=0;
for(int i=0; i < n; i++){
cin >> x >> y;
if(x > 0 && y > 0){
maxq1x = fmax(x,maxq1x);
minq1x = fmin(x,minq1x);
maxq1y = fmax(y,maxq1y);
minq1y = fmin(y,minq1y);
}
else if(x < 0 && y > 0){
maxq2x = fmax(x,maxq2x);
minq2x = fmin(x,minq2x);
maxq2y = fmax(y,maxq2y);
minq2y = fmin(y,minq2y);
}
else if(x < 0 && y < 0){
maxq3x = fmax(x,maxq3x);
minq3x = fmin(x,minq3x);
maxq3y = fmax(y,maxq3y);
minq3y = fmin(y,minq3y);
}
else if(x > 0 && y < 0){
maxq4x = fmax(x,maxq4x);
minq4x = fmin(x,minq4x);
maxq4y = fmax(y,maxq4y);
minq4y = fmin(y,minq4y);
}
else no++;
}
//cout << maxq1x << minq1x << maxq1y << minq1y<<endl;
//cout << maxq2x << minq2x << maxq2y << minq2y<<endl;
//cout << maxq3x << minq3x << maxq3y << minq3y<<endl;
//cout << maxq4x << minq4x << maxq4y << minq4y<<endl;
if(maxq1x != -1000 && minq1x != 1000 && maxq1y != -1000 && minq1y != 1000 ){
cout << "Q1: " << "(" << minq1x << ", " << minq1y << ") (" << maxq1x << ", " << maxq1y << ") " << (maxq1x - minq1x)*(maxq1y - minq1y) << endl;
}
if(maxq2x != -1000 && minq2x != 1000 && maxq2y != -1000 && minq2y != 1000 ){
cout << "Q2: " << "(" << minq2x << ", " << minq2y << ") (" << maxq2x << ", " << maxq2y << ") " << (maxq2x - minq2x)*(maxq2y - minq2y) << endl;
}
if(maxq3x != -1000 && minq3x != 1000 && maxq3y != -1000 && minq3y != 1000 ){
cout << "Q3: " << "(" << minq3x << ", " << minq3y << ") (" << maxq3x << ", " << maxq3y << ") " << (maxq3x - minq3x)*(maxq3y - minq3y) << endl;
}
if(maxq4x != -1000 && minq4x != 1000 && maxq4y != -1000 && minq4y != 1000 ){
cout << "Q4: " << "(" << minq4x << ", " << minq4y << ") (" << maxq4x << ", " << maxq4y << ") " << (maxq4x - minq4x)*(maxq4y - minq4y) << endl;
}
if(no == n) cout << "No point in any quadrant";
} |
# 2069058, 2024-11-02 10:08:02, -----P---- (10%)
#include <iostream>
#include <vector>
using namespace std;
int main(){
vector<pair<int,int>> Q1;
vector<pair<int,int>> Q2;
vector<pair<int,int>> Q3;
vector<pair<int,int>> Q4;
int n = 0;
cin >> n;
int x = 0;
int y = 0;
int x_max = 0;
int x_min = 100;
int y_max = 0;
int y_min = 100;
for(int i = 0; i < n; i++){
cin >> x >> y;
if(x > 0 && y > 0){
Q1.push_back({x,y});
}
else if(x < 0 && y > 0){
Q2.push_back({x,y});
}
else if(x < 0 && y < 0){
Q3.push_back({x,y});
}
else if(x > 0 && y < 0){
Q4.push_back({x,y});
}
}
for(int i = 0; i < Q1.size(); i++){
if(Q1[i].first > x_max){
x_max = Q1[i].first;
}
if(Q1[i].first < x_min){
x_min = Q1[i].first;
}
if(Q1[i].second > y_max){
y_max = Q1[i].second;
}
if(Q1[i].second < y_min){
y_min = Q1[i].second;
}
}
if(!Q1.empty()){
cout << "Q1: ";
for(int i = 0; i < Q1.size(); i++){
cout << "(" << Q1[i].first << ", " << Q1[i].second << ") ";
}
cout << (x_max-x_min)*(y_max-y_min);
}
cout << endl;
x_max = -100;
x_min = 0;
y_max = 0;
y_min = 100;
for(int i = 0; i < Q2.size(); i++){
if(Q2[i].first > x_max){
x_max = Q2[i].first;
}
if(Q2[i].first < x_min){
x_min = Q2[i].first;
}
if(Q2[i].second > y_max){
y_max = Q2[i].second;
}
if(Q2[i].second < y_min){
y_min = Q2[i].second;
}
}
if(!Q2.empty()){
cout << "Q2: ";
for(int i = 0; i < Q2.size(); i++){
cout << "(" << Q2[i].first << ", " << Q2[i].second << ") ";
}
cout << (x_max-x_min)*(y_max-y_min);
}
cout << endl;
x_max = -100;
x_min = 0;
y_max = -100;
y_min = 0;
for(int i = 0; i < Q3.size(); i++){
if(Q3[i].first > x_max){
x_max = Q3[i].first;
}
if(Q3[i].first < x_min){
x_min = Q3[i].first;
}
if(Q3[i].second > y_max){
y_max = Q3[i].second;
}
if(Q3[i].second < y_min){
y_min = Q3[i].second;
}
}
if(!Q3.empty()){
cout << "Q3: ";
for(int i = 0; i < Q3.size(); i++){
cout << "(" << Q3[i].first << ", " << Q3[i].second << ") ";
}
cout << (x_max-x_min)*(y_max-y_min);
}
cout << endl;
x_max = 0;
x_min = 100;
y_max = -100;
y_min = 0;
for(int i = 0; i < Q4.size(); i++){
if(Q4[i].first > x_max){
x_max = Q4[i].first;
}
if(Q4[i].first < x_min){
x_min = Q4[i].first;
}
if(Q4[i].second > y_max){
y_max = Q4[i].second;
}
if(Q4[i].second < y_min){
y_min = Q4[i].second;
}
}
if(!Q4.empty()){
cout << "Q4: ";
for(int i = 0; i < Q4.size(); i++){
cout << "(" << Q4[i].first << ", " << Q4[i].second << ") ";
}
cout << (x_max-x_min)*(y_max-y_min);
}
cout << endl;
if(Q1.empty() && Q2.empty() && Q3.empty() && Q4.empty()){
cout << "No point in any quadrant";
}
} | # 2069072, 2024-11-02 10:09:21, -----P---- (10%)
#include <iostream>
#include <vector>
using namespace std;
int main(){
vector<pair<int,int>> Q1;
vector<pair<int,int>> Q2;
vector<pair<int,int>> Q3;
vector<pair<int,int>> Q4;
int n = 0;
cin >> n;
int x = 0;
int y = 0;
int x_max = 0;
int x_min = 100;
int y_max = 0;
int y_min = 100;
for(int i = 0; i < n; i++){
cin >> x >> y;
if(x > 0 && y > 0){
Q1.push_back({x,y});
}
else if(x < 0 && y > 0){
Q2.push_back({x,y});
}
else if(x < 0 && y < 0){
Q3.push_back({x,y});
}
else if(x > 0 && y < 0){
Q4.push_back({x,y});
}
}
for(int i = 0; i < Q1.size(); i++){
if(Q1[i].first > x_max){
x_max = Q1[i].first;
}
if(Q1[i].first < x_min){
x_min = Q1[i].first;
}
if(Q1[i].second > y_max){
y_max = Q1[i].second;
}
if(Q1[i].second < y_min){
y_min = Q1[i].second;
}
}
if(!Q1.empty()){
cout << "Q1: ";
for(int i = 0; i < Q1.size(); i++){
cout << "(" << Q1[i].first << ", " << Q1[i].second << ") ";
}
cout << (x_max-x_min)*(y_max-y_min);
cout << endl;
}
x_max = -100;
x_min = 0;
y_max = 0;
y_min = 100;
for(int i = 0; i < Q2.size(); i++){
if(Q2[i].first > x_max){
x_max = Q2[i].first;
}
if(Q2[i].first < x_min){
x_min = Q2[i].first;
}
if(Q2[i].second > y_max){
y_max = Q2[i].second;
}
if(Q2[i].second < y_min){
y_min = Q2[i].second;
}
}
if(!Q2.empty()){
cout << "Q2: ";
for(int i = 0; i < Q2.size(); i++){
cout << "(" << Q2[i].first << ", " << Q2[i].second << ") ";
}
cout << (x_max-x_min)*(y_max-y_min);
cout << endl;
}
x_max = -100;
x_min = 0;
y_max = -100;
y_min = 0;
for(int i = 0; i < Q3.size(); i++){
if(Q3[i].first > x_max){
x_max = Q3[i].first;
}
if(Q3[i].first < x_min){
x_min = Q3[i].first;
}
if(Q3[i].second > y_max){
y_max = Q3[i].second;
}
if(Q3[i].second < y_min){
y_min = Q3[i].second;
}
}
if(!Q3.empty()){
cout << "Q3: ";
for(int i = 0; i < Q3.size(); i++){
cout << "(" << Q3[i].first << ", " << Q3[i].second << ") ";
}
cout << (x_max-x_min)*(y_max-y_min);
cout << endl;
}
x_max = 0;
x_min = 100;
y_max = -100;
y_min = 0;
for(int i = 0; i < Q4.size(); i++){
if(Q4[i].first > x_max){
x_max = Q4[i].first;
}
if(Q4[i].first < x_min){
x_min = Q4[i].first;
}
if(Q4[i].second > y_max){
y_max = Q4[i].second;
}
if(Q4[i].second < y_min){
y_min = Q4[i].second;
}
}
if(!Q4.empty()){
cout << "Q4: ";
for(int i = 0; i < Q4.size(); i++){
cout << "(" << Q4[i].first << ", " << Q4[i].second << ") ";
}
cout << (x_max-x_min)*(y_max-y_min);
cout << endl;
}
if(Q1.empty() && Q2.empty() && Q3.empty() && Q4.empty()){
cout << "No point in any quadrant";
}
} | # 2069105, 2024-11-02 10:12:43, -----P---- (10%)
#include <iostream>
#include <vector>
using namespace std;
int main(){
vector<pair<int,int>> Q1;
vector<pair<int,int>> Q2;
vector<pair<int,int>> Q3;
vector<pair<int,int>> Q4;
int n = 0;
cin >> n;
int x = 0;
int y = 0;
int x_max = 0;
int x_min = 100;
int y_max = 0;
int y_min = 100;
for(int i = 0; i < n; i++){
cin >> x >> y;
if(x > 0 && y > 0){
Q1.push_back({x,y});
}
else if(x < 0 && y > 0){
Q2.push_back({x,y});
}
else if(x < 0 && y < 0){
Q3.push_back({x,y});
}
else if(x > 0 && y < 0){
Q4.push_back({x,y});
}
}
for(int i = 0; i < Q1.size(); i++){
if(Q1[i].first > x_max){
x_max = Q1[i].first;
}
if(Q1[i].first < x_min){
x_min = Q1[i].first;
}
if(Q1[i].second > y_max){
y_max = Q1[i].second;
}
if(Q1[i].second < y_min){
y_min = Q1[i].second;
}
}
if(!Q1.empty()){
cout << "Q1: ";
for(int i = 0; i < Q1.size(); i++){
cout << "(" << Q1[i].first << ", " << Q1[i].second << ") ";
}
if(x_max == 0 && x_min == 100 && y_max == 0 && y_min == 100){
cout << "0";
}
else{
cout << (x_max-x_min)*(y_max-y_min);
}
cout << endl;
}
x_max = -100;
x_min = 0;
y_max = 0;
y_min = 100;
for(int i = 0; i < Q2.size(); i++){
if(Q2[i].first > x_max){
x_max = Q2[i].first;
}
if(Q2[i].first < x_min){
x_min = Q2[i].first;
}
if(Q2[i].second > y_max){
y_max = Q2[i].second;
}
if(Q2[i].second < y_min){
y_min = Q2[i].second;
}
}
if(!Q2.empty()){
cout << "Q2: ";
for(int i = 0; i < Q2.size(); i++){
cout << "(" << Q2[i].first << ", " << Q2[i].second << ") ";
}
if(x_max == -100 && x_min == 0 && y_max == 0 && y_min == 100){
cout << "0";
}
else{
cout << (x_max-x_min)*(y_max-y_min);
}
cout << endl;
}
x_max = -100;
x_min = 0;
y_max = -100;
y_min = 0;
for(int i = 0; i < Q3.size(); i++){
if(Q3[i].first > x_max){
x_max = Q3[i].first;
}
if(Q3[i].first < x_min){
x_min = Q3[i].first;
}
if(Q3[i].second > y_max){
y_max = Q3[i].second;
}
if(Q3[i].second < y_min){
y_min = Q3[i].second;
}
}
if(!Q3.empty()){
cout << "Q3: ";
for(int i = 0; i < Q3.size(); i++){
cout << "(" << Q3[i].first << ", " << Q3[i].second << ") ";
}
if(x_max == -100 && x_min == 0 && y_max == -100 && y_min == 0){
cout << "0";
}
else{
cout << (x_max-x_min)*(y_max-y_min);
}
cout << endl;
}
x_max = 0;
x_min = 100;
y_max = -100;
y_min = 0;
for(int i = 0; i < Q4.size(); i++){
if(Q4[i].first > x_max){
x_max = Q4[i].first;
}
if(Q4[i].first < x_min){
x_min = Q4[i].first;
}
if(Q4[i].second > y_max){
y_max = Q4[i].second;
}
if(Q4[i].second < y_min){
y_min = Q4[i].second;
}
}
if(!Q4.empty()){
cout << "Q4: ";
for(int i = 0; i < Q4.size(); i++){
cout << "(" << Q4[i].first << ", " << Q4[i].second << ") ";
}
if(x_max == 0 && x_min == 100 && y_max == -100 && y_min == 0){
cout << "0";
}
else{
cout << (x_max-x_min)*(y_max-y_min);
}
cout << endl;
}
if(Q1.empty() && Q2.empty() && Q3.empty() && Q4.empty()){
cout << "No point in any quadrant";
}
} | # 2069124, 2024-11-02 10:14:44, -----P---- (10%)
#include <iostream>
#include <vector>
using namespace std;
int main(){
vector<pair<int,int>> Q1;
vector<pair<int,int>> Q2;
vector<pair<int,int>> Q3;
vector<pair<int,int>> Q4;
int n = 0;
cin >> n;
int x = 0;
int y = 0;
int x_max = 0;
int x_min = 1000;
int y_max = 0;
int y_min = 1000;
for(int i = 0; i < n; i++){
cin >> x >> y;
if(x > 0 && y > 0){
Q1.push_back({x,y});
}
else if(x < 0 && y > 0){
Q2.push_back({x,y});
}
else if(x < 0 && y < 0){
Q3.push_back({x,y});
}
else if(x > 0 && y < 0){
Q4.push_back({x,y});
}
}
for(int i = 0; i < Q1.size(); i++){
if(Q1[i].first > x_max){
x_max = Q1[i].first;
}
if(Q1[i].first < x_min){
x_min = Q1[i].first;
}
if(Q1[i].second > y_max){
y_max = Q1[i].second;
}
if(Q1[i].second < y_min){
y_min = Q1[i].second;
}
}
if(!Q1.empty()){
cout << "Q1: ";
for(int i = 0; i < Q1.size(); i++){
cout << "(" << Q1[i].first << ", " << Q1[i].second << ") ";
}
if(x_max == 0 && x_min == 100 && y_max == 0 && y_min == 100){
cout << "0";
}
else{
cout << (x_max-x_min)*(y_max-y_min);
}
cout << endl;
}
x_max = -1000;
x_min = 0;
y_max = 0;
y_min = 1000;
for(int i = 0; i < Q2.size(); i++){
if(Q2[i].first > x_max){
x_max = Q2[i].first;
}
if(Q2[i].first < x_min){
x_min = Q2[i].first;
}
if(Q2[i].second > y_max){
y_max = Q2[i].second;
}
if(Q2[i].second < y_min){
y_min = Q2[i].second;
}
}
if(!Q2.empty()){
cout << "Q2: ";
for(int i = 0; i < Q2.size(); i++){
cout << "(" << Q2[i].first << ", " << Q2[i].second << ") ";
}
if(x_max == -100 && x_min == 0 && y_max == 0 && y_min == 100){
cout << "0";
}
else{
cout << (x_max-x_min)*(y_max-y_min);
}
cout << endl;
}
x_max = -1000;
x_min = 0;
y_max = -1000;
y_min = 0;
for(int i = 0; i < Q3.size(); i++){
if(Q3[i].first > x_max){
x_max = Q3[i].first;
}
if(Q3[i].first < x_min){
x_min = Q3[i].first;
}
if(Q3[i].second > y_max){
y_max = Q3[i].second;
}
if(Q3[i].second < y_min){
y_min = Q3[i].second;
}
}
if(!Q3.empty()){
cout << "Q3: ";
for(int i = 0; i < Q3.size(); i++){
cout << "(" << Q3[i].first << ", " << Q3[i].second << ") ";
}
if(x_max == -100 && x_min == 0 && y_max == -100 && y_min == 0){
cout << "0";
}
else{
cout << (x_max-x_min)*(y_max-y_min);
}
cout << endl;
}
x_max = 0;
x_min = 1000;
y_max = -1000;
y_min = 0;
for(int i = 0; i < Q4.size(); i++){
if(Q4[i].first > x_max){
x_max = Q4[i].first;
}
if(Q4[i].first < x_min){
x_min = Q4[i].first;
}
if(Q4[i].second > y_max){
y_max = Q4[i].second;
}
if(Q4[i].second < y_min){
y_min = Q4[i].second;
}
}
if(!Q4.empty()){
cout << "Q4: ";
for(int i = 0; i < Q4.size(); i++){
cout << "(" << Q4[i].first << ", " << Q4[i].second << ") ";
}
if(x_max == 0 && x_min == 100 && y_max == -100 && y_min == 0){
cout << "0";
}
else{
cout << (x_max-x_min)*(y_max-y_min);
}
cout << endl;
}
if(Q1.empty() && Q2.empty() && Q3.empty() && Q4.empty()){
cout << "No point in any quadrant";
}
} | # 2069488, 2024-11-02 10:51:34, -----P---- (10%)
#include <iostream>
#include <vector>
using namespace std;
int main(){
vector<pair<int,int>> Q1;
vector<pair<int,int>> Q2;
vector<pair<int,int>> Q3;
vector<pair<int,int>> Q4;
int n = 0;
cin >> n;
int x = 0;
int y = 0;
int x_max = 0;
int x_min = 100;
int y_max = 0;
int y_min = 100;
for(int i = 0; i < n; i++){
cin >> x >> y;
if(x > 0 && y > 0){
Q1.push_back({x,y});
}
else if(x < 0 && y > 0){
Q2.push_back({x,y});
}
else if(x < 0 && y < 0){
Q3.push_back({x,y});
}
else if(x > 0 && y < 0){
Q4.push_back({x,y});
}
}
for(int i = 0; i < Q1.size(); i++){
if(Q1[i].first > x_max){
x_max = Q1[i].first;
}
if(Q1[i].first < x_min){
x_min = Q1[i].first;
}
if(Q1[i].second > y_max){
y_max = Q1[i].second;
}
if(Q1[i].second < y_min){
y_min = Q1[i].second;
}
}
if(!Q1.empty()){
cout << "Q1: ";
for(int i = 0; i < Q1.size(); i++){
cout << "(" << Q1[i].first << ", " << Q1[i].second << ") ";
}
if(x_max == 0 || x_min == 100 || y_max == 0 || y_min == 100){
cout << "0";
}
else{
cout << (x_max-x_min)*(y_max-y_min);
}
cout << endl;
}
x_max = -100;
x_min = 0;
y_max = 0;
y_min = 100;
for(int i = 0; i < Q2.size(); i++){
if(Q2[i].first > x_max){
x_max = Q2[i].first;
}
if(Q2[i].first < x_min){
x_min = Q2[i].first;
}
if(Q2[i].second > y_max){
y_max = Q2[i].second;
}
if(Q2[i].second < y_min){
y_min = Q2[i].second;
}
}
if(!Q2.empty()){
cout << "Q2: ";
for(int i = 0; i < Q2.size(); i++){
cout << "(" << Q2[i].first << ", " << Q2[i].second << ") ";
}
if(x_max == -100 || x_min == 0 || y_max == 0 || y_min == 100){
cout << "0";
}
else{
cout << (x_max-x_min)*(y_max-y_min);
}
cout << endl;
}
x_max = -100;
x_min = 0;
y_max = -100;
y_min = 0;
for(int i = 0; i < Q3.size(); i++){
if(Q3[i].first > x_max){
x_max = Q3[i].first;
}
if(Q3[i].first < x_min){
x_min = Q3[i].first;
}
if(Q3[i].second > y_max){
y_max = Q3[i].second;
}
if(Q3[i].second < y_min){
y_min = Q3[i].second;
}
}
if(!Q3.empty()){
cout << "Q3: ";
for(int i = 0; i < Q3.size(); i++){
cout << "(" << Q3[i].first << ", " << Q3[i].second << ") ";
}
if(x_max == -100 || x_min == 0 || y_max == -100 || y_min == 0){
cout << "0";
}
else{
cout << (x_max-x_min)*(y_max-y_min);
}
cout << endl;
}
x_max = 0;
x_min = 100;
y_max = -100;
y_min = 0;
for(int i = 0; i < Q4.size(); i++){
if(Q4[i].first > x_max){
x_max = Q4[i].first;
}
if(Q4[i].first < x_min){
x_min = Q4[i].first;
}
if(Q4[i].second > y_max){
y_max = Q4[i].second;
}
if(Q4[i].second < y_min){
y_min = Q4[i].second;
}
}
if(!Q4.empty()){
cout << "Q4: ";
for(int i = 0; i < Q4.size(); i++){
cout << "(" << Q4[i].first << ", " << Q4[i].second << ") ";
}
if(x_max == 0 || x_min == 100 || y_max == -100 || y_min == 0){
cout << "0";
}
else{
cout << (x_max-x_min)*(y_max-y_min);
}
cout << endl;
}
if(Q1.empty() && Q2.empty() && Q3.empty() && Q4.empty()){
cout << "No point in any quadrant";
}
} | # 2069551, 2024-11-02 10:57:57, PPPPPPPPPP (100%)
#include <iostream>
#include <vector>
using namespace std;
int main(){
vector<pair<int,int>> Q1;
vector<pair<int,int>> Q2;
vector<pair<int,int>> Q3;
vector<pair<int,int>> Q4;
int n = 0;
cin >> n;
int x = 0;
int y = 0;
int x_max = 0;
int x_min = 100;
int y_max = 0;
int y_min = 100;
for(int i = 0; i < n; i++){
cin >> x >> y;
if(x > 0 && y > 0){
Q1.push_back({x,y});
}
else if(x < 0 && y > 0){
Q2.push_back({x,y});
}
else if(x < 0 && y < 0){
Q3.push_back({x,y});
}
else if(x > 0 && y < 0){
Q4.push_back({x,y});
}
}
for(int i = 0; i < Q1.size(); i++){
if(Q1[i].first > x_max){
x_max = Q1[i].first;
}
if(Q1[i].first < x_min){
x_min = Q1[i].first;
}
if(Q1[i].second > y_max){
y_max = Q1[i].second;
}
if(Q1[i].second < y_min){
y_min = Q1[i].second;
}
}
if(!Q1.empty()){
cout << "Q1: ";
cout << "(" << x_min << ", " << y_min << ") " << "(" << x_max << ", " << y_max << ") ";
if(x_max == 0 || x_min == 100 || y_max == 0 || y_min == 100){
cout << "0";
}
else{
cout << (x_max-x_min)*(y_max-y_min);
}
cout << endl;
}
x_max = -100;
x_min = 0;
y_max = 0;
y_min = 100;
for(int i = 0; i < Q2.size(); i++){
if(Q2[i].first > x_max){
x_max = Q2[i].first;
}
if(Q2[i].first < x_min){
x_min = Q2[i].first;
}
if(Q2[i].second > y_max){
y_max = Q2[i].second;
}
if(Q2[i].second < y_min){
y_min = Q2[i].second;
}
}
if(!Q2.empty()){
cout << "Q2: ";
cout << "(" << x_min << ", " << y_min << ") " << "(" << x_max << ", " << y_max << ") ";
if(x_max == -100 || x_min == 0 || y_max == 0 || y_min == 100){
cout << "0";
}
else{
cout << (x_max-x_min)*(y_max-y_min);
}
cout << endl;
}
x_max = -100;
x_min = 0;
y_max = -100;
y_min = 0;
for(int i = 0; i < Q3.size(); i++){
if(Q3[i].first > x_max){
x_max = Q3[i].first;
}
if(Q3[i].first < x_min){
x_min = Q3[i].first;
}
if(Q3[i].second > y_max){
y_max = Q3[i].second;
}
if(Q3[i].second < y_min){
y_min = Q3[i].second;
}
}
if(!Q3.empty()){
cout << "Q3: ";
cout << "(" << x_min << ", " << y_min << ") " << "(" << x_max << ", " << y_max << ") ";
if(x_max == -100 || x_min == 0 || y_max == -100 || y_min == 0){
cout << "0";
}
else{
cout << (x_max-x_min)*(y_max-y_min);
}
cout << endl;
}
x_max = 0;
x_min = 100;
y_max = -100;
y_min = 0;
for(int i = 0; i < Q4.size(); i++){
if(Q4[i].first > x_max){
x_max = Q4[i].first;
}
if(Q4[i].first < x_min){
x_min = Q4[i].first;
}
if(Q4[i].second > y_max){
y_max = Q4[i].second;
}
if(Q4[i].second < y_min){
y_min = Q4[i].second;
}
}
if(!Q4.empty()){
cout << "Q4: ";
cout << "(" << x_min << ", " << y_min << ") " << "(" << x_max << ", " << y_max << ") ";
if(x_max == 0 || x_min == 100 || y_max == -100 || y_min == 0){
cout << "0";
}
else{
cout << (x_max-x_min)*(y_max-y_min);
}
cout << endl;
}
if(Q1.empty() && Q2.empty() && Q3.empty() && Q4.empty()){
cout << "No point in any quadrant";
}
} |
# 2069547, 2024-11-02 10:57:28, xxxx-x--x- (0%)
#include <bits/stdc++.h>
using namespace std;
int main(){
vector<int> q1x,q2x,q3x,q4x;
vector<int> q1y,q2y,q3y,q4y;
int tempx,tempy;
int n;
cin >> n;
for(int i=0; i<n ; i++){
//x>0 -> q1,4
cin >> tempx ;
cin >> tempy ;
if(tempx > 0){
//y>0 -> q1
if(tempy>0){
q1x.push_back(tempx);
q1y.push_back(tempy);
}
//y<0 -> q4
if(tempy<0){
q4x.push_back(tempx);
q4y.push_back(tempy);
}
}
//x<0 -> q2,3
if(tempx < 0){
//y>0 -> q2
if(tempy>0){
q2x.push_back(tempx);
q2y.push_back(tempy);
}
//y<0 -> q3
if(tempy<0){
q3x.push_back(tempx);
q3y.push_back(tempy);
}
}
}
//find area
int a1,a2,a3,a4;
sort(q1x.begin(),q1x.end());
sort(q1y.begin(),q1y.end());
sort(q2x.begin(),q2x.end());
sort(q2y.begin(),q2y.end());
sort(q2x.begin(),q2x.end());
sort(q3y.begin(),q3y.end());
sort(q4x.begin(),q4x.end());
sort(q4y.begin(),q4y.end());
// highest x - lowest x * highest y - lowest y
a1 = (q1x[q1x.size()-1]-q1x[0]) * (q1y[q1y.size()-1]-q1y[0]);
a2 = (q2x[q2x.size()-1]-q2x[0]) * (q2y[q2y.size()-1]-q2y[0]);
a3 = (q3x[q3x.size()-1]-q3x[0]) * (q3y[q3y.size()-1]-q3y[0]);
a4 = (q4x[q4x.size()-1]-q4x[0]) * (q4y[q4y.size()-1]-q4y[0]);
//find lowest x and y , highest x and y
cout << "Q1: (" << q1x[0] << "," << q1y[0] <<") ("<< q1x[q1x.size()-1] << "," << q1y[q1y.size()-1] << ") " << a1 << endl;
cout << "Q2: (" << q2x[0] << "," << q2y[0] <<") ("<< q2x[q2x.size()-1] << "," << q2y[q2y.size()-1] << ") " << a2 << endl;
cout << "Q3: (" << q3x[0] << "," << q3y[0] <<") ("<< q3x[q3x.size()-1] << "," << q3y[q3y.size()-1] << ") " << a3 << endl;
cout << "Q4: (" << q4x[0] << "," << q4y[0] <<") ("<< q4x[q4x.size()-1] << "," << q4y[q4y.size()-1] << ") " << a4 << endl;
} | # 2069548, 2024-11-02 10:57:45, xxxx-x--x- (0%)
#include <bits/stdc++.h>
using namespace std;
int main(){
vector<int> q1x,q2x,q3x,q4x;
vector<int> q1y,q2y,q3y,q4y;
int tempx,tempy;
int n;
cin >> n;
for(int i=0; i<n ; i++){
//x>0 -> q1,4
cin >> tempx ;
cin >> tempy ;
if(tempx > 0){
//y>0 -> q1
if(tempy>0){
q1x.push_back(tempx);
q1y.push_back(tempy);
}
//y<0 -> q4
if(tempy<0){
q4x.push_back(tempx);
q4y.push_back(tempy);
}
}
//x<0 -> q2,3
if(tempx < 0){
//y>0 -> q2
if(tempy>0){
q2x.push_back(tempx);
q2y.push_back(tempy);
}
//y<0 -> q3
if(tempy<0){
q3x.push_back(tempx);
q3y.push_back(tempy);
}
}
}
//find area
int a1,a2,a3,a4;
sort(q1x.begin(),q1x.end());
sort(q1y.begin(),q1y.end());
sort(q2x.begin(),q2x.end());
sort(q2y.begin(),q2y.end());
sort(q2x.begin(),q2x.end());
sort(q3y.begin(),q3y.end());
sort(q4x.begin(),q4x.end());
sort(q4y.begin(),q4y.end());
// highest x - lowest x * highest y - lowest y
a1 = (q1x[q1x.size()-1]-q1x[0]) * (q1y[q1y.size()-1]-q1y[0]);
a2 = (q2x[q2x.size()-1]-q2x[0]) * (q2y[q2y.size()-1]-q2y[0]);
a3 = (q3x[q3x.size()-1]-q3x[0]) * (q3y[q3y.size()-1]-q3y[0]);
a4 = (q4x[q4x.size()-1]-q4x[0]) * (q4y[q4y.size()-1]-q4y[0]);
//find lowest x and y , highest x and y
cout << "Q1: (" << q1x[0] << "," << q1y[0] <<") ("<< q1x[q1x.size()-1] << "," << q1y[q1y.size()-1] << ") " << a1 << endl;
cout << "Q2: (" << q2x[0] << "," << q2y[0] <<") ("<< q2x[q2x.size()-1] << "," << q2y[q2y.size()-1] << ") " << a2 << endl;
cout << "Q3: (" << q3x[0] << "," << q3y[0] <<") ("<< q3x[q3x.size()-1] << "," << q3y[q3y.size()-1] << ") " << a3 << endl;
cout << "Q4: (" << q4x[0] << "," << q4y[0] <<") ("<< q4x[q4x.size()-1] << "," << q4y[q4y.size()-1] << ") " << a4 << endl;
} | # 2069558, 2024-11-02 10:58:30, xxxx-x--x- (0%)
#include <bits/stdc++.h>
using namespace std;
int main(){
vector<int> q1x,q2x,q3x,q4x;
vector<int> q1y,q2y,q3y,q4y;
int tempx,tempy;
int n;
cin >> n;
for(int i=0; i<n ; i++){
//x>0 -> q1,4
cin >> tempx ;
cin >> tempy ;
if(tempx > 0){
//y>0 -> q1
if(tempy>0){
q1x.push_back(tempx);
q1y.push_back(tempy);
}
//y<0 -> q4
if(tempy<0){
q4x.push_back(tempx);
q4y.push_back(tempy);
}
}
//x<0 -> q2,3
if(tempx < 0){
//y>0 -> q2
if(tempy>0){
q2x.push_back(tempx);
q2y.push_back(tempy);
}
//y<0 -> q3
if(tempy<0){
q3x.push_back(tempx);
q3y.push_back(tempy);
}
}
}
//find area
int a1,a2,a3,a4;
sort(q1x.begin(),q1x.end());
sort(q1y.begin(),q1y.end());
sort(q2x.begin(),q2x.end());
sort(q2y.begin(),q2y.end());
sort(q3x.begin(),q3x.end());
sort(q3y.begin(),q3y.end());
sort(q4x.begin(),q4x.end());
sort(q4y.begin(),q4y.end());
// highest x - lowest x * highest y - lowest y
a1 = (q1x[q1x.size()-1]-q1x[0]) * (q1y[q1y.size()-1]-q1y[0]);
a2 = (q2x[q2x.size()-1]-q2x[0]) * (q2y[q2y.size()-1]-q2y[0]);
a3 = (q3x[q3x.size()-1]-q3x[0]) * (q3y[q3y.size()-1]-q3y[0]);
a4 = (q4x[q4x.size()-1]-q4x[0]) * (q4y[q4y.size()-1]-q4y[0]);
//find lowest x and y , highest x and y
cout << "Q1: (" << q1x[0] << "," << q1y[0] <<") ("<< q1x[q1x.size()-1] << "," << q1y[q1y.size()-1] << ") " << a1 << endl;
cout << "Q2: (" << q2x[0] << "," << q2y[0] <<") ("<< q2x[q2x.size()-1] << "," << q2y[q2y.size()-1] << ") " << a2 << endl;
cout << "Q3: (" << q3x[0] << "," << q3y[0] <<") ("<< q3x[q3x.size()-1] << "," << q3y[q3y.size()-1] << ") " << a3 << endl;
cout << "Q4: (" << q4x[0] << "," << q4y[0] <<") ("<< q4x[q4x.size()-1] << "," << q4y[q4y.size()-1] << ") " << a4 << endl;
} | # 2069597, 2024-11-02 11:02:32, xxxx-x--x- (0%)
#include <bits/stdc++.h>
using namespace std;
int main(){
vector<int> q1x,q2x,q3x,q4x;
vector<int> q1y,q2y,q3y,q4y;
int tempx,tempy;
int n;
cin >> n;
for(int i=0; i<n ; i++){
//x>0 -> q1,4
cin >> tempx ;
cin >> tempy ;
if(tempx > 0){
//y>0 -> q1
if(tempy>0){
q1x.push_back(tempx);
q1y.push_back(tempy);
}
//y<0 -> q4
if(tempy<0){
q4x.push_back(tempx);
q4y.push_back(tempy);
}
}
//x<0 -> q2,3
if(tempx < 0){
//y>0 -> q2
if(tempy>0){
q2x.push_back(tempx);
q2y.push_back(tempy);
}
//y<0 -> q3
if(tempy<0){
q3x.push_back(tempx);
q3y.push_back(tempy);
}
}
}
//find area
int a1,a2,a3,a4;
sort(q1x.begin(),q1x.end());
sort(q1y.begin(),q1y.end());
sort(q2x.begin(),q2x.end());
sort(q2y.begin(),q2y.end());
sort(q3x.begin(),q3x.end());
sort(q3y.begin(),q3y.end());
sort(q4x.begin(),q4x.end());
sort(q4y.begin(),q4y.end());
// highest x - lowest x * highest y - lowest y
a1 = (q1x[q1x.size()-1]-q1x[0]) * (q1y[q1y.size()-1]-q1y[0]);
a2 = (q2x[q2x.size()-1]-q2x[0]) * (q2y[q2y.size()-1]-q2y[0]);
a3 = (q3x[q3x.size()-1]-q3x[0]) * (q3y[q3y.size()-1]-q3y[0]);
a4 = (q4x[q4x.size()-1]-q4x[0]) * (q4y[q4y.size()-1]-q4y[0]);
//find lowest x and y , highest x and y
if(!q1x.empty()) cout << "Q1: (" << q1x[0] << "," << q1y[0] <<") ("<< q1x[q1x.size()-1] << "," << q1y[q1y.size()-1] << ") " << a1 << endl;
if(!q2x.empty())cout << "Q2: (" << q2x[0] << "," << q2y[0] <<") ("<< q2x[q2x.size()-1] << "," << q2y[q2y.size()-1] << ") " << a2 << endl;
if(!q3x.empty())cout << "Q3: (" << q3x[0] << "," << q3y[0] <<") ("<< q3x[q3x.size()-1] << "," << q3y[q3y.size()-1] << ") " << a3 << endl;
if(!q4x.empty())cout << "Q4: (" << q4x[0] << "," << q4y[0] <<") ("<< q4x[q4x.size()-1] << "," << q4y[q4y.size()-1] << ") " << a4 << endl;
if(q1x.empty()&&q2x.empty()&&q3x.empty()&&q4x.empty()) cout << "No point in any quadrant" << endl;
} | # 2069618, 2024-11-02 11:04:28, xxxxPxPPxP (40%)
#include <bits/stdc++.h>
using namespace std;
int main(){
vector<int> q1x,q2x,q3x,q4x;
vector<int> q1y,q2y,q3y,q4y;
int tempx,tempy;
int n;
cin >> n;
for(int i=0; i<n ; i++){
//x>0 -> q1,4
cin >> tempx ;
cin >> tempy ;
if(tempx > 0){
//y>0 -> q1
if(tempy>0){
q1x.push_back(tempx);
q1y.push_back(tempy);
}
//y<0 -> q4
if(tempy<0){
q4x.push_back(tempx);
q4y.push_back(tempy);
}
}
//x<0 -> q2,3
if(tempx < 0){
//y>0 -> q2
if(tempy>0){
q2x.push_back(tempx);
q2y.push_back(tempy);
}
//y<0 -> q3
if(tempy<0){
q3x.push_back(tempx);
q3y.push_back(tempy);
}
}
}
//find area
int a1,a2,a3,a4;
sort(q1x.begin(),q1x.end());
sort(q1y.begin(),q1y.end());
sort(q2x.begin(),q2x.end());
sort(q2y.begin(),q2y.end());
sort(q3x.begin(),q3x.end());
sort(q3y.begin(),q3y.end());
sort(q4x.begin(),q4x.end());
sort(q4y.begin(),q4y.end());
// highest x - lowest x * highest y - lowest y
a1 = (q1x[q1x.size()-1]-q1x[0]) * (q1y[q1y.size()-1]-q1y[0]);
a2 = (q2x[q2x.size()-1]-q2x[0]) * (q2y[q2y.size()-1]-q2y[0]);
a3 = (q3x[q3x.size()-1]-q3x[0]) * (q3y[q3y.size()-1]-q3y[0]);
a4 = (q4x[q4x.size()-1]-q4x[0]) * (q4y[q4y.size()-1]-q4y[0]);
//find lowest x and y , highest x and y
if(!q1x.empty()) cout << "Q1: (" << q1x[0] << ", " << q1y[0] <<") ("<< q1x[q1x.size()-1] << ", " << q1y[q1y.size()-1] << ") " << a1 << endl;
if(!q2x.empty())cout << "Q2: (" << q2x[0] << ", " << q2y[0] <<") ("<< q2x[q2x.size()-1] << ", " << q2y[q2y.size()-1] << ") " << a2 << endl;
if(!q3x.empty())cout << "Q3: (" << q3x[0] << ", " << q3y[0] <<") ("<< q3x[q3x.size()-1] << ", " << q3y[q3y.size()-1] << ") " << a3 << endl;
if(!q4x.empty())cout << "Q4: (" << q4x[0] << ", " << q4y[0] <<") ("<< q4x[q4x.size()-1] << ", " << q4y[q4y.size()-1] << ") " << a4 << endl;
if(q1x.empty()&&q2x.empty()&&q3x.empty()&&q4x.empty()) cout << "No point in any quadrant" << endl;
} | # 2069683, 2024-11-02 11:13:10, PPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std;
int main(){
vector<int> q1x,q2x,q3x,q4x;
vector<int> q1y,q2y,q3y,q4y;
int tempx,tempy;
int n;
cin >> n;
for(int i=0; i<n ; i++){
//x>0 -> q1,4
cin >> tempx ;
cin >> tempy ;
if(tempx > 0){
//y>0 -> q1
if(tempy>0){
q1x.push_back(tempx);
q1y.push_back(tempy);
}
//y<0 -> q4
if(tempy<0){
q4x.push_back(tempx);
q4y.push_back(tempy);
}
}
//x<0 -> q2,3
if(tempx < 0){
//y>0 -> q2
if(tempy>0){
q2x.push_back(tempx);
q2y.push_back(tempy);
}
//y<0 -> q3
if(tempy<0){
q3x.push_back(tempx);
q3y.push_back(tempy);
}
}
}
//find area
int a1,a2,a3,a4;
sort(q1x.begin(),q1x.end());
sort(q1y.begin(),q1y.end());
sort(q2x.begin(),q2x.end());
sort(q2y.begin(),q2y.end());
sort(q3x.begin(),q3x.end());
sort(q3y.begin(),q3y.end());
sort(q4x.begin(),q4x.end());
sort(q4y.begin(),q4y.end());
// highest x - lowest x * highest y - lowest y
if(!q1x.empty()) a1 = (q1x[q1x.size()-1]-q1x[0]) * (q1y[q1y.size()-1]-q1y[0]);
if(!q2x.empty()) a2 = (q2x[q2x.size()-1]-q2x[0]) * (q2y[q2y.size()-1]-q2y[0]);
if(!q3x.empty()) a3 = (q3x[q3x.size()-1]-q3x[0]) * (q3y[q3y.size()-1]-q3y[0]);
if(!q4x.empty()) a4 = (q4x[q4x.size()-1]-q4x[0]) * (q4y[q4y.size()-1]-q4y[0]);
//find lowest x and y , highest x and y
if(!q1x.empty()) cout << "Q1: (" << q1x[0] << ", " << q1y[0] <<") ("<< q1x[q1x.size()-1] << ", " << q1y[q1y.size()-1] << ") " << a1 << endl;
if(!q2x.empty())cout << "Q2: (" << q2x[0] << ", " << q2y[0] <<") ("<< q2x[q2x.size()-1] << ", " << q2y[q2y.size()-1] << ") " << a2 << endl;
if(!q3x.empty())cout << "Q3: (" << q3x[0] << ", " << q3y[0] <<") ("<< q3x[q3x.size()-1] << ", " << q3y[q3y.size()-1] << ") " << a3 << endl;
if(!q4x.empty())cout << "Q4: (" << q4x[0] << ", " << q4y[0] <<") ("<< q4x[q4x.size()-1] << ", " << q4y[q4y.size()-1] << ") " << a4 << endl;
if(q1x.empty()&&q2x.empty()&&q3x.empty()&&q4x.empty()) cout << "No point in any quadrant" << endl;
} |
# 2068894, 2024-11-02 09:51:27, -----P---- (10%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n; cin>>n;
map<int,vector<pair<int,int>>> Q;
Q[1]= vector<pair<int,int>>();
Q[2]= vector<pair<int,int>>();
Q[3]= vector<pair<int,int>>();
Q[4]= vector<pair<int,int>>();
while(n--){
int x,y;cin>>x>>y;
if((x>0)&&(y>0)) Q[1].push_back({x,y});
else if((x<0)&&(y>0)) Q[2].push_back({x,y});
else if((x<0)&&(y<0)) Q[3].push_back({x,y});
else if((x>0)&&(y<0)) Q[4].push_back({x,y});
}
int k=0;
for(auto y:Q){
if(y.second.empty()) {k++;continue;}
int Xmx=-1000,Xmn=1000;
int Ymx=-1000,Ymn=1000;
cout<<"Q"<<y.first<<":";
for(auto p:y.second){
cout<<" ("<<p.first<<", "<<p.second<<")";
if(p.first>=Xmx) Xmx=p.first;
if(p.first<=Xmn) Xmn=p.first;
if(p.second>=Ymx) Ymx=p.second;
if(p.second<=Ymn) Ymn=p.second;
}
cout<<" "<<(Xmx-Xmn)*(Ymx-Ymn)<<endl;
}if(k==4){cout<<"No point in any quadrant"; }
} | # 2069051, 2024-11-02 10:07:25, ----PP---- (20%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n; cin>>n;
map<int,vector<pair<int,int>>> Q;
Q[1]= vector<pair<int,int>>();
Q[2]= vector<pair<int,int>>();
Q[3]= vector<pair<int,int>>();
Q[4]= vector<pair<int,int>>();
while(n--){
int x,y;cin>>x>>y;
if((x>0)&&(y>0)) Q[1].push_back({x,y});
else if((x<0)&&(y>0)) Q[2].push_back({x,y});
else if((x<0)&&(y<0)) Q[3].push_back({x,y});
else if((x>0)&&(y<0)) Q[4].push_back({x,y});
}
vector<int> A;
map<int,vector<pair<int,int>>> ans;
ans[1]= vector<pair<int,int>>();
ans[2]= vector<pair<int,int>>();
ans[3]= vector<pair<int,int>>();
ans[4]= vector<pair<int,int>>();
for(auto y:Q){
if(y.second.empty()) continue;
int Xmx=-1000,Xmn=1000;
int Ymx=-1000,Ymn=1000;
//cout<<"Q"<<y.first<<":";
for(auto p:y.second){
//cout<<" ("<<p.first<<", "<<p.second<<")";
if(p.first>=Xmx) Xmx=p.first;
if(p.first<=Xmn) Xmn=p.first;
if(p.second>=Ymx) Ymx=p.second;
if(p.second<=Ymn) Ymn=p.second;
}
//cout<<" "<<(Xmx-Xmn)*(Ymx-Ymn)<<endl;
A.push_back((Xmx-Xmn)*(Ymx-Ymn));
ans[y.first].push_back({Xmx,Ymx});
ans[y.first].push_back({Xmn,Ymn});
}
int k=0;
int h=0;
for(auto j:ans){
if(j.second.empty()) {k++;continue;}
cout<<"Q"<<j.first<<":";
for(auto p:j.second){
cout<<" ("<<p.first<<", "<<p.second<<")";
}
cout<<" "<<A[h]<<endl;
h++;
}
if(k==4){cout<<"No point in any quadrant"; }
} | # 2069088, 2024-11-02 10:10:49, PPPP-PP-PP (80%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n; cin>>n;
map<int,vector<pair<int,int>>> Q;
Q[1]= vector<pair<int,int>>();
Q[2]= vector<pair<int,int>>();
Q[3]= vector<pair<int,int>>();
Q[4]= vector<pair<int,int>>();
while(n--){
int x,y;cin>>x>>y;
if((x>0)&&(y>0)) Q[1].push_back({x,y});
else if((x<0)&&(y>0)) Q[2].push_back({x,y});
else if((x<0)&&(y<0)) Q[3].push_back({x,y});
else if((x>0)&&(y<0)) Q[4].push_back({x,y});
}
vector<int> A;
map<int,set<pair<int,int>>> ans;
ans[1]= set<pair<int,int>>();
ans[2]= set<pair<int,int>>();
ans[3]= set<pair<int,int>>();
ans[4]= set<pair<int,int>>();
for(auto y:Q){
if(y.second.empty()) continue;
int Xmx=-1000,Xmn=1000;
int Ymx=-1000,Ymn=1000;
//cout<<"Q"<<y.first<<":";
for(auto p:y.second){
//cout<<" ("<<p.first<<", "<<p.second<<")";
if(p.first>=Xmx) Xmx=p.first;
if(p.first<=Xmn) Xmn=p.first;
if(p.second>=Ymx) Ymx=p.second;
if(p.second<=Ymn) Ymn=p.second;
}
//cout<<" "<<(Xmx-Xmn)*(Ymx-Ymn)<<endl;
A.push_back((Xmx-Xmn)*(Ymx-Ymn));
ans[y.first].insert({Xmx,Ymx});
ans[y.first].insert({Xmn,Ymn});
}
int k=0;
int h=0;
for(auto j:ans){
if(j.second.empty()) {k++;continue;}
cout<<"Q"<<j.first<<":";
for(auto p:j.second){
cout<<" ("<<p.first<<", "<<p.second<<")";
}
cout<<" "<<A[h]<<endl;
h++;
}
if(k==4){cout<<"No point in any quadrant"; }
} | # 2069900, 2024-11-02 11:34:53, PPPP-PP-PP (80%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n; cin>>n;
map<int,vector<pair<int,int>>> Q;
Q[1]= vector<pair<int,int>>();
Q[2]= vector<pair<int,int>>();
Q[3]= vector<pair<int,int>>();
Q[4]= vector<pair<int,int>>();
while(n--){
int x,y;cin>>x>>y;
if((x>0)&&(y>0)) Q[1].push_back({x,y});
else if((x<0)&&(y>0)) Q[2].push_back({x,y});
else if((x<0)&&(y<0)) Q[3].push_back({x,y});
else if((x>0)&&(y<0)) Q[4].push_back({x,y});
}
vector<int> A;
map<int,set<pair<int,int>>> ans;
ans[1]= set<pair<int,int>>();
ans[2]= set<pair<int,int>>();
ans[3]= set<pair<int,int>>();
ans[4]= set<pair<int,int>>();
for(auto y:Q){
if(y.second.empty()) continue;
int Xmx=-100000000,Xmn=100000000;
int Ymx=-100000000,Ymn=100000000;
//cout<<"Q"<<y.first<<":";
for(auto p:y.second){
//cout<<" ("<<p.first<<", "<<p.second<<")";
if(p.first>=Xmx) Xmx=p.first;
if(p.first<=Xmn) Xmn=p.first;
if(p.second>=Ymx) Ymx=p.second;
if(p.second<=Ymn) Ymn=p.second;
}
//cout<<" "<<(Xmx-Xmn)*(Ymx-Ymn)<<endl;
A.push_back((Xmx-Xmn)*(Ymx-Ymn));
ans[y.first].insert({Xmx,Ymx});
ans[y.first].insert({Xmn,Ymn});
}
int k=0;
int h=0;
for(auto j:ans){
if(j.second.empty()) {k++;continue;}
cout<<"Q"<<j.first<<":";
for(auto p:j.second){
cout<<" ("<<p.first<<", "<<p.second<<")";
}
cout<<" "<<A[h]<<endl;
h++;
}
if(k==4){cout<<"No point in any quadrant"; }
} | # 2069905, 2024-11-02 11:35:43, PPPP-PP-PP (80%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n; cin>>n;
map<int,vector<pair<int,int>>> Q;
Q[1]= vector<pair<int,int>>();
Q[2]= vector<pair<int,int>>();
Q[3]= vector<pair<int,int>>();
Q[4]= vector<pair<int,int>>();
while(n--){
int x,y;cin>>x>>y;
if((x>0)&&(y>0)) Q[1].push_back({x,y});
else if((x<0)&&(y>0)) Q[2].push_back({x,y});
else if((x<0)&&(y<0)) Q[3].push_back({x,y});
else if((x>0)&&(y<0)) Q[4].push_back({x,y});
}
vector<int> A;
map<int,set<pair<int,int>>> ans;
ans[1]= set<pair<int,int>>();
ans[2]= set<pair<int,int>>();
ans[3]= set<pair<int,int>>();
ans[4]= set<pair<int,int>>();
for(auto y:Q){
if(y.second.empty()) continue;
int Xmx=-100000000,Xmn=100000000;
int Ymx=-100000000,Ymn=100000000;
//cout<<"Q"<<y.first<<":";
for(auto p:y.second){
//cout<<" ("<<p.first<<", "<<p.second<<")";
if(p.first>=Xmx) Xmx=p.first;
if(p.first<=Xmn) Xmn=p.first;
if(p.second>=Ymx) Ymx=p.second;
if(p.second<=Ymn) Ymn=p.second;
}
//cout<<" "<<(Xmx-Xmn)*(Ymx-Ymn)<<endl;
A.push_back((Xmx-Xmn)*(Ymx-Ymn));
ans[y.first].insert({Xmx,Ymx});
ans[y.first].insert({Xmn,Ymn});
}
int k=0;
int h=0;
for(auto j:ans){
if(j.second.empty()) {k++;continue;}
cout<<"Q"<<j.first<<":";
for(auto p:j.second){
cout<<" ("<<p.first<<", "<<p.second<<")";
}
cout<<" "<<A[h]<<endl;
h++;
}
if(k==4){cout<<"No point in any quadrant"<<endl; }
} | # 2069948, 2024-11-02 11:39:38, PPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n; cin>>n;
map<int,vector<pair<int,int>>> Q;
Q[1]= vector<pair<int,int>>();
Q[2]= vector<pair<int,int>>();
Q[3]= vector<pair<int,int>>();
Q[4]= vector<pair<int,int>>();
while(n--){
int x,y;cin>>x>>y;
if((x>0)&&(y>0)) Q[1].push_back({x,y});
else if((x<0)&&(y>0)) Q[2].push_back({x,y});
else if((x<0)&&(y<0)) Q[3].push_back({x,y});
else if((x>0)&&(y<0)) Q[4].push_back({x,y});
}
vector<int> A;
map<int,set<pair<int,int>>> ans;
ans[1]= set<pair<int,int>>();
ans[2]= set<pair<int,int>>();
ans[3]= set<pair<int,int>>();
ans[4]= set<pair<int,int>>();
for(auto y:Q){
if(y.second.empty()) continue;
int Xmx=-100000000,Xmn=100000000;
int Ymx=-100000000,Ymn=100000000;
//cout<<"Q"<<y.first<<":";
for(auto p:y.second){
//cout<<" ("<<p.first<<", "<<p.second<<")";
if(p.first>=Xmx) Xmx=p.first;
if(p.first<=Xmn) Xmn=p.first;
if(p.second>=Ymx) Ymx=p.second;
if(p.second<=Ymn) Ymn=p.second;
}
//cout<<" "<<(Xmx-Xmn)*(Ymx-Ymn)<<endl;
A.push_back((Xmx-Xmn)*(Ymx-Ymn));
ans[y.first].insert({Xmx,Ymx});
ans[y.first].insert({Xmn,Ymn});
}
int k=0;
int h=0;
for(auto j:ans){
if(j.second.empty()) {k++;continue;}
cout<<"Q"<<j.first<<":";
int t=0;
for(auto p:j.second){
cout<<" ("<<p.first<<", "<<p.second<<")";
t++;
}
if(t==1){
for(auto p:j.second) cout<<" ("<<p.first<<", "<<p.second<<")";
}
cout<<" "<<A[h]<<endl;
h++;
}
if(k==4){cout<<"No point in any quadrant"<<endl; }
} |
# 2069739, 2024-11-02 11:20:37, -----P---- (10%)
#include <iostream>
#include <vector>
#include <utility>
using namespace std;
int main(){
long long n , a, b;
vector<pair<long long , long long>> Q1 ,Q2 ,Q3, Q4;
cin >> n;
for(int i =0;i<n;++i){
std::cin >> a >> b ;
if(a==0||b==0){
continue;
}
else if(a>0 & b>0){
Q1.push_back(make_pair(a,b));
}
else if(a<0 & b>0){
Q2.push_back(make_pair(a,b));
}
else if(a<0 & b<0){
Q3.push_back(make_pair(a,b));
}
else if(a>0 & b<0){
Q4.push_back(make_pair(a,b));
}
}
if(!Q1.empty()){
}
if(!Q2.empty()){
}
if(!Q3.empty()){
}
if(!Q4.empty()){
}
if(Q4.empty() & Q3.empty() & Q2.empty() &Q1.empty())
{
std::cout << "No point in any quadrant" ;
}
} | # 2069951, 2024-11-02 11:39:49, -----P---- (10%)
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
using namespace std;
long long max(vector<long long> Q){
sort(Q.begin(),Q.end());
return (Q[0]);
}
long long min(vector<long long> Q){
sort(Q.begin(),Q.end());
return (Q[Q.size()-1]);
}
int main(){
long long n , a, b;
vector<long long> Q1 ,Q2 ,Q3, Q4,rQ1 ,rQ2 ,rQ3, rQ4;
cin >> n;
for(int i =0;i<n;++i){
std::cin >> a >> b ;
if(a==0||b==0){
continue;
}
else if(a>0 & b>0){
Q1.push_back(a);
rQ1.push_back(b);
}
else if(a<0 & b>0){
Q2.push_back(a);
rQ2.push_back(b);
}
else if(a<0 & b<0){
Q3.push_back(a);
rQ3.push_back(b);
}
else if(a>0 & b<0){
Q4.push_back(a);
rQ4.push_back(b);
}
}
long long xmax,xmin,ymax,ymin,s;
if(!Q1.empty()){
xmax=max(Q1);
xmin=min(Q1);
ymax=max(rQ1);
ymin=min(rQ1);
s=(xmin-xmax)*(ymin-ymax);
std::cout << "Q1: (" << xmin <<", "<<ymin <<") (" <<xmax<<", "<<ymax<<") " << s<<endl ;
}
if(!Q2.empty()){
xmax=max(Q2);
xmin=min(Q2);
ymax=max(rQ2);
ymin=min(rQ2);
s=(xmin-xmax)*(ymin-ymax);
std::cout << "Q2: (" << xmin <<", "<<ymin <<") (" <<xmax<<", "<<ymax<<") " << s<<endl ;
}
if(!Q3.empty()){
xmax=max(Q3);
xmin=min(Q3);
ymax=max(rQ3);
ymin=min(rQ3);
s=(xmin-xmax)*(ymin-ymax);
std::cout << "Q3: (" << xmin <<", "<<ymin <<") (" <<xmax<<", "<<ymax<<") " << s<<endl ;
}
if(!Q4.empty()){
xmax=max(Q4);
xmin=min(Q4);
ymax=max(rQ4);
ymin=min(rQ4);
s=(xmin-xmax)*(ymin-ymax);
std::cout << "Q1: (" << xmin <<", "<<ymin <<") (" <<xmax<<", "<<ymax<<") " << s<<endl ;
}
if(Q4.empty() & Q3.empty() & Q2.empty() &Q1.empty())
{
std::cout << "No point in any quadrant" ;
}
} | # 2069957, 2024-11-02 11:40:04, -----P---- (10%)
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
using namespace std;
long long max(vector<long long> Q){
sort(Q.begin(),Q.end());
return (Q[0]);
}
long long min(vector<long long> Q){
sort(Q.begin(),Q.end());
return (Q[Q.size()-1]);
}
int main(){
long long n , a, b;
vector<long long> Q1 ,Q2 ,Q3, Q4,rQ1 ,rQ2 ,rQ3, rQ4;
cin >> n;
for(int i =0;i<n;++i){
std::cin >> a >> b ;
if(a==0||b==0){
continue;
}
else if(a>0 & b>0){
Q1.push_back(a);
rQ1.push_back(b);
}
else if(a<0 & b>0){
Q2.push_back(a);
rQ2.push_back(b);
}
else if(a<0 & b<0){
Q3.push_back(a);
rQ3.push_back(b);
}
else if(a>0 & b<0){
Q4.push_back(a);
rQ4.push_back(b);
}
}
long long xmax,xmin,ymax,ymin,s;
if(!Q1.empty()){
xmax=max(Q1);
xmin=min(Q1);
ymax=max(rQ1);
ymin=min(rQ1);
s=(xmin-xmax)*(ymin-ymax);
std::cout << "Q1: (" << xmin <<", "<<ymin <<") (" <<xmax<<", "<<ymax<<") " << s<<endl ;
}
if(!Q2.empty()){
xmax=max(Q2);
xmin=min(Q2);
ymax=max(rQ2);
ymin=min(rQ2);
s=(xmin-xmax)*(ymin-ymax);
std::cout << "Q2: (" << xmin <<", "<<ymin <<") (" <<xmax<<", "<<ymax<<") " << s<<endl ;
}
if(!Q3.empty()){
xmax=max(Q3);
xmin=min(Q3);
ymax=max(rQ3);
ymin=min(rQ3);
s=(xmin-xmax)*(ymin-ymax);
std::cout << "Q3: (" << xmin <<", "<<ymin <<") (" <<xmax<<", "<<ymax<<") " << s<<endl ;
}
if(!Q4.empty()){
xmax=max(Q4);
xmin=min(Q4);
ymax=max(rQ4);
ymin=min(rQ4);
s=(xmin-xmax)*(ymin-ymax);
std::cout << "Q1: (" << xmin <<", "<<ymin <<") (" <<xmax<<", "<<ymax<<") " << s<<endl ;
}
if(Q4.empty() & Q3.empty() & Q2.empty() &Q1.empty())
{
std::cout << "No point in any quadrant" ;
}
} | # 2069997, 2024-11-02 11:43:51, PPPP-P---- (50%)
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
using namespace std;
long long max(vector<long long> Q){
sort(Q.begin(),Q.end());
return (Q[0]);
}
long long min(vector<long long> Q){
sort(Q.begin(),Q.end());
return (Q[Q.size()-1]);
}
int main(){
long long n , a, b;
vector<long long> Q1 ,Q2 ,Q3, Q4,rQ1 ,rQ2 ,rQ3, rQ4;
cin >> n;
for(int i =0;i<n;++i){
std::cin >> a >> b ;
if(a==0||b==0){
continue;
}
else if(a>0 & b>0){
Q1.push_back(a);
rQ1.push_back(b);
}
else if(a<0 & b>0){
Q2.push_back(a);
rQ2.push_back(b);
}
else if(a<0 & b<0){
Q3.push_back(a);
rQ3.push_back(b);
}
else if(a>0 & b<0){
Q4.push_back(a);
rQ4.push_back(b);
}
}
long long xmax,xmin,ymax,ymin,s;
if(!Q1.empty()){
xmax=max(Q1);
xmin=min(Q1);
ymax=max(rQ1);
ymin=min(rQ1);
s=(xmin-xmax)*(ymin-ymax);
std::cout << "Q1: (" << xmax <<", "<<ymax <<") (" <<xmin<<", "<<ymin<<") " << s<<endl ;
}
if(!Q2.empty()){
xmax=max(Q2);
xmin=min(Q2);
ymax=max(rQ2);
ymin=min(rQ2);
s=(xmin-xmax)*(ymin-ymax);
std::cout << "Q2: (" << xmax <<", "<<ymax <<") (" <<xmin<<", "<<ymin<<") " << s<<endl ;
}
if(!Q3.empty()){
xmax=max(Q3);
xmin=min(Q3);
ymax=max(rQ3);
ymin=min(rQ3);
s=(xmin-xmax)*(ymin-ymax);
std::cout << "Q3: (" << xmax <<", "<<ymax <<") (" <<xmin<<", "<<ymin<<") " << s<<endl ;
}
if(!Q4.empty()){
xmax=max(Q4);
xmin=min(Q4);
ymax=max(rQ4);
ymin=min(rQ4);
s=(xmin-xmax)*(ymin-ymax);
std::cout << "Q1: (" << xmax <<", "<<ymax <<") (" <<xmin<<", "<<ymin<<") " << s<<endl ;
}
if(Q4.empty() & Q3.empty() & Q2.empty() &Q1.empty())
{
std::cout << "No point in any quadrant" ;
}
} | # 2070016, 2024-11-02 11:44:54, PPPPPPPPPP (100%)
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
using namespace std;
long long max(vector<long long> Q){
sort(Q.begin(),Q.end());
return (Q[0]);
}
long long min(vector<long long> Q){
sort(Q.begin(),Q.end());
return (Q[Q.size()-1]);
}
int main(){
long long n , a, b;
vector<long long> Q1 ,Q2 ,Q3, Q4,rQ1 ,rQ2 ,rQ3, rQ4;
cin >> n;
for(int i =0;i<n;++i){
std::cin >> a >> b ;
if(a==0||b==0){
continue;
}
else if(a>0 & b>0){
Q1.push_back(a);
rQ1.push_back(b);
}
else if(a<0 & b>0){
Q2.push_back(a);
rQ2.push_back(b);
}
else if(a<0 & b<0){
Q3.push_back(a);
rQ3.push_back(b);
}
else if(a>0 & b<0){
Q4.push_back(a);
rQ4.push_back(b);
}
}
long long xmax,xmin,ymax,ymin,s;
if(!Q1.empty()){
xmax=max(Q1);
xmin=min(Q1);
ymax=max(rQ1);
ymin=min(rQ1);
s=(xmin-xmax)*(ymin-ymax);
std::cout << "Q1: (" << xmax <<", "<<ymax <<") (" <<xmin<<", "<<ymin<<") " << s<<endl ;
}
if(!Q2.empty()){
xmax=max(Q2);
xmin=min(Q2);
ymax=max(rQ2);
ymin=min(rQ2);
s=(xmin-xmax)*(ymin-ymax);
std::cout << "Q2: (" << xmax <<", "<<ymax <<") (" <<xmin<<", "<<ymin<<") " << s<<endl ;
}
if(!Q3.empty()){
xmax=max(Q3);
xmin=min(Q3);
ymax=max(rQ3);
ymin=min(rQ3);
s=(xmin-xmax)*(ymin-ymax);
std::cout << "Q3: (" << xmax <<", "<<ymax <<") (" <<xmin<<", "<<ymin<<") " << s<<endl ;
}
if(!Q4.empty()){
xmax=max(Q4);
xmin=min(Q4);
ymax=max(rQ4);
ymin=min(rQ4);
s=(xmin-xmax)*(ymin-ymax);
std::cout << "Q4: (" << xmax <<", "<<ymax <<") (" <<xmin<<", "<<ymin<<") " << s<<endl ;
}
if(Q4.empty() & Q3.empty() & Q2.empty() &Q1.empty())
{
std::cout << "No point in any quadrant" ;
}
} |
# 2071362, 2024-11-02 14:27:20, Compilation error (0%)
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n, cq1 = 0, cq2 = 0, cq3 = 0, cq4 = 0;
cin >> n;
pair<int, int> xy[n];
pair<int, int> Q1[n];
pair<int, int> Q2[n];
pair<int, int> Q3[n];
pair<int, int> Q4[n];
for (int i = 0; i < n; ++i)
{
cin >> xy[i].first >> xy[i].second;
if (xy[i].first > 0 && xy[i].second > 0)
{
Q1[cq1] = xy[i];
cq1++;
}
else if (xy[i].first < 0 && xy[i].second > 0)
{
Q2[cq2] = xy[i];
cq2++;
}
else if (xy[i].first < 0 && xy[i].second < 0)
{
Q3[cq3] = xy[i];
cq3++;
}
else if (xy[i].first > 0 && xy[i].second < 0)
{
Q4[cq4] = xy[i];
cq4++;
}
}
int Q1xmax = 0, Q1ymax = 0, Q1xmin = INT_MAX, Q1ymin = INT_MAX;
for (int i = 0; i < cq1 + 1; ++i)
{
if (Q1[i].first > Q1xmax)
Q1xmax = Q1[i].first;
if (Q1[i].first < Q1xmin)
Q1xmin = Q1[i].first;
if (Q1[i].second > Q1ymax)
Q1ymax = Q1[i].second;
if (Q1[i].second < Q1ymin)
Q1ymin = Q1[i].second;
}
int Q1Area = (Q1ymax - Q1ymin) * (Q1xmax - Q1xmin);
cout << "Q1:"
<< " (" << Q1xmin << ", " << Q1ymin << ") (" << Q1xmax << " ," << Q1ymax << " " << Q1Area;
int Q1xmax = 0, Q1ymax = 0, Q1xmin = INT_MAX, Q1ymin = INT_MAX;
for (int i = 0; i < cq1 + 1; ++i)
{
if (Q1[i].first > Q1xmax)
Q1xmax = Q1[i].first;
if (Q1[i].first < Q1xmin)
Q1xmin = Q1[i].first;
if (Q1[i].second > Q1ymax)
Q1ymax = Q1[i].second;
if (Q1[i].second < Q1ymin)
Q1ymin = Q1[i].second;
}
int Q1Area = (Q1ymax - Q1ymin) * (Q1xmax - Q1xmin);
cout << "Q2:"
<< " (" << Q1xmin << ", " << Q1ymin << ") (" << Q1xmax << " ," << Q1ymax << " " << Q1Area;
int Q1xmax=0,Q1ymax=0,Q1xmin=INT_MAX,Q1ymin=INT_MAX;
for(int i=0;i<cq1+1;++i){
if(Q1[i].first>Q1xmax)Q1xmax=Q1[i].first;
if(Q1[i].first<Q1xmin)Q1xmin=Q1[i].first;
if(Q1[i].second>Q1ymax)Q1ymax=Q1[i].second;
if(Q1[i].second<Q1ymin)Q1ymin=Q1[i].second;
}
int Q1Area = (Q1ymax - Q1ymin) * (Q1xmax-Q1xmin);
cout<<"Q3:"<<" ("<<Q1xmin<<", "<<Q1ymin<<") ("<<Q1xmax<<" ,"<<Q1ymax<<" "<< Q1Area;
int Q1xmax=0,Q1ymax=0,Q1xmin=INT_MAX,Q1ymin=INT_MAX;
for(int i=0;i<cq1+1;++i){
if(Q1[i].first>Q1xmax)Q1xmax=Q1[i].first;
if(Q1[i].first<Q1xmin)Q1xmin=Q1[i].first;
if(Q1[i].second>Q1ymax)Q1ymax=Q1[i].second;
if(Q1[i].second<Q1ymin)Q1ymin=Q1[i].second;
}
int Q1Area = (Q1ymax - Q1ymin) * (Q1xmax-Q1xmin);
cout<<"Q4:"<<" ("<<Q1xmin<<", "<<Q1ymin<<") ("<<Q1xmax<<" ,"<<Q1ymax<<" "<< Q1Area;
} | # 2071510, 2024-11-02 14:43:29, ---------- (0%)
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n, cq1 = 0, cq2 = 0, cq3 = 0, cq4 = 0;
cin >> n;
pair<int, int> xy[n];
pair<int, int> Q1[n];
pair<int, int> Q2[n];
pair<int, int> Q3[n];
pair<int, int> Q4[n];
for (int i = 0; i < n; ++i)
{
cin >> xy[i].first >> xy[i].second;
if(xy[i].first==0||xy[i].second==0){
continue;
}
if (xy[i].first > 0 && xy[i].second > 0)
{
Q1[cq1] = xy[i];
cq1++;
}
else if (xy[i].first < 0 && xy[i].second > 0)
{
Q2[cq2] = xy[i];
cq2++;
}
else if (xy[i].first < 0 && xy[i].second < 0)
{
Q3[cq3] = xy[i];
cq3++;
}
else if (xy[i].first > 0 && xy[i].second < 0)
{
Q4[cq4] = xy[i];
cq4++;
}
}
if(cq1 == 0&&cq2 == 0&&cq3 == 0&& cq4 == 0){
cout<<"No point in any quadrant";
}
int Q1xmax = 0, Q1ymax = 0, Q1xmin = INT_MAX, Q1ymin = INT_MAX;
for (int i = 0; i < cq1; ++i)
{
if (Q1[i].first > Q1xmax)
Q1xmax = Q1[i].first;
if (Q1[i].first < Q1xmin)
Q1xmin = Q1[i].first;
if (Q1[i].second > Q1ymax)
Q1ymax = Q1[i].second;
if (Q1[i].second < Q1ymin)
Q1ymin = Q1[i].second;
}
int Q1Area = (Q1ymax - Q1ymin) * (Q1xmax - Q1xmin);
cout << "Q1:"
<< " (" << Q1xmin << ", " << Q1ymin << ") (" << Q1xmax << " ," << Q1ymax << ") " << Q1Area << endl;
int Q2xmax = 0, Q2ymax = 0, Q2xmin = INT_MAX, Q2ymin = INT_MAX;
for (int i = 0; i < cq2; ++i)
{
if (Q2[i].first > Q2xmax)
Q2xmax = Q2[i].first;
if (Q2[i].first < Q2xmin)
Q2xmin = Q2[i].first;
if (Q2[i].second > Q2ymax)
Q2ymax = Q2[i].second;
if (Q2[i].second < Q2ymin)
Q2ymin = Q2[i].second;
}
int Q2Area = (Q2ymax - Q2ymin) * (Q2xmax - Q2xmin);
cout << "Q2:"
<< " (" << Q2xmin << ", " << Q2ymin << ") (" << Q2xmax << " ," << Q2ymax << ") " << Q2Area << endl;
int Q3xmax = 0, Q3ymax = 0, Q3xmin = INT_MAX, Q3ymin = INT_MAX;
for (int i = 0; i < cq3; ++i)
{
if (Q3[i].first > Q3xmax)
Q3xmax = Q3[i].first;
if (Q3[i].first < Q3xmin)
Q3xmin = Q3[i].first;
if (Q3[i].second > Q3ymax)
Q3ymax = Q3[i].second;
if (Q3[i].second < Q3ymin)
Q3ymin = Q3[i].second;
}
int Q3Area = (Q3ymax - Q3ymin) * (Q3xmax - Q3xmin);
cout << "Q3:"
<< " (" << Q3xmin << ", " << Q3ymin << ") (" << Q3xmax << " ," << Q3ymax << ") " << Q3Area << endl;
int Q4xmax = 0, Q4ymax = 0, Q4xmin = INT_MAX, Q4ymin = INT_MAX;
for (int i = 0; i < cq4; ++i)
{
if (Q4[i].first > Q4xmax)
Q4xmax = Q4[i].first;
if (Q4[i].first < Q4xmin)
Q4xmin = Q4[i].first;
if (Q4[i].second > Q4ymax)
Q4ymax = Q4[i].second;
if (Q4[i].second < Q4ymin)
Q4ymin = Q4[i].second;
}
int Q4Area = (Q4ymax - Q4ymin) * (Q4xmax - Q4xmin);
cout << "Q4:"
<< " (" << Q4xmin << ", " << Q4ymin << ") (" << Q4xmax << " ," << Q4ymax << ") " << Q4Area;
} | # 2071515, 2024-11-02 14:43:58, -----P---- (10%)
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n, cq1 = 0, cq2 = 0, cq3 = 0, cq4 = 0;
cin >> n;
pair<int, int> xy[n];
pair<int, int> Q1[n];
pair<int, int> Q2[n];
pair<int, int> Q3[n];
pair<int, int> Q4[n];
for (int i = 0; i < n; ++i)
{
cin >> xy[i].first >> xy[i].second;
if(xy[i].first==0||xy[i].second==0){
continue;
}
if (xy[i].first > 0 && xy[i].second > 0)
{
Q1[cq1] = xy[i];
cq1++;
}
else if (xy[i].first < 0 && xy[i].second > 0)
{
Q2[cq2] = xy[i];
cq2++;
}
else if (xy[i].first < 0 && xy[i].second < 0)
{
Q3[cq3] = xy[i];
cq3++;
}
else if (xy[i].first > 0 && xy[i].second < 0)
{
Q4[cq4] = xy[i];
cq4++;
}
}
if(cq1 == 0&&cq2 == 0&&cq3 == 0&& cq4 == 0){
cout<<"No point in any quadrant";
return 0;
}
int Q1xmax = 0, Q1ymax = 0, Q1xmin = INT_MAX, Q1ymin = INT_MAX;
for (int i = 0; i < cq1; ++i)
{
if (Q1[i].first > Q1xmax)
Q1xmax = Q1[i].first;
if (Q1[i].first < Q1xmin)
Q1xmin = Q1[i].first;
if (Q1[i].second > Q1ymax)
Q1ymax = Q1[i].second;
if (Q1[i].second < Q1ymin)
Q1ymin = Q1[i].second;
}
int Q1Area = (Q1ymax - Q1ymin) * (Q1xmax - Q1xmin);
cout << "Q1:"
<< " (" << Q1xmin << ", " << Q1ymin << ") (" << Q1xmax << " ," << Q1ymax << ") " << Q1Area << endl;
int Q2xmax = 0, Q2ymax = 0, Q2xmin = INT_MAX, Q2ymin = INT_MAX;
for (int i = 0; i < cq2; ++i)
{
if (Q2[i].first > Q2xmax)
Q2xmax = Q2[i].first;
if (Q2[i].first < Q2xmin)
Q2xmin = Q2[i].first;
if (Q2[i].second > Q2ymax)
Q2ymax = Q2[i].second;
if (Q2[i].second < Q2ymin)
Q2ymin = Q2[i].second;
}
int Q2Area = (Q2ymax - Q2ymin) * (Q2xmax - Q2xmin);
cout << "Q2:"
<< " (" << Q2xmin << ", " << Q2ymin << ") (" << Q2xmax << " ," << Q2ymax << ") " << Q2Area << endl;
int Q3xmax = 0, Q3ymax = 0, Q3xmin = INT_MAX, Q3ymin = INT_MAX;
for (int i = 0; i < cq3; ++i)
{
if (Q3[i].first > Q3xmax)
Q3xmax = Q3[i].first;
if (Q3[i].first < Q3xmin)
Q3xmin = Q3[i].first;
if (Q3[i].second > Q3ymax)
Q3ymax = Q3[i].second;
if (Q3[i].second < Q3ymin)
Q3ymin = Q3[i].second;
}
int Q3Area = (Q3ymax - Q3ymin) * (Q3xmax - Q3xmin);
cout << "Q3:"
<< " (" << Q3xmin << ", " << Q3ymin << ") (" << Q3xmax << " ," << Q3ymax << ") " << Q3Area << endl;
int Q4xmax = 0, Q4ymax = 0, Q4xmin = INT_MAX, Q4ymin = INT_MAX;
for (int i = 0; i < cq4; ++i)
{
if (Q4[i].first > Q4xmax)
Q4xmax = Q4[i].first;
if (Q4[i].first < Q4xmin)
Q4xmin = Q4[i].first;
if (Q4[i].second > Q4ymax)
Q4ymax = Q4[i].second;
if (Q4[i].second < Q4ymin)
Q4ymin = Q4[i].second;
}
int Q4Area = (Q4ymax - Q4ymin) * (Q4xmax - Q4xmin);
cout << "Q4:"
<< " (" << Q4xmin << ", " << Q4ymin << ") (" << Q4xmax << " ," << Q4ymax << ") " << Q4Area;
} | # 2071545, 2024-11-02 14:47:40, -----P---- (10%)
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n, cq1 = 0, cq2 = 0, cq3 = 0, cq4 = 0;
cin >> n;
pair<int, int> xy[n];
pair<int, int> Q1[n];
pair<int, int> Q2[n];
pair<int, int> Q3[n];
pair<int, int> Q4[n];
for (int i = 0; i < n; ++i)
{
cin >> xy[i].first >> xy[i].second;
if(xy[i].first==0||xy[i].second==0){
continue;
}
if (xy[i].first > 0 && xy[i].second > 0)
{
Q1[cq1] = xy[i];
cq1++;
}
else if (xy[i].first < 0 && xy[i].second > 0)
{
Q2[cq2] = xy[i];
cq2++;
}
else if (xy[i].first < 0 && xy[i].second < 0)
{
Q3[cq3] = xy[i];
cq3++;
}
else if (xy[i].first > 0 && xy[i].second < 0)
{
Q4[cq4] = xy[i];
cq4++;
}
}
if(cq1 == 0&&cq2 == 0&&cq3 == 0&& cq4 == 0){
cout<<"No point in any quadrant";
return 0;
}
int Q1xmax = 0, Q1ymax = 0, Q1xmin = INT_MAX, Q1ymin = INT_MAX;
for (int i = 0; i < cq1; ++i)
{
if (Q1[i].first > Q1xmax)
Q1xmax = Q1[i].first;
if (Q1[i].first < Q1xmin)
Q1xmin = Q1[i].first;
if (Q1[i].second > Q1ymax)
Q1ymax = Q1[i].second;
if (Q1[i].second < Q1ymin)
Q1ymin = Q1[i].second;
}
int Q1Area = (Q1ymax - Q1ymin) * (Q1xmax - Q1xmin);
cout << "Q1:"
<< " (" << Q1xmin << ", " << Q1ymin << ") (" << Q1xmax << " ," << Q1ymax << ") " << Q1Area << endl;
int Q2xmax = -10000, Q2ymax = 0, Q2xmin = INT_MAX, Q2ymin = INT_MAX;
for (int i = 0; i < cq2; ++i)
{
if (Q2[i].first > Q2xmax)
Q2xmax = Q2[i].first;
if (Q2[i].first < Q2xmin)
Q2xmin = Q2[i].first;
if (Q2[i].second > Q2ymax)
Q2ymax = Q2[i].second;
if (Q2[i].second < Q2ymin)
Q2ymin = Q2[i].second;
}
int Q2Area = (Q2ymax - Q2ymin) * (Q2xmax - Q2xmin);
cout << "Q2:"
<< " (" << Q2xmin << ", " << Q2ymin << ") (" << Q2xmax << " ," << Q2ymax << ") " << Q2Area << endl;
int Q3xmax = -100000, Q3ymax = -100000, Q3xmin = INT_MAX, Q3ymin = INT_MAX;
for (int i = 0; i < cq3; ++i)
{
if (Q3[i].first > Q3xmax)
Q3xmax = Q3[i].first;
if (Q3[i].first < Q3xmin)
Q3xmin = Q3[i].first;
if (Q3[i].second > Q3ymax)
Q3ymax = Q3[i].second;
if (Q3[i].second < Q3ymin)
Q3ymin = Q3[i].second;
}
int Q3Area = (Q3ymax - Q3ymin) * (Q3xmax - Q3xmin);
cout << "Q3:"
<< " (" << Q3xmin << ", " << Q3ymin << ") (" << Q3xmax << " ," << Q3ymax << ") " << Q3Area << endl;
int Q4xmax = 0, Q4ymax = -100000, Q4xmin = INT_MAX, Q4ymin = INT_MAX;
for (int i = 0; i < cq4; ++i)
{
if (Q4[i].first > Q4xmax)
Q4xmax = Q4[i].first;
if (Q4[i].first < Q4xmin)
Q4xmin = Q4[i].first;
if (Q4[i].second > Q4ymax)
Q4ymax = Q4[i].second;
if (Q4[i].second < Q4ymin)
Q4ymin = Q4[i].second;
}
int Q4Area = (Q4ymax - Q4ymin) * (Q4xmax - Q4xmin);
cout << "Q4:"
<< " (" << Q4xmin << ", " << Q4ymin << ") (" << Q4xmax << " ," << Q4ymax << ") " << Q4Area;
} | # 2071583, 2024-11-02 14:51:34, PPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n, cq1 = 0, cq2 = 0, cq3 = 0, cq4 = 0;
cin >> n;
pair<int, int> xy[n];
pair<int, int> Q1[n];
pair<int, int> Q2[n];
pair<int, int> Q3[n];
pair<int, int> Q4[n];
for (int i = 0; i < n; ++i)
{
cin >> xy[i].first >> xy[i].second;
if(xy[i].first==0||xy[i].second==0){
continue;
}
if (xy[i].first > 0 && xy[i].second > 0)
{
Q1[cq1] = xy[i];
cq1++;
}
else if (xy[i].first < 0 && xy[i].second > 0)
{
Q2[cq2] = xy[i];
cq2++;
}
else if (xy[i].first < 0 && xy[i].second < 0)
{
Q3[cq3] = xy[i];
cq3++;
}
else if (xy[i].first > 0 && xy[i].second < 0)
{
Q4[cq4] = xy[i];
cq4++;
}
}
if(cq1 == 0&&cq2 == 0&&cq3 == 0&& cq4 == 0){
cout<<"No point in any quadrant";
return 0;
}
if(cq1>0){
int Q1xmax = 0, Q1ymax = 0, Q1xmin = INT_MAX, Q1ymin = INT_MAX;
for (int i = 0; i < cq1; ++i)
{
if (Q1[i].first > Q1xmax)
Q1xmax = Q1[i].first;
if (Q1[i].first < Q1xmin)
Q1xmin = Q1[i].first;
if (Q1[i].second > Q1ymax)
Q1ymax = Q1[i].second;
if (Q1[i].second < Q1ymin)
Q1ymin = Q1[i].second;
}
int Q1Area = (Q1ymax - Q1ymin) * (Q1xmax - Q1xmin);
cout << "Q1:"
<< " (" << Q1xmin << ", " << Q1ymin << ") (" << Q1xmax << ", " << Q1ymax << ") " << Q1Area << endl;
}
if(cq2>0){
int Q2xmax = -10000, Q2ymax = 0, Q2xmin = INT_MAX, Q2ymin = INT_MAX;
for (int i = 0; i < cq2; ++i)
{
if (Q2[i].first > Q2xmax)
Q2xmax = Q2[i].first;
if (Q2[i].first < Q2xmin)
Q2xmin = Q2[i].first;
if (Q2[i].second > Q2ymax)
Q2ymax = Q2[i].second;
if (Q2[i].second < Q2ymin)
Q2ymin = Q2[i].second;
}
int Q2Area = (Q2ymax - Q2ymin) * (Q2xmax - Q2xmin);
cout << "Q2:"
<< " (" << Q2xmin << ", " << Q2ymin << ") (" << Q2xmax << ", " << Q2ymax << ") " << Q2Area << endl;
}
if(cq3>0){
int Q3xmax = -100000, Q3ymax = -100000, Q3xmin = INT_MAX, Q3ymin = INT_MAX;
for (int i = 0; i < cq3; ++i)
{
if (Q3[i].first > Q3xmax)
Q3xmax = Q3[i].first;
if (Q3[i].first < Q3xmin)
Q3xmin = Q3[i].first;
if (Q3[i].second > Q3ymax)
Q3ymax = Q3[i].second;
if (Q3[i].second < Q3ymin)
Q3ymin = Q3[i].second;
}
int Q3Area = (Q3ymax - Q3ymin) * (Q3xmax - Q3xmin);
cout << "Q3:"
<< " (" << Q3xmin << ", " << Q3ymin << ") (" << Q3xmax << ", " << Q3ymax << ") " << Q3Area << endl;
}
if(cq4>0){
int Q4xmax = 0, Q4ymax = -100000, Q4xmin = INT_MAX, Q4ymin = INT_MAX;
for (int i = 0; i < cq4; ++i)
{
if (Q4[i].first > Q4xmax)
Q4xmax = Q4[i].first;
if (Q4[i].first < Q4xmin)
Q4xmin = Q4[i].first;
if (Q4[i].second > Q4ymax)
Q4ymax = Q4[i].second;
if (Q4[i].second < Q4ymin)
Q4ymin = Q4[i].second;
}
int Q4Area = (Q4ymax - Q4ymin) * (Q4xmax - Q4xmin);
cout << "Q4:"
<< " (" << Q4xmin << ", " << Q4ymin << ") (" << Q4xmax << ", " << Q4ymax << ") " << Q4Area;
}
} |
# 2071276, 2024-11-02 14:17:53, xxxxPx--x- (10%)
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
vector<int> q1x,q1y,q2x,q2y,q3x,q3y,q4x,q4y,notinq;
int n,xin,yin,minq1x,minq1y,minq2x,minq2y,minq3x,minq3y,minq4x,minq4y
,maxq1x,maxq1y,maxq2x,maxq2y,maxq3x,maxq3y,maxq4x,maxq4y
,areaq1,areaq2,areaq3,areaq4;
cin >> n;
for (int i = 0; i < n; i++)
{
cin >> xin >> yin;
if(xin*-1 < 0 && yin*-1 < 0)
{
q1x.push_back(xin);
q1y.push_back(yin);
}
else if(xin*-1 > 0 && yin*-1 < 0)
{
q2x.push_back(xin);
q2y.push_back(yin);
}
else if(xin*-1 > 0 && yin*-1 > 0)
{
q3x.push_back(xin);
q3y.push_back(yin);
}
else if(xin*-1 < 0 && yin*-1 > 0)
{
q4x.push_back(xin);
q4y.push_back(yin);
}
else if(xin == 0 || yin == 0)
{
notinq.push_back(xin);
notinq.push_back(yin);
}
}
sort(q1x.begin(),q1x.end());
sort(q1y.begin(),q1y.end());
sort(q2x.begin(),q2x.end());
sort(q2y.begin(),q2y.end());
sort(q3x.begin(),q3x.end());
sort(q3y.begin(),q3y.end());
sort(q4x.begin(),q4x.end());
sort(q4y.begin(),q4y.end());
minq1x = q1x[0];
minq1y = q1y[0];
maxq1x = q1x[q1x.size()-1];
maxq1y = q1y[q1y.size()-1];
minq2x = q2x[0];
minq2y = q2y[0];
maxq2x = q2x[q2x.size()-1];
maxq2y = q2y[q2y.size()-1];
minq3x = q3x[0];
minq3y = q3y[0];
maxq3x = q3x[q3x.size()-1];
maxq3y = q3y[q3y.size()-1];
minq4x = q4x[0];
minq4y = q4y[0];
maxq4x = q4x[q4x.size()-1];
maxq4y = q4y[q4y.size()-1];
areaq1 = (maxq1x-minq1x)*(maxq1y-minq1y);
areaq2 = (maxq2x-minq2x)*(maxq2y-minq2y);
areaq3 = (maxq3x-minq3x)*(maxq3y-minq3y);
areaq4 = (maxq4x-minq4x)*(maxq1y-minq4y);
if(notinq.size() == (n*2)) cout << "No point in any quadrant";
else
{
if(q1x.size() > 0) cout << "Q1: (" << minq1x << ", " << minq1y << ") (" << maxq1x << ", " << maxq1y << ") " << areaq1 << endl;
if(q2x.size() > 0) cout << "Q2: (" << minq2x << ", " << minq2y << ") (" << maxq2x << ", " << maxq2y << ") " << areaq2 << endl;
if(q3x.size() > 0) cout << "Q3: (" << minq3x << ", " << minq3y << ") (" << maxq3x << ", " << maxq3y << ") " << areaq3 << endl;
if(q1x.size() > 0) cout << "Q4: (" << minq4x << ", " << minq4y << ") (" << maxq4x << ", " << maxq4y << ") " << areaq4 << endl;
}
return 0;
} | # 2071326, 2024-11-02 14:23:24, -P-PPP---- (40%)
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
vector<int> q1x,q1y,q2x,q2y,q3x,q3y,q4x,q4y,notinq;
int n,xin,yin,minq1x,minq1y,minq2x,minq2y,minq3x,minq3y,minq4x,minq4y
,maxq1x,maxq1y,maxq2x,maxq2y,maxq3x,maxq3y,maxq4x,maxq4y
,areaq1,areaq2,areaq3,areaq4;
cin >> n;
for (int i = 0; i < n; i++)
{
cin >> xin >> yin;
if(xin*-1 < 0 && yin*-1 < 0)
{
q1x.push_back(xin);
q1y.push_back(yin);
}
else if(xin*-1 > 0 && yin*-1 < 0)
{
q2x.push_back(xin);
q2y.push_back(yin);
}
else if(xin*-1 > 0 && yin*-1 > 0)
{
q3x.push_back(xin);
q3y.push_back(yin);
}
else if(xin*-1 < 0 && yin*-1 > 0)
{
q4x.push_back(xin);
q4y.push_back(yin);
}
else if(xin == 0 || yin == 0)
{
notinq.push_back(xin);
notinq.push_back(yin);
}
}
if(q1x.size() > 0){
sort(q1x.begin(),q1x.end());
sort(q1y.begin(),q1y.end());
}
if(q2x.size() > 0){
sort(q2x.begin(),q2x.end());
sort(q2y.begin(),q2y.end());
}
if(q3x.size() > 0){
sort(q3x.begin(),q3x.end());
sort(q3y.begin(),q3y.end());
}
if(q4x.size() > 0){
sort(q4x.begin(),q4x.end());
sort(q4y.begin(),q4y.end());
}
if(q1x.size() > 0){
minq1x = q1x[0];
minq1y = q1y[0];
maxq1x = q1x[q1x.size()-1];
maxq1y = q1y[q1y.size()-1];
}
if(q2x.size() > 0){
minq2x = q2x[0];
minq2y = q2y[0];
maxq2x = q2x[q2x.size()-1];
maxq2y = q2y[q2y.size()-1];
}
if(q3x.size() > 0){
minq3x = q3x[0];
minq3y = q3y[0];
maxq3x = q3x[q3x.size()-1];
maxq3y = q3y[q3y.size()-1];
}
if(q4x.size() > 0){
minq4x = q4x[0];
minq4y = q4y[0];
maxq4x = q4x[q4x.size()-1];
maxq4y = q4y[q4y.size()-1];
}
if(q1x.size() > 0) areaq1 = (maxq1x-minq1x)*(maxq1y-minq1y);
if(q2x.size() > 0) areaq2 = (maxq2x-minq2x)*(maxq2y-minq2y);
if(q3x.size() > 0) areaq3 = (maxq3x-minq3x)*(maxq3y-minq3y);
if(q4x.size() > 0) areaq4 = (maxq4x-minq4x)*(maxq1y-minq4y);
if(notinq.size() == (n*2)) cout << "No point in any quadrant";
else
{
if(q1x.size() > 0) cout << "Q1: (" << minq1x << ", " << minq1y << ") (" << maxq1x << ", " << maxq1y << ") " << areaq1 << endl;
if(q2x.size() > 0) cout << "Q2: (" << minq2x << ", " << minq2y << ") (" << maxq2x << ", " << maxq2y << ") " << areaq2 << endl;
if(q3x.size() > 0) cout << "Q3: (" << minq3x << ", " << minq3y << ") (" << maxq3x << ", " << maxq3y << ") " << areaq3 << endl;
if(q1x.size() > 0) cout << "Q4: (" << minq4x << ", " << minq4y << ") (" << maxq4x << ", " << maxq4y << ") " << areaq4 << endl;
}
return 0;
} | # 2071352, 2024-11-02 14:25:41, -P-PPP---- (40%)
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
vector<long> q1x,q1y,q2x,q2y,q3x,q3y,q4x,q4y,notinq;
long n,xin,yin,minq1x,minq1y,minq2x,minq2y,minq3x,minq3y,minq4x,minq4y
,maxq1x,maxq1y,maxq2x,maxq2y,maxq3x,maxq3y,maxq4x,maxq4y
,areaq1,areaq2,areaq3,areaq4;
cin >> n;
for (int i = 0; i < n; i++)
{
cin >> xin >> yin;
if(xin*-1 < 0 && yin*-1 < 0)
{
q1x.push_back(xin);
q1y.push_back(yin);
}
else if(xin*-1 > 0 && yin*-1 < 0)
{
q2x.push_back(xin);
q2y.push_back(yin);
}
else if(xin*-1 > 0 && yin*-1 > 0)
{
q3x.push_back(xin);
q3y.push_back(yin);
}
else if(xin*-1 < 0 && yin*-1 > 0)
{
q4x.push_back(xin);
q4y.push_back(yin);
}
else if(xin == 0 || yin == 0)
{
notinq.push_back(xin);
notinq.push_back(yin);
}
}
if(q1x.size() > 0){
sort(q1x.begin(),q1x.end());
sort(q1y.begin(),q1y.end());
}
if(q2x.size() > 0){
sort(q2x.begin(),q2x.end());
sort(q2y.begin(),q2y.end());
}
if(q3x.size() > 0){
sort(q3x.begin(),q3x.end());
sort(q3y.begin(),q3y.end());
}
if(q4x.size() > 0){
sort(q4x.begin(),q4x.end());
sort(q4y.begin(),q4y.end());
}
if(q1x.size() > 0){
minq1x = q1x[0];
minq1y = q1y[0];
maxq1x = q1x[q1x.size()-1];
maxq1y = q1y[q1y.size()-1];
}
if(q2x.size() > 0){
minq2x = q2x[0];
minq2y = q2y[0];
maxq2x = q2x[q2x.size()-1];
maxq2y = q2y[q2y.size()-1];
}
if(q3x.size() > 0){
minq3x = q3x[0];
minq3y = q3y[0];
maxq3x = q3x[q3x.size()-1];
maxq3y = q3y[q3y.size()-1];
}
if(q4x.size() > 0){
minq4x = q4x[0];
minq4y = q4y[0];
maxq4x = q4x[q4x.size()-1];
maxq4y = q4y[q4y.size()-1];
}
if(q1x.size() > 0) areaq1 = (maxq1x-minq1x)*(maxq1y-minq1y);
if(q2x.size() > 0) areaq2 = (maxq2x-minq2x)*(maxq2y-minq2y);
if(q3x.size() > 0) areaq3 = (maxq3x-minq3x)*(maxq3y-minq3y);
if(q4x.size() > 0) areaq4 = (maxq4x-minq4x)*(maxq1y-minq4y);
if(notinq.size() == (n*2)) cout << "No point in any quadrant";
else
{
if(q1x.size() > 0) cout << "Q1: (" << minq1x << ", " << minq1y << ") (" << maxq1x << ", " << maxq1y << ") " << areaq1 << endl;
if(q2x.size() > 0) cout << "Q2: (" << minq2x << ", " << minq2y << ") (" << maxq2x << ", " << maxq2y << ") " << areaq2 << endl;
if(q3x.size() > 0) cout << "Q3: (" << minq3x << ", " << minq3y << ") (" << maxq3x << ", " << maxq3y << ") " << areaq3 << endl;
if(q1x.size() > 0) cout << "Q4: (" << minq4x << ", " << minq4y << ") (" << maxq4x << ", " << maxq4y << ") " << areaq4 << endl;
}
return 0;
} | # 2071419, 2024-11-02 14:33:14, PPPPPP---- (60%)
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
vector<long> q1x,q1y,q2x,q2y,q3x,q3y,q4x,q4y,notinq;
long n,xin,yin,minq1x,minq1y,minq2x,minq2y,minq3x,minq3y,minq4x,minq4y
,maxq1x,maxq1y,maxq2x,maxq2y,maxq3x,maxq3y,maxq4x,maxq4y
,areaq1,areaq2,areaq3,areaq4;
cin >> n;
for (int i = 0; i < n; i++)
{
cin >> xin >> yin;
if(xin*-1 < 0 && yin*-1 < 0)
{
q1x.push_back(xin);
q1y.push_back(yin);
}
else if(xin*-1 > 0 && yin*-1 < 0)
{
q2x.push_back(xin);
q2y.push_back(yin);
}
else if(xin*-1 > 0 && yin*-1 > 0)
{
q3x.push_back(xin);
q3y.push_back(yin);
}
else if(xin*-1 < 0 && yin*-1 > 0)
{
q4x.push_back(xin);
q4y.push_back(yin);
}
else if(xin == 0 || yin == 0)
{
notinq.push_back(xin);
notinq.push_back(yin);
}
}
if(q1x.size() > 0){
sort(q1x.begin(),q1x.end());
sort(q1y.begin(),q1y.end());
}
if(q2x.size() > 0){
sort(q2x.begin(),q2x.end());
sort(q2y.begin(),q2y.end());
}
if(q3x.size() > 0){
sort(q3x.begin(),q3x.end());
sort(q3y.begin(),q3y.end());
}
if(q4x.size() > 0){
sort(q4x.begin(),q4x.end());
sort(q4y.begin(),q4y.end());
}
if(q1x.size() > 0){
minq1x = q1x[0];
minq1y = q1y[0];
maxq1x = q1x[q1x.size()-1];
maxq1y = q1y[q1y.size()-1];
}
if(q2x.size() > 0){
minq2x = q2x[0];
minq2y = q2y[0];
maxq2x = q2x[q2x.size()-1];
maxq2y = q2y[q2y.size()-1];
}
if(q3x.size() > 0){
minq3x = q3x[0];
minq3y = q3y[0];
maxq3x = q3x[q3x.size()-1];
maxq3y = q3y[q3y.size()-1];
}
if(q4x.size() > 0){
minq4x = q4x[0];
minq4y = q4y[0];
maxq4x = q4x[q4x.size()-1];
maxq4y = q4y[q4y.size()-1];
}
if(q1x.size() > 0) areaq1 = (maxq1x-minq1x)*(maxq1y-minq1y);
if(q2x.size() > 0) areaq2 = (maxq2x-minq2x)*(maxq2y-minq2y);
if(q3x.size() > 0) areaq3 = (maxq3x-minq3x)*(maxq3y-minq3y);
if(q4x.size() > 0) areaq4 = (maxq4x-minq4x)*(maxq1y-minq4y);
if(notinq.size() == (n*2)) cout << "No point in any quadrant";
else
{
if(q1x.size() > 0) cout << "Q1: (" << minq1x << ", " << minq1y << ") (" << maxq1x << ", " << maxq1y << ") " << areaq1 << endl;
if(q2x.size() > 0) cout << "Q2: (" << minq2x << ", " << minq2y << ") (" << maxq2x << ", " << maxq2y << ") " << areaq2 << endl;
if(q3x.size() > 0) cout << "Q3: (" << minq3x << ", " << minq3y << ") (" << maxq3x << ", " << maxq3y << ") " << areaq3 << endl;
if(q4x.size() > 0) cout << "Q4: (" << minq4x << ", " << minq4y << ") (" << maxq4x << ", " << maxq4y << ") " << areaq4 << endl;
}
return 0;
} | # 2071423, 2024-11-02 14:33:47, PPPPPPPPPP (100%)
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
vector<long> q1x,q1y,q2x,q2y,q3x,q3y,q4x,q4y,notinq;
long n,xin,yin,minq1x,minq1y,minq2x,minq2y,minq3x,minq3y,minq4x,minq4y
,maxq1x,maxq1y,maxq2x,maxq2y,maxq3x,maxq3y,maxq4x,maxq4y
,areaq1,areaq2,areaq3,areaq4;
cin >> n;
for (int i = 0; i < n; i++)
{
cin >> xin >> yin;
if(xin*-1 < 0 && yin*-1 < 0)
{
q1x.push_back(xin);
q1y.push_back(yin);
}
else if(xin*-1 > 0 && yin*-1 < 0)
{
q2x.push_back(xin);
q2y.push_back(yin);
}
else if(xin*-1 > 0 && yin*-1 > 0)
{
q3x.push_back(xin);
q3y.push_back(yin);
}
else if(xin*-1 < 0 && yin*-1 > 0)
{
q4x.push_back(xin);
q4y.push_back(yin);
}
else if(xin == 0 || yin == 0)
{
notinq.push_back(xin);
notinq.push_back(yin);
}
}
if(q1x.size() > 0){
sort(q1x.begin(),q1x.end());
sort(q1y.begin(),q1y.end());
}
if(q2x.size() > 0){
sort(q2x.begin(),q2x.end());
sort(q2y.begin(),q2y.end());
}
if(q3x.size() > 0){
sort(q3x.begin(),q3x.end());
sort(q3y.begin(),q3y.end());
}
if(q4x.size() > 0){
sort(q4x.begin(),q4x.end());
sort(q4y.begin(),q4y.end());
}
if(q1x.size() > 0){
minq1x = q1x[0];
minq1y = q1y[0];
maxq1x = q1x[q1x.size()-1];
maxq1y = q1y[q1y.size()-1];
}
if(q2x.size() > 0){
minq2x = q2x[0];
minq2y = q2y[0];
maxq2x = q2x[q2x.size()-1];
maxq2y = q2y[q2y.size()-1];
}
if(q3x.size() > 0){
minq3x = q3x[0];
minq3y = q3y[0];
maxq3x = q3x[q3x.size()-1];
maxq3y = q3y[q3y.size()-1];
}
if(q4x.size() > 0){
minq4x = q4x[0];
minq4y = q4y[0];
maxq4x = q4x[q4x.size()-1];
maxq4y = q4y[q4y.size()-1];
}
if(q1x.size() > 0) areaq1 = (maxq1x-minq1x)*(maxq1y-minq1y);
if(q2x.size() > 0) areaq2 = (maxq2x-minq2x)*(maxq2y-minq2y);
if(q3x.size() > 0) areaq3 = (maxq3x-minq3x)*(maxq3y-minq3y);
if(q4x.size() > 0) areaq4 = (maxq4x-minq4x)*(maxq4y-minq4y);
if(notinq.size() == (n*2)) cout << "No point in any quadrant";
else
{
if(q1x.size() > 0) cout << "Q1: (" << minq1x << ", " << minq1y << ") (" << maxq1x << ", " << maxq1y << ") " << areaq1 << endl;
if(q2x.size() > 0) cout << "Q2: (" << minq2x << ", " << minq2y << ") (" << maxq2x << ", " << maxq2y << ") " << areaq2 << endl;
if(q3x.size() > 0) cout << "Q3: (" << minq3x << ", " << minq3y << ") (" << maxq3x << ", " << maxq3y << ") " << areaq3 << endl;
if(q4x.size() > 0) cout << "Q4: (" << minq4x << ", " << minq4y << ") (" << maxq4x << ", " << maxq4y << ") " << areaq4 << endl;
}
return 0;
} |
# 2069077, 2024-11-02 10:10:09, xxxxxxxxxx (0%)
#include <algorithm>
#include <iostream>
#include <vector>
#include <set>
#include <map>
using namespace std;
int main(){
int n, x, y, a1, a2, a3, a4;
vector<pair<int,int>> q1x, q2x, q3x, q4x, q1y, q2y, q3y, q4y;
cin >> n;
for (int i = 0; i < n; i++)
{
cin >> x >> y;
if (x > 0 && y > 0)
{
q1x.push_back(make_pair(x, y));
q1y.push_back(make_pair(x, y));
}
else if (x < 0 && y > 0)
{
q2x.push_back(make_pair(x, y));
q2y.push_back(make_pair(x, y));
}
else if (x < 0 && y < 0)
{
q3x.push_back(make_pair(x, y));
q3y.push_back(make_pair(x, y));
}
else if (x > 0 && y < 0)
{
q4x.push_back(make_pair(x, y));
q4y.push_back(make_pair(x, y));
}
}
sort(q1x.begin(), q1x.end());
sort(q1y.begin(), q1x.end());
sort(q2x.begin(), q1x.end());
sort(q2y.begin(), q1x.end());
sort(q3x.begin(), q1x.end());
sort(q3y.begin(), q1x.end());
sort(q4x.begin(), q1x.end());
sort(q4y.begin(), q1x.end());
a1 = (q1x[q1x.size() - 1].first - q1x[0].first) * (q1y[q1y.size() - 1].first - q1y[0].first);
a2 = (q2x[q2x.size() - 1].first - q2x[0].first) * (q2y[q2y.size() - 1].first - q2y[0].first);
a3 = (q3x[q3x.size() - 1].first - q3x[0].first) * (q3y[q3y.size() - 1].first - q3y[0].first);
a4 = (q4x[q4x.size() - 1].first - q4x[0].first) * (q4y[q4y.size() - 1].first - q4y[0].first);
bool found = false;
if (q1x.size() != 0)
{
found = true;
cout << "Q1: ";
for (auto x : q1x)
{
cout << "(" << x.first << ", " << x.second << ") ";
}
cout << a1;
}
if (q2x.size() != 0)
{
found = true;
cout << "Q2: ";
for (auto x : q2x)
{
cout << "(" << x.first << ", " << x.second << ") ";
}
cout << a2;
}
if (q3x.size() != 0)
{
found = true;
cout << "Q3: ";
for (auto x : q3x)
{
cout << "(" << x.first << ", " << x.second << ") ";
}
cout << a3;
}
if (q1x.size() != 0)
{
found = true;
cout << "Q4: ";
for (auto x : q4x)
{
cout << "(" << x.first << ", " << x.second << ") ";
}
cout << a4;
}
if (!found)
{
cout << "No point in any quadrant";
}
} | # 2069338, 2024-11-02 10:37:47, -P-PPPPP-P (70%)
#include <algorithm>
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <cmath>
using namespace std;
int main(){
int n, x, y, a1, a2, a3, a4, max1x = -1e9, max2x = -1e9, max3x = -1e9, max4x = -1e9, min1x = 1e9, min2x = 1e9, min3x = 1e9, min4x = 1e9;
int max1y = -1e9, max2y = -1e9, max3y = -1e9, max4y = -1e9, min1y = 1e9, min2y = 1e9, min3y = 1e9, min4y = 1e9;
set<pair<int,int>> q1x, q2x, q3x, q4x;
cin >> n;
for (int i = 0; i < n; i++)
{
cin >> x >> y;
if (x > 0 && y > 0)
{
q1x.insert(make_pair(x, y));
if (x > max1x) max1x = x;
if (x < min1x) min1x = x;
if (y > max1y) max1y = y;
if (y < min1y) min1y = y;
}
else if (x < 0 && y > 0)
{
q2x.insert(make_pair(x, y));
if (x > max2x) max2x = x;
if (x < min2x) min2x = x;
if (y > max2y) max2y = y;
if (y < min2y) min2y = y;
}
else if (x < 0 && y < 0)
{
q3x.insert(make_pair(x, y));
if (x > max3x) max3x = x;
if (x < min3x) min3x = x;
if (y > max3y) max3y = y;
if (y < min3y) min3y = y;
}
else if (x > 0 && y < 0)
{
q4x.insert(make_pair(x, y));
if (x > max4x) max4x = x;
if (x < min4x) min4x = x;
if (y > max4y) max4y = y;
if (y < min4y) min4y = y;
}
}
a1 = (max1x - min1x) * (max1y - min1y);
a2 = (max2x - min2x) * (max2y - min2y);
a3 = (max3x - min3x) * (max3y - min3y);
a4 = (max4x - min4x) * (max4y - min4y);
bool found = false;
if (q1x.size() != 0)
{
found = true;
cout << "Q1: ";
cout << "(" << min1x << ", " << min1y << ") ";
cout << "(" << max1x << ", " << max1y << ") ";
cout << a1 << endl;
}
if (q2x.size() != 0)
{
found = true;
cout << "Q2: ";
cout << "(" << min2x << ", " << min2y << ") ";
cout << "(" << max2x << ", " << max2y << ") ";
cout << a2 << endl;
}
if (q3x.size() != 0)
{
found = true;
cout << "Q3: ";
cout << "(" << min3x << ", " << min3y << ") ";
cout << "(" << max3x << ", " << max3y << ") ";
cout << a3 << endl;
}
if (q1x.size() != 0)
{
found = true;
cout << "Q4: ";
cout << "(" << min4x << ", " << min4y << ") ";
cout << "(" << max4x << ", " << max4y << ") ";
cout << a4<< endl;
}
if (!found)
{
cout << "No point in any quadrant";
}
} | # 2069360, 2024-11-02 10:39:35, -----P---- (10%)
#include <algorithm>
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <cmath>
using namespace std;
int main(){
cout << "No point in any quadrant";
} | # 2070037, 2024-11-02 11:46:13, -P-PPPPP-P (70%)
#include <algorithm>
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <cmath>
using namespace std;
int main(){
int n, x, y, a1, a2, a3, a4, max1x = -1e9, max2x = -1e9, max3x = -1e9, max4x = -1e9, min1x = 1e9, min2x = 1e9, min3x = 1e9, min4x = 1e9;
int max1y = -1e9, max2y = -1e9, max3y = -1e9, max4y = -1e9, min1y = 1e9, min2y = 1e9, min3y = 1e9, min4y = 1e9;
set<pair<int,int>> q1x, q2x, q3x, q4x;
cin >> n;
for (int i = 0; i < n; i++)
{
cin >> x >> y;
if (x > 0 && y > 0)
{
q1x.insert(make_pair(x, y));
if (x > max1x) max1x = x;
if (x < min1x) min1x = x;
if (y > max1y) max1y = y;
if (y < min1y) min1y = y;
}
else if (x < 0 && y > 0)
{
q2x.insert(make_pair(x, y));
if (x > max2x) max2x = x;
if (x < min2x) min2x = x;
if (y > max2y) max2y = y;
if (y < min2y) min2y = y;
}
else if (x < 0 && y < 0)
{
q3x.insert(make_pair(x, y));
if (x > max3x) max3x = x;
if (x < min3x) min3x = x;
if (y > max3y) max3y = y;
if (y < min3y) min3y = y;
}
else if (x > 0 && y < 0)
{
q4x.insert(make_pair(x, y));
if (x > max4x) max4x = x;
if (x < min4x) min4x = x;
if (y > max4y) max4y = y;
if (y < min4y) min4y = y;
}
}
a1 = (max1x - min1x) * (max1y - min1y);
a2 = (max2x - min2x) * (max2y - min2y);
a3 = (max3x - min3x) * (max3y - min3y);
a4 = (max4x - min4x) * (max4y - min4y);
bool found = false;
if (q1x.size() != 0)
{
found = true;
cout << "Q1: ";
cout << "(" << min1x << ", " << min1y << ") ";
cout << "(" << max1x << ", " << max1y << ") ";
cout << a1 << endl;
}
if (q2x.size() != 0)
{
found = true;
cout << "Q2: ";
cout << "(" << min2x << ", " << min2y << ") ";
cout << "(" << max2x << ", " << max2y << ") ";
cout << a2 << endl;
}
if (q3x.size() != 0)
{
found = true;
cout << "Q3: ";
cout << "(" << min3x << ", " << min3y << ") ";
cout << "(" << max3x << ", " << max3y << ") ";
cout << a3 << endl;
}
if (q1x.size() != 0)
{
found = true;
cout << "Q4: ";
cout << "(" << min4x << ", " << min4y << ") ";
cout << "(" << max4x << ", " << max4y << ") ";
cout << a4<< endl;
}
if (!found)
{
cout << "No point in any quadrant";
}
} | # 2070082, 2024-11-02 11:49:43, PPPPPPPPPP (100%)
#include <algorithm>
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <cmath>
using namespace std;
int main(){
int n, x, y, a1, a2, a3, a4, max1x = -1e9, max2x = -1e9, max3x = -1e9, max4x = -1e9, min1x = 1e9, min2x = 1e9, min3x = 1e9, min4x = 1e9;
int max1y = -1e9, max2y = -1e9, max3y = -1e9, max4y = -1e9, min1y = 1e9, min2y = 1e9, min3y = 1e9, min4y = 1e9;
set<pair<int,int>> q1x, q2x, q3x, q4x;
cin >> n;
for (int i = 0; i < n; i++)
{
cin >> x >> y;
if (x > 0 && y > 0)
{
q1x.insert(make_pair(x, y));
if (x > max1x) max1x = x;
if (x < min1x) min1x = x;
if (y > max1y) max1y = y;
if (y < min1y) min1y = y;
}
else if (x < 0 && y > 0)
{
q2x.insert(make_pair(x, y));
if (x > max2x) max2x = x;
if (x < min2x) min2x = x;
if (y > max2y) max2y = y;
if (y < min2y) min2y = y;
}
else if (x < 0 && y < 0)
{
q3x.insert(make_pair(x, y));
if (x > max3x) max3x = x;
if (x < min3x) min3x = x;
if (y > max3y) max3y = y;
if (y < min3y) min3y = y;
}
else if (x > 0 && y < 0)
{
q4x.insert(make_pair(x, y));
if (x > max4x) max4x = x;
if (x < min4x) min4x = x;
if (y > max4y) max4y = y;
if (y < min4y) min4y = y;
}
}
a1 = (max1x - min1x) * (max1y - min1y);
a2 = (max2x - min2x) * (max2y - min2y);
a3 = (max3x - min3x) * (max3y - min3y);
a4 = (max4x - min4x) * (max4y - min4y);
bool found = false;
if (q1x.size() != 0)
{
found = true;
cout << "Q1: ";
cout << "(" << min1x << ", " << min1y << ") ";
cout << "(" << max1x << ", " << max1y << ") ";
cout << a1 << endl;
}
if (q2x.size() != 0)
{
found = true;
cout << "Q2: ";
cout << "(" << min2x << ", " << min2y << ") ";
cout << "(" << max2x << ", " << max2y << ") ";
cout << a2 << endl;
}
if (q3x.size() != 0)
{
found = true;
cout << "Q3: ";
cout << "(" << min3x << ", " << min3y << ") ";
cout << "(" << max3x << ", " << max3y << ") ";
cout << a3 << endl;
}
if (q4x.size() != 0)
{
found = true;
cout << "Q4: ";
cout << "(" << min4x << ", " << min4y << ") ";
cout << "(" << max4x << ", " << max4y << ") ";
cout << a4<< endl;
}
if (!found)
{
cout << "No point in any quadrant";
}
} |
# 2069532, 2024-11-02 10:56:03, ---------- (0%)
#include<iostream>
#include<vector>
using namespace std;
int main()
{
vector<pair<int,int>> a,q1,q2,q3,q4;
int n,b,c ,i;
cin >> n;
for(i=0;i<n;i++)
{
cin >> b >> c;
a.push_back(make_pair(b,c));
}
for(auto j:a)
{
if(j.first > 0 && j.second > 0)
{
q1.push_back(make_pair(j.first,j.second));
}
else if(j.first < 0 && j.second > 0)
{
q2.push_back(make_pair(j.first,j.second));
}
else if(j.first < 0 && j.second < 0)
{
q3.push_back(make_pair(j.first,j.second));
}
else if(j.first > 0 && j.second < 0)
{
q4.push_back(make_pair(j.first,j.second));
}
}
for(auto j : q1)
{
int xmax ,xmin , ymax,ymin;
bool check = true;
if(check)
{
xmax = xmin = j.first;
ymax = ymin = j.second;
check = false;
}
if(j.first > xmax)
{
xmax = j.first;
}
if(j.first < xmin)
{
xmin = j.first;
}
if(j.second > ymax)
{
ymax = j.second;
}
if(j.second < ymin)
{
ymin = j.second;
}
cout << "Q1: (" << xmin << ", "<<ymin << ") (" << xmax << ", " << ymax << ")" << abs(xmax-xmin) * abs(ymax -ymin) << endl;
}
for(auto j : q2)
{
int xmax ,xmin , ymax,ymin;
bool check = true;
if(check)
{
xmax = xmin = j.first;
ymax = ymin = j.second;
check = false;
}
if(j.first > xmax)
{
xmax = j.first;
}
if(j.first < xmin)
{
xmin = j.first;
}
if(j.second > ymax)
{
ymax = j.second;
}
if(j.second < ymin)
{
ymin = j.second;
}
cout << "Q2: (" << xmin << ", "<<ymin << ") (" << xmax << ", " << ymax << ")" << abs(xmax-xmin) * abs(ymax -ymin) << endl;
}
for(auto j : q3)
{
int xmax ,xmin , ymax,ymin;
bool check = true;
if(check)
{
xmax = xmin = j.first;
ymax = ymin = j.second;
check = false;
}
if(j.first > xmax)
{
xmax = j.first;
}
if(j.first < xmin)
{
xmin = j.first;
}
if(j.second > ymax)
{
ymax = j.second;
}
if(j.second < ymin)
{
ymin = j.second;
}
cout << "Q3: (" << xmin << ", "<<ymin << ") (" << xmax << ", " << ymax << ")" << abs(xmax-xmin) * abs(ymax -ymin) << endl;
}
for(auto j : q4)
{
int xmax ,xmin , ymax,ymin;
bool check = true;
if(check)
{
xmax = xmin = j.first;
ymax = ymin = j.second;
check = false;
}
if(j.first > xmax)
{
xmax = j.first;
}
if(j.first < xmin)
{
xmin = j.first;
}
if(j.second > ymax)
{
ymax = j.second;
}
if(j.second < ymin)
{
ymin = j.second;
}
cout << "Q4: (" << xmin << ", "<<ymin << ") (" << xmax << ", " << ymax << ")" << abs(xmax-xmin) * abs(ymax -ymin) << endl;
}
} | # 2069661, 2024-11-02 11:08:41, Compilation error (0%)
#include<iostream>
#include<vector>
#include<utility>
using namespace std;
vector<int> ha(vector<pair<int,int>>q)
{
vector<int>need;
int xmax,xmin,ymax,ymin;
for(auto j : q)
{
bool check = true;
if(check)
{
xmax = xmin = j.first;
ymax = ymin = j.second;
check = false;
}
if(j.first > xmax)
{
xmax = j.first;
}
if(j.first < xmin)
{
xmin = j.first;
}
if(j.second > ymax)
{
ymax = j.second;
}
if(j.second < ymin)
{
ymin = j.second;
}
}
need.push_back(xmax);
need.push_back(xmin);
need.push_back(ymax);
need.push_back(ymin);
return need;
}
int main()
{
vector<pair<int,int>> a,q1,q2,q3,q4;
int n,b,c ,i;
cin >> n;
for(i=0;i<n;i++)
{
cin >> b >> c;
a.push_back(make_pair(b,c));
}
for(auto j:a)
{
if(j.first > 0 && j.second > 0)
{
q1.push_back(make_pair(j.first,j.second));
}
else if(j.first < 0 && j.second > 0)
{
q2.push_back(make_pair(j.first,j.second));
}
else if(j.first < 0 && j.second < 0)
{
q3.push_back(make_pair(j.first,j.second));
}
else if(j.first > 0 && j.second < 0)
{
q4.push_back(make_pair(j.first,j.second));
}
}
vector<int> need = ha(q1);
cout << "Q1: (" << need[1] << ", "<<need[3] << ") (" << need[0] << ", " << need[2] << ")" << abs(need[0]-need[1]) * abs(need[2] - need[3]) << endl;
vector<int> need = ha(q2);
cout << "Q2: (" << need[1] << ", "<<need[3] << ") (" << need[0] << ", " << need[2] << ")" << abs(need[0]-need[1]) * abs(need[2] - need[3]) << endl;
vector<int> need = ha(q3);
cout << "Q3: (" << need[1] << ", "<<need[3] << ") (" << need[0] << ", " << need[2] << ")" << abs(need[0]-need[1]) * abs(need[2] - need[3]) << endl;
vector<int> need = ha(q4);
cout << "Q4: (" << need[1] << ", "<<need[3] << ") (" << need[0] << ", " << need[2] << ")" << abs(need[0]-need[1]) * abs(need[2] - need[3]) << endl;
} | # 2069663, 2024-11-02 11:09:19, ---------- (0%)
#include<iostream>
#include<vector>
#include<utility>
using namespace std;
vector<int> ha(vector<pair<int,int>>q)
{
vector<int>need;
int xmax,xmin,ymax,ymin;
for(auto j : q)
{
bool check = true;
if(check)
{
xmax = xmin = j.first;
ymax = ymin = j.second;
check = false;
}
if(j.first > xmax)
{
xmax = j.first;
}
if(j.first < xmin)
{
xmin = j.first;
}
if(j.second > ymax)
{
ymax = j.second;
}
if(j.second < ymin)
{
ymin = j.second;
}
}
need.push_back(xmax);
need.push_back(xmin);
need.push_back(ymax);
need.push_back(ymin);
return need;
}
int main()
{
vector<pair<int,int>> a,q1,q2,q3,q4;
int n,b,c ,i;
cin >> n;
for(i=0;i<n;i++)
{
cin >> b >> c;
a.push_back(make_pair(b,c));
}
for(auto j:a)
{
if(j.first > 0 && j.second > 0)
{
q1.push_back(make_pair(j.first,j.second));
}
else if(j.first < 0 && j.second > 0)
{
q2.push_back(make_pair(j.first,j.second));
}
else if(j.first < 0 && j.second < 0)
{
q3.push_back(make_pair(j.first,j.second));
}
else if(j.first > 0 && j.second < 0)
{
q4.push_back(make_pair(j.first,j.second));
}
}
vector<int> need = ha(q1);
cout << "Q1: (" << need[1] << ", "<<need[3] << ") (" << need[0] << ", " << need[2] << ")" << abs(need[0]-need[1]) * abs(need[2] - need[3]) << endl;
vector<int> need2 = ha(q2);
cout << "Q2: (" << need[1] << ", "<<need[3] << ") (" << need[0] << ", " << need[2] << ")" << abs(need[0]-need[1]) * abs(need[2] - need[3]) << endl;
vector<int> need3 = ha(q3);
cout << "Q3: (" << need[1] << ", "<<need[3] << ") (" << need[0] << ", " << need[2] << ")" << abs(need[0]-need[1]) * abs(need[2] - need[3]) << endl;
vector<int> need4 = ha(q4);
cout << "Q4: (" << need[1] << ", "<<need[3] << ") (" << need[0] << ", " << need[2] << ")" << abs(need[0]-need[1]) * abs(need[2] - need[3]) << endl;
} | # 2069857, 2024-11-02 11:30:32, -----P---- (10%)
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
using namespace std;
int max(vector<int>q)
{
int max;
max = q[0];
for(auto i:q)
{
if(max < i)
{
max = i;
}
}
return max;
}
int min(vector<int>q)
{
int min;
min = q[0];
for(auto i:q)
{
if(min > i)
{
min = i;
}
}
return min;
}
int main()
{
vector<pair<int,int>> a,q1,q2,q3,q4;
vector<int>q1x,q1y,q2x,q2y,q3x,q3y,q4x,q4y;
int n,b,c ,i;
cin >> n;
for(i=0;i<n;i++)
{
cin >> b >> c;
a.push_back(make_pair(b,c));
}
for(auto j:a)
{
if(j.first > 0 && j.second > 0)
{
q1x.push_back(j.first);
q1y.push_back(j.second);
}
else if(j.first < 0 && j.second > 0)
{
q2x.push_back(j.first);
q2y.push_back(j.second);
}
else if(j.first < 0 && j.second < 0)
{
q3x.push_back(j.first);
q3y.push_back(j.second);
}
else if(j.first > 0 && j.second < 0)
{
q4x.push_back(j.first);
q4y.push_back(j.second);
}
}
if(q1x.size() != 0)cout << "Q1: (" << min(q1x) << ", "<<min(q1y) << ") (" << max(q1x) << ", " << max(q1y) << ")" << abs(max(q1x)-min(q1x)) * abs(max(q1y) - min(q1y)) << endl;
if(q2x.size() != 0)cout << "Q2: (" << min(q2x) << ", "<<min(q2y) << ") (" << max(q2x) << ", " << max(q2y) << ")" << abs(max(q2x)-min(q2x)) * abs(max(q2y) - min(q2y)) << endl;
if(q3x.size() != 0)cout << "Q3: (" << min(q3x) << ", "<<min(q3y) << ") (" << max(q3x) << ", " << max(q3y) << ")" << abs(max(q3x)-min(q3x)) * abs(max(q3y) - min(q3y)) << endl;
if(q4x.size() != 0)cout << "Q4: (" << min(q4x) << ", "<<min(q4y) << ") (" << max(q4x) << ", " << max(q4y) << ")" << abs(max(q4x)-min(q4x)) * abs(max(q4y) - min(q4y)) << endl;
if(q1x.size() == 0 && q2x.size() == 0 && q3x.size()==0 && q4x.size() ==0)
{
cout << "No point in any quadrant";
}
} | # 2069879, 2024-11-02 11:32:06, PPPPPPPPPP (100%)
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
using namespace std;
int max(vector<int>q)
{
int max;
max = q[0];
for(auto i:q)
{
if(max < i)
{
max = i;
}
}
return max;
}
int min(vector<int>q)
{
int min;
min = q[0];
for(auto i:q)
{
if(min > i)
{
min = i;
}
}
return min;
}
int main()
{
vector<pair<int,int>> a,q1,q2,q3,q4;
vector<int>q1x,q1y,q2x,q2y,q3x,q3y,q4x,q4y;
int n,b,c ,i;
cin >> n;
for(i=0;i<n;i++)
{
cin >> b >> c;
a.push_back(make_pair(b,c));
}
for(auto j:a)
{
if(j.first > 0 && j.second > 0)
{
q1x.push_back(j.first);
q1y.push_back(j.second);
}
else if(j.first < 0 && j.second > 0)
{
q2x.push_back(j.first);
q2y.push_back(j.second);
}
else if(j.first < 0 && j.second < 0)
{
q3x.push_back(j.first);
q3y.push_back(j.second);
}
else if(j.first > 0 && j.second < 0)
{
q4x.push_back(j.first);
q4y.push_back(j.second);
}
}
if(q1x.size() != 0)cout << "Q1: (" << min(q1x) << ", "<<min(q1y) << ") (" << max(q1x) << ", " << max(q1y) << ") " << abs(max(q1x)-min(q1x)) * abs(max(q1y) - min(q1y)) << endl;
if(q2x.size() != 0)cout << "Q2: (" << min(q2x) << ", "<<min(q2y) << ") (" << max(q2x) << ", " << max(q2y) << ") " << abs(max(q2x)-min(q2x)) * abs(max(q2y) - min(q2y)) << endl;
if(q3x.size() != 0)cout << "Q3: (" << min(q3x) << ", "<<min(q3y) << ") (" << max(q3x) << ", " << max(q3y) << ") " << abs(max(q3x)-min(q3x)) * abs(max(q3y) - min(q3y)) << endl;
if(q4x.size() != 0)cout << "Q4: (" << min(q4x) << ", "<<min(q4y) << ") (" << max(q4x) << ", " << max(q4y) << ") " << abs(max(q4x)-min(q4x)) * abs(max(q4y) - min(q4y)) << endl;
if(q1x.size() == 0 && q2x.size() == 0 && q3x.size()==0 && q4x.size() ==0)
{
cout << "No point in any quadrant";
}
} |
# 2071105, 2024-11-02 13:56:02, Compilation error (0%)
#include <bits/stdc++.h>
#include <cmath>
using namespace std;
int main(){
int n;
cin>>n;
int q1xm,q2xm,q3xm,q4xm;
int q1xl,q2xl,q3xl,q4xl;
int q1ym,q2ym,q3ym,q4ym;
int q1yl,q2yl,q3yl,q4yl;
vector<int> q1,q2,q3,q4;
int x,y;
while(n--){
cin>>x>>y;
if(x>0&&y>0){
q1.push_back(x);
if(x>q1xm) q1xm=x;
if(x<q1xl) q1xl=x;
if(y>q1ym) q1ym=y;
if(y<q1yl) q1yl=y;
}
if(x<0&&y>0){
q2.push_back(x);
if(x>q2xm) q2xm=x;
if(x<q2xl) q2xl=x;
if(y>q2ym) q2ym=y;
if(y<q2yl) q2yl=y;
}
if(x<0&&y<0){
q3.push_back(x);
if(x>q3xm) q3xm=x;
if(x<q3xl) q3xl=x;
if(y>q3ym) q3ym=y;
if(y<q3yl) q3yl=y;
}
if(x>0&&y<0){
q4.push_back(x);
if(x>q4xm) q4xm=x;
if(x<q4xl) q4xl=x;
if(y>q4ym) q4ym=y;
if(y<q4yl) q4yl=y;
}
}
if(!q1.empty()) cout<<"Q1: ("<<q1xl<<","<<q1yl<<") ("<<q1xm<<","<<q1ym<<") "<<(q1xm-q1xl)*(q1ym-q1yl)<<endl;
if(!q2.empty()) cout<<"Q2: ("<<q2xl<<","<<q2y1<<") ("<<q2xm<<","<<q2ym<<") "<<(q2xm-q2xl)*(q2ym-q2yl)<<endl;
if(!q3.empty()) cout<<"Q3: ("<<q3xl<<","<<q3y1<<") ("<<q3xm<<","<<q3ym<<") "<<(q3xm-q3xl)*(q3ym-q3yl)<<endl;
if(!q4.empty()) cout<<"Q4: ("<<q4xl<<","<<q4y1<<") ("<<q4xm<<","<<q4ym<<") "<<(q4xm-q4xl)*(q4ym-q4yl)<<endl;
} | # 2071109, 2024-11-02 13:56:46, ---------- (0%)
#include <bits/stdc++.h>
#include <cmath>
using namespace std;
int main(){
int n;
cin>>n;
int q1xm,q2xm,q3xm,q4xm;
int q1xl,q2xl,q3xl,q4xl;
int q1ym,q2ym,q3ym,q4ym;
int q1yl,q2yl,q3yl,q4yl;
vector<int> q1,q2,q3,q4;
int x,y;
while(n--){
cin>>x>>y;
if(x>0&&y>0){
q1.push_back(x);
if(x>q1xm) q1xm=x;
if(x<q1xl) q1xl=x;
if(y>q1ym) q1ym=y;
if(y<q1yl) q1yl=y;
}
if(x<0&&y>0){
q2.push_back(x);
if(x>q2xm) q2xm=x;
if(x<q2xl) q2xl=x;
if(y>q2ym) q2ym=y;
if(y<q2yl) q2yl=y;
}
if(x<0&&y<0){
q3.push_back(x);
if(x>q3xm) q3xm=x;
if(x<q3xl) q3xl=x;
if(y>q3ym) q3ym=y;
if(y<q3yl) q3yl=y;
}
if(x>0&&y<0){
q4.push_back(x);
if(x>q4xm) q4xm=x;
if(x<q4xl) q4xl=x;
if(y>q4ym) q4ym=y;
if(y<q4yl) q4yl=y;
}
}
if(!q1.empty()) cout<<"Q1: ("<<q1xl<<","<<q1yl<<") ("<<q1xm<<","<<q1ym<<") "<<(q1xm-q1xl)*(q1ym-q1yl)<<endl;
if(!q2.empty()) cout<<"Q2: ("<<q2xl<<","<<q2yl<<") ("<<q2xm<<","<<q2ym<<") "<<(q2xm-q2xl)*(q2ym-q2yl)<<endl;
if(!q3.empty()) cout<<"Q3: ("<<q3xl<<","<<q3yl<<") ("<<q3xm<<","<<q3ym<<") "<<(q3xm-q3xl)*(q3ym-q3yl)<<endl;
if(!q4.empty()) cout<<"Q4: ("<<q4xl<<","<<q4yl<<") ("<<q4xm<<","<<q4ym<<") "<<(q4xm-q4xl)*(q4ym-q4yl)<<endl;
} | # 2071129, 2024-11-02 13:58:59, ---------- (0%)
#include <bits/stdc++.h>
#include <cmath>
using namespace std;
int main(){
int n;
cin>>n;
int q1xm=0,q2xm=0,q3xm=0,q4xm=0;
int q1xl=9999,q2xl=9999,q3xl=9999,q4xl=9999;
int q1ym=0,q2ym=0,q3ym=0,q4ym=0;
int q1yl=9999,q2yl=9999,q3yl=9999,q4yl=9999;
vector<int> q1,q2,q3,q4;
int x,y;
while(n--){
cin>>x>>y;
if(x>0&&y>0){
q1.push_back(x);
if(x>q1xm) q1xm=x;
if(x<q1xl) q1xl=x;
if(y>q1ym) q1ym=y;
if(y<q1yl) q1yl=y;
}
if(x<0&&y>0){
q2.push_back(x);
if(x>q2xm) q2xm=x;
if(x<q2xl) q2xl=x;
if(y>q2ym) q2ym=y;
if(y<q2yl) q2yl=y;
}
if(x<0&&y<0){
q3.push_back(x);
if(x>q3xm) q3xm=x;
if(x<q3xl) q3xl=x;
if(y>q3ym) q3ym=y;
if(y<q3yl) q3yl=y;
}
if(x>0&&y<0){
q4.push_back(x);
if(x>q4xm) q4xm=x;
if(x<q4xl) q4xl=x;
if(y>q4ym) q4ym=y;
if(y<q4yl) q4yl=y;
}
}
if(!q1.empty()) cout<<"Q1: ("<<q1xl<<","<<q1yl<<") ("<<q1xm<<","<<q1ym<<") "<<(q1xm-q1xl)*(q1ym-q1yl)<<endl;
if(!q2.empty()) cout<<"Q2: ("<<q2xl<<","<<q2yl<<") ("<<q2xm<<","<<q2ym<<") "<<(q2xm-q2xl)*(q2ym-q2yl)<<endl;
if(!q3.empty()) cout<<"Q3: ("<<q3xl<<","<<q3yl<<") ("<<q3xm<<","<<q3ym<<") "<<(q3xm-q3xl)*(q3ym-q3yl)<<endl;
if(!q4.empty()) cout<<"Q4: ("<<q4xl<<","<<q4yl<<") ("<<q4xm<<","<<q4ym<<") "<<(q4xm-q4xl)*(q4ym-q4yl)<<endl;
} | # 2071136, 2024-11-02 14:00:15, P--------- (10%)
#include <bits/stdc++.h>
#include <cmath>
using namespace std;
int main(){
int n;
cin>>n;
int q1xm=0,q2xm=0,q3xm=0,q4xm=0;
int q1xl=9999,q2xl=9999,q3xl=9999,q4xl=9999;
int q1ym=0,q2ym=0,q3ym=0,q4ym=0;
int q1yl=9999,q2yl=9999,q3yl=9999,q4yl=9999;
vector<int> q1,q2,q3,q4;
int x,y;
while(n--){
cin>>x>>y;
if(x>0&&y>0){
q1.push_back(x);
if(x>q1xm) q1xm=x;
if(x<q1xl) q1xl=x;
if(y>q1ym) q1ym=y;
if(y<q1yl) q1yl=y;
}
if(x<0&&y>0){
q2.push_back(x);
if(x>q2xm) q2xm=x;
if(x<q2xl) q2xl=x;
if(y>q2ym) q2ym=y;
if(y<q2yl) q2yl=y;
}
if(x<0&&y<0){
q3.push_back(x);
if(x>q3xm) q3xm=x;
if(x<q3xl) q3xl=x;
if(y>q3ym) q3ym=y;
if(y<q3yl) q3yl=y;
}
if(x>0&&y<0){
q4.push_back(x);
if(x>q4xm) q4xm=x;
if(x<q4xl) q4xl=x;
if(y>q4ym) q4ym=y;
if(y<q4yl) q4yl=y;
}
}
if(!q1.empty()) cout<<"Q1: ("<<q1xl<<", "<<q1yl<<") ("<<q1xm<<", "<<q1ym<<") "<<(q1xm-q1xl)*(q1ym-q1yl)<<endl;
if(!q2.empty()) cout<<"Q2: ("<<q2xl<<", "<<q2yl<<") ("<<q2xm<<", "<<q2ym<<") "<<(q2xm-q2xl)*(q2ym-q2yl)<<endl;
if(!q3.empty()) cout<<"Q3: ("<<q3xl<<", "<<q3yl<<") ("<<q3xm<<", "<<q3ym<<") "<<(q3xm-q3xl)*(q3ym-q3yl)<<endl;
if(!q4.empty()) cout<<"Q4: ("<<q4xl<<", "<<q4yl<<") ("<<q4xm<<", "<<q4ym<<") "<<(q4xm-q4xl)*(q4ym-q4yl)<<endl;
} | # 2071160, 2024-11-02 14:02:46, PPPPPPPPPP (100%)
#include <bits/stdc++.h>
#include <cmath>
using namespace std;
int main(){
int n;
cin>>n;
int q1xm=-9999,q2xm=-9999,q3xm=-9999,q4xm=-9999;
int q1xl=9999,q2xl=9999,q3xl=9999,q4xl=9999;
int q1ym=-9999,q2ym=-9999,q3ym=-9999,q4ym=-9999;
int q1yl=9999,q2yl=9999,q3yl=9999,q4yl=9999;
vector<int> q1,q2,q3,q4;
int x,y;
while(n--){
cin>>x>>y;
if(x>0&&y>0){
q1.push_back(x);
if(x>q1xm) q1xm=x;
if(x<q1xl) q1xl=x;
if(y>q1ym) q1ym=y;
if(y<q1yl) q1yl=y;
}
if(x<0&&y>0){
q2.push_back(x);
if(x>q2xm) q2xm=x;
if(x<q2xl) q2xl=x;
if(y>q2ym) q2ym=y;
if(y<q2yl) q2yl=y;
}
if(x<0&&y<0){
q3.push_back(x);
if(x>q3xm) q3xm=x;
if(x<q3xl) q3xl=x;
if(y>q3ym) q3ym=y;
if(y<q3yl) q3yl=y;
}
if(x>0&&y<0){
q4.push_back(x);
if(x>q4xm) q4xm=x;
if(x<q4xl) q4xl=x;
if(y>q4ym) q4ym=y;
if(y<q4yl) q4yl=y;
}
}
if(q1.empty()&&q2.empty()&&q3.empty()&&q4.empty()) cout<<"No point in any quadrant";
if(!q1.empty()) cout<<"Q1: ("<<q1xl<<", "<<q1yl<<") ("<<q1xm<<", "<<q1ym<<") "<<(q1xm-q1xl)*(q1ym-q1yl)<<endl;
if(!q2.empty()) cout<<"Q2: ("<<q2xl<<", "<<q2yl<<") ("<<q2xm<<", "<<q2ym<<") "<<(q2xm-q2xl)*(q2ym-q2yl)<<endl;
if(!q3.empty()) cout<<"Q3: ("<<q3xl<<", "<<q3yl<<") ("<<q3xm<<", "<<q3ym<<") "<<(q3xm-q3xl)*(q3ym-q3yl)<<endl;
if(!q4.empty()) cout<<"Q4: ("<<q4xl<<", "<<q4yl<<") ("<<q4xm<<", "<<q4ym<<") "<<(q4xm-q4xl)*(q4ym-q4yl)<<endl;
} |
# 2069235, 2024-11-02 10:28:58, PPPPP-PPPP (90%)
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
void make_square (vector <pair<int, int>> q) {
int min_x, min_y, max_x, max_y;
bool first = true;
for (auto itr : q) {
if (first) {
min_x = itr.first;
max_x = itr.first;
min_y = itr.second;
max_y = itr.second;
first = false;
}
if (itr.first < min_x) {
min_x = itr.first;
}
if (itr.first > max_x) {
max_x = itr.first;
}
if (itr.second < min_y) {
min_y = itr.second;
}
if (itr.second > max_y) {
max_y = itr.second;
}
}
int area = (max_x - min_x) * (max_y - min_y);
string output = '(' + to_string(min_x) + ", " + to_string(min_y)
+ ") (" + to_string(max_x) + ", " + to_string(max_y)
+ ") " + to_string(area);
cout << output << endl;
}
int main () {
int n; cin >> n;
vector <pair<int, int>> q1, q2, q3, q4;
int x, y, noquad;
for (int i = 0; i < n; i++) {
cin >> x >> y;
if (x > 0 && y > 0) {
q1.push_back({x, y});
} else if (x < 0 && y > 0) {
q2.push_back({x, y});
} else if (x < 0 && y < 0) {
q3.push_back({x, y});
} else if (x > 0 && y < 0) {
q4.push_back({x, y});
} else noquad++;
}
if (noquad == n) {
cout << "No point in any quadrant" << endl;
} else {
if (!q1.empty()) {
cout << "Q1: ";
make_square(q1);
}
if (!q2.empty()) {
cout << "Q2: ";
make_square(q2);
}
if (!q3.empty()) {
cout << "Q3: ";
make_square(q3);
}
if (!q4.empty()) {
cout << "Q4: ";
make_square(q4);
}
}
} | # 2069249, 2024-11-02 10:31:27, PPPP--P-PP (70%)
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
void make_square (vector <pair<int, int>> q) {
int min_x, min_y, max_x, max_y;
bool first = true;
for (auto itr : q) {
if (first) {
min_x = itr.first;
max_x = itr.first;
min_y = itr.second;
max_y = itr.second;
first = false;
}
if (itr.first < min_x) {
min_x = itr.first;
}
if (itr.first > max_x) {
max_x = itr.first;
}
if (itr.second < min_y) {
min_y = itr.second;
}
if (itr.second > max_y) {
max_y = itr.second;
}
}
int area = (max_x - min_x) * (max_y - min_y);
string output = '(' + to_string(min_x) + ", " + to_string(min_y)
+ ") (" + to_string(max_x) + ", " + to_string(max_y)
+ ") " + to_string(area);
cout << output << endl;
}
int main () {
int n; cin >> n;
vector <pair<int, int>> q1, q2, q3, q4;
int x, y, noquad;
for (int i = 0; i < n; i++) {
cin >> x >> y;
if (x > 0 && y > 0) {
q1.push_back({x, y});
} else if (x < 0 && y > 0) {
q2.push_back({x, y});
} else if (x < 0 && y < 0) {
q3.push_back({x, y});
} else if (x > 0 && y < 0) {
q4.push_back({x, y});
} else noquad++;
}
if (noquad == n) {
cout << "No point in any quadrant" << endl;
} else {
if (!q1.empty() && q1.size() != 1) {
cout << "Q1: ";
make_square(q1);
}
if (!q2.empty() && q2.size() != 1) {
cout << "Q2: ";
make_square(q2);
}
if (!q3.empty() && q3.size() != 1) {
cout << "Q3: ";
make_square(q3);
}
if (!q4.empty() && q4.size() != 1) {
cout << "Q4: ";
make_square(q4);
}
}
} | # 2069305, 2024-11-02 10:35:15, PPPP--PPPP (80%)
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
void make_square (vector <pair<int, int>> q) {
int min_x, min_y, max_x, max_y;
bool first = true;
for (auto itr : q) {
if (first) {
min_x = itr.first;
max_x = itr.first;
min_y = itr.second;
max_y = itr.second;
first = false;
}
if (itr.first < min_x) {
min_x = itr.first;
}
if (itr.first > max_x) {
max_x = itr.first;
}
if (itr.second < min_y) {
min_y = itr.second;
}
if (itr.second > max_y) {
max_y = itr.second;
}
}
int area = (max_x - min_x) * (max_y - min_y);
string output = '(' + to_string(min_x) + ", " + to_string(min_y)
+ ") (" + to_string(max_x) + ", " + to_string(max_y)
+ ") " + to_string(area);
cout << output << endl;
}
int main () {
int n; cin >> n;
vector <pair<int, int>> q1, q2, q3, q4;
int x, y, noquad;
for (int i = 0; i < n; i++) {
cin >> x >> y;
if (x > 0 && y > 0) {
q1.push_back({x, y});
} else if (x < 0 && y > 0) {
q2.push_back({x, y});
} else if (x < 0 && y < 0) {
q3.push_back({x, y});
} else if (x > 0 && y < 0) {
q4.push_back({x, y});
} else noquad++;
}
if (noquad == n || (q1.size() == 1 && q2.size() == 1 && q3.size() == 1 && q4.size() == 1)) {
cout << "No point in any quadrant" << endl;
} else {
if (!q1.empty()) {
cout << "Q1: ";
make_square(q1);
}
if (!q2.empty()) {
cout << "Q2: ";
make_square(q2);
}
if (!q3.empty()) {
cout << "Q3: ";
make_square(q3);
}
if (!q4.empty()) {
cout << "Q4: ";
make_square(q4);
}
}
} | # 2069361, 2024-11-02 10:39:46, PPPPP-PPPP (90%)
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
void make_square (vector <pair<int, int>> q) {
int min_x, min_y, max_x, max_y;
bool first = true;
for (auto itr : q) {
if (first) {
min_x = itr.first;
max_x = itr.first;
min_y = itr.second;
max_y = itr.second;
first = false;
}
if (itr.first < min_x) {
min_x = itr.first;
}
if (itr.first > max_x) {
max_x = itr.first;
}
if (itr.second < min_y) {
min_y = itr.second;
}
if (itr.second > max_y) {
max_y = itr.second;
}
}
int area = (max_x - min_x) * (max_y - min_y);
string output = '(' + to_string(min_x) + ", " + to_string(min_y)
+ ") (" + to_string(max_x) + ", " + to_string(max_y)
+ ") " + to_string(area);
cout << output << endl;
}
int main () {
int n; cin >> n;
vector <pair<int, int>> q1, q2, q3, q4;
int x, y, noquad;
for (int i = 0; i < n; i++) {
cin >> x >> y;
if (x > 0 && y > 0) {
q1.push_back({x, y});
} else if (x < 0 && y > 0) {
q2.push_back({x, y});
} else if (x < 0 && y < 0) {
q3.push_back({x, y});
} else if (x > 0 && y < 0) {
q4.push_back({x, y});
} else noquad++;
}
if (noquad == n) {
cout << "No point in any quadrant";
} else {
if (!q1.empty()) {
cout << "Q1: ";
make_square(q1);
}
if (!q2.empty()) {
cout << "Q2: ";
make_square(q2);
}
if (!q3.empty()) {
cout << "Q3: ";
make_square(q3);
}
if (!q4.empty()) {
cout << "Q4: ";
make_square(q4);
}
}
} | # 2069384, 2024-11-02 10:42:24, PPPPPPPPPP (100%)
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
void make_square (vector <pair<int, int>> q) {
int min_x, min_y, max_x, max_y;
bool first = true;
for (auto itr : q) {
if (first) {
min_x = itr.first;
max_x = itr.first;
min_y = itr.second;
max_y = itr.second;
first = false;
}
if (itr.first < min_x) {
min_x = itr.first;
}
if (itr.first > max_x) {
max_x = itr.first;
}
if (itr.second < min_y) {
min_y = itr.second;
}
if (itr.second > max_y) {
max_y = itr.second;
}
}
int area = (max_x - min_x) * (max_y - min_y);
string output = '(' + to_string(min_x) + ", " + to_string(min_y)
+ ") (" + to_string(max_x) + ", " + to_string(max_y)
+ ") " + to_string(area);
cout << output << endl;
}
int main () {
int n; cin >> n;
vector <pair<int, int>> q1, q2, q3, q4;
int x, y, noquad = 0;
for (int i = 0; i < n; i++) {
cin >> x >> y;
if (x > 0 && y > 0) {
q1.push_back({x, y});
} else if (x < 0 && y > 0) {
q2.push_back({x, y});
} else if (x < 0 && y < 0) {
q3.push_back({x, y});
} else if (x > 0 && y < 0) {
q4.push_back({x, y});
} else noquad++;
}
if (noquad == n) {
cout << "No point in any quadrant";
} else {
if (!q1.empty()) {
cout << "Q1: ";
make_square(q1);
}
if (!q2.empty()) {
cout << "Q2: ";
make_square(q2);
}
if (!q3.empty()) {
cout << "Q3: ";
make_square(q3);
}
if (!q4.empty()) {
cout << "Q4: ";
make_square(q4);
}
}
} |
# 2071473, 2024-11-02 14:38:45, P----P---- (20%)
#include <iostream>
#include <climits>
#include <vector>
using namespace std;
int main(){
//minX, maxX, minY, maxY
vector<int> Q1(4, 0); Q1[1] = INT_MIN; Q1[3] = INT_MIN; Q1[0] = INT_MAX; Q1[2] = INT_MAX;
vector<int> Q2(4, 0); Q2[1] = INT_MIN; Q2[3] = INT_MIN; Q2[0] = INT_MAX; Q2[2] = INT_MAX;
vector<int> Q3(4, 0); Q3[1] = INT_MIN; Q3[3] = INT_MIN; Q3[0] = INT_MAX; Q3[2] = INT_MAX;
vector<int> Q4(4, 0); Q4[1] = INT_MIN; Q4[3] = INT_MIN; Q4[0] = INT_MAX; Q4[2] = INT_MAX;
int n, x, y;
cin >> n;
bool c1 = false, c2 = false, c3 = false, c4 =false;
for(int i = 0; i < n; i++){
cin >> x >> y;
if(x == 0 || y == 0){
continue;
}
else if(x > 0 || y > 0){
//Q1
if(x < Q1[0]) Q1[0] = x;
if(x > Q1[1]) Q1[1] = x;
if(y < Q1[2]) Q1[2] = y;
if(y > Q1[3]) Q1[3] = y;
c1 = true;
}
else if(x < 0 || y > 0){
//Q2
if(x < Q2[0]) Q2[0] = x;
if(x > Q2[1]) Q2[1] = x;
if(y < Q2[2]) Q2[2] = y;
if(y > Q2[3]) Q2[3] = y;
c2 = true;
}
else if(x < 0 || y < 0){
//Q3
if(x < Q3[0]) Q3[0] = x;
if(x > Q3[1]) Q3[1] = x;
if(y < Q3[2]) Q3[2] = y;
if(y > Q3[3]) Q3[3] = y;
c3 = true;
}
else if(x > 0 || y < 0){
//Q4
if(x < Q4[0]) Q4[0] = x;
if(x > Q4[1]) Q4[1] = x;
if(y < Q4[2]) Q4[2] = y;
if(y > Q4[3]) Q4[3] = y;
c4 = true;
}
}
int area1 = (abs(Q1[1])-abs(Q1[0])) * (abs(Q1[3]-abs(Q1[2])));
int area2 = (abs(Q2[1])-abs(Q2[0])) * (abs(Q2[3]-abs(Q2[2])));
int area3 = (abs(Q3[1])-abs(Q3[0])) * (abs(Q3[3]-abs(Q3[2])));
int area4 = (abs(Q4[1])-abs(Q4[0])) * (abs(Q4[3]-abs(Q4[2])));
if(!c1 && !c2 && !c3 && !c4){
cout << "No point in any quadrant";
}
else{
if(c1){
cout << "Q1: (" << Q1[0] << ", " << Q1[2] << ") (" << Q1[1] << ", " << Q1[3] << ") " << area1 << endl;
}
if(c2){
cout << "Q2: (" << Q2[0] << ", " << Q2[2] << ") (" << Q2[1] << ", " << Q2[3] << ") " << area1 << endl;
}
if(c3){
cout << "Q3: (" << Q3[0] << ", " << Q3[2] << ") (" << Q3[1] << ", " << Q3[3] << ") " << area1 << endl;
}
if(c4){
cout << "Q4: (" << Q4[0] << ", " << Q4[2] << ") (" << Q4[1] << ", " << Q4[3] << ") " << area1 << endl;
}
}
} | # 2071810, 2024-11-02 15:18:12, P---PP---- (30%)
#include <iostream>
#include <climits>
#include <vector>
using namespace std;
int main(){
//minX, maxX, minY, maxY
vector<int> Q1(4, 0); Q1[1] = INT_MIN; Q1[3] = INT_MIN; Q1[0] = INT_MAX; Q1[2] = INT_MAX;
vector<int> Q2(4, 0); Q2[1] = INT_MIN; Q2[3] = INT_MIN; Q2[0] = INT_MAX; Q2[2] = INT_MAX;
vector<int> Q3(4, 0); Q3[1] = INT_MIN; Q3[3] = INT_MIN; Q3[0] = INT_MAX; Q3[2] = INT_MAX;
vector<int> Q4(4, 0); Q4[1] = INT_MIN; Q4[3] = INT_MIN; Q4[0] = INT_MAX; Q4[2] = INT_MAX;
int n, x, y;
cin >> n;
bool c1 = false, c2 = false, c3 = false, c4 =false;
for(int i = 0; i < n; i++){
cin >> x >> y;
if(x == 0 || y == 0){
continue;
}
else if(x > 0 && y > 0){
//Q1
if(x < Q1[0]) Q1[0] = x;
if(x > Q1[1]) Q1[1] = x;
if(y < Q1[2]) Q1[2] = y;
if(y > Q1[3]) Q1[3] = y;
c1 = true;
}
else if(x < 0 && y > 0){
//Q2
if(x < Q2[0]) Q2[0] = x;
if(x > Q2[1]) Q2[1] = x;
if(y < Q2[2]) Q2[2] = y;
if(y > Q2[3]) Q2[3] = y;
c2 = true;
}
else if(x < 0 && y < 0){
//Q3
if(x < Q3[0]) Q3[0] = x;
if(x > Q3[1]) Q3[1] = x;
if(y < Q3[2]) Q3[2] = y;
if(y > Q3[3]) Q3[3] = y;
c3 = true;
}
else if(x > 0 && y < 0){
//Q4
if(x < Q4[0]) Q4[0] = x;
if(x > Q4[1]) Q4[1] = x;
if(y < Q4[2]) Q4[2] = y;
if(y > Q4[3]) Q4[3] = y;
c4 = true;
}
}
int area1 = (abs(Q1[1])-abs(Q1[0])) * (abs(Q1[3]-abs(Q1[2])));
int area2 = (abs(Q2[1])-abs(Q2[0])) * (abs(Q2[3]-abs(Q2[2])));
int area3 = (abs(Q3[1])-abs(Q3[0])) * (abs(Q3[3]-abs(Q3[2])));
int area4 = (abs(Q4[1])-abs(Q4[0])) * (abs(Q4[3]-abs(Q4[2])));
if(!c1 && !c2 && !c3 && !c4){
cout << "No point in any quadrant";
}
else{
if(c1){
cout << "Q1: (" << Q1[0] << ", " << Q1[2] << ") (" << Q1[1] << ", " << Q1[3] << ") " << area1 << endl;
}
if(c2){
cout << "Q2: (" << Q2[0] << ", " << Q2[2] << ") (" << Q2[1] << ", " << Q2[3] << ") " << area1 << endl;
}
if(c3){
cout << "Q3: (" << Q3[0] << ", " << Q3[2] << ") (" << Q3[1] << ", " << Q3[3] << ") " << area1 << endl;
}
if(c4){
cout << "Q4: (" << Q4[0] << ", " << Q4[2] << ") (" << Q4[1] << ", " << Q4[3] << ") " << area1 << endl;
}
}
} | # 2071823, 2024-11-02 15:19:12, P---PP---- (30%)
#include <iostream>
#include <climits>
#include <vector>
using namespace std;
int main(){
//minX, maxX, minY, maxY
vector<int> Q1(4, 0); Q1[1] = INT_MIN; Q1[3] = INT_MIN; Q1[0] = INT_MAX; Q1[2] = INT_MAX;
vector<int> Q2(4, 0); Q2[1] = INT_MIN; Q2[3] = INT_MIN; Q2[0] = INT_MAX; Q2[2] = INT_MAX;
vector<int> Q3(4, 0); Q3[1] = INT_MIN; Q3[3] = INT_MIN; Q3[0] = INT_MAX; Q3[2] = INT_MAX;
vector<int> Q4(4, 0); Q4[1] = INT_MIN; Q4[3] = INT_MIN; Q4[0] = INT_MAX; Q4[2] = INT_MAX;
int n, x, y;
cin >> n;
bool c1 = false, c2 = false, c3 = false, c4 =false;
for(int i = 0; i < n; i++){
cin >> x >> y;
if(x == 0 || y == 0){
continue;
}
else if(x > 0 && y > 0){
//Q1
if(x < Q1[0]) Q1[0] = x;
if(x > Q1[1]) Q1[1] = x;
if(y < Q1[2]) Q1[2] = y;
if(y > Q1[3]) Q1[3] = y;
c1 = true;
}
else if(x < 0 && y > 0){
//Q2
if(x < Q2[0]) Q2[0] = x;
if(x > Q2[1]) Q2[1] = x;
if(y < Q2[2]) Q2[2] = y;
if(y > Q2[3]) Q2[3] = y;
c2 = true;
}
else if(x < 0 && y < 0){
//Q3
if(x < Q3[0]) Q3[0] = x;
if(x > Q3[1]) Q3[1] = x;
if(y < Q3[2]) Q3[2] = y;
if(y > Q3[3]) Q3[3] = y;
c3 = true;
}
else if(x > 0 && y < 0){
//Q4
if(x < Q4[0]) Q4[0] = x;
if(x > Q4[1]) Q4[1] = x;
if(y < Q4[2]) Q4[2] = y;
if(y > Q4[3]) Q4[3] = y;
c4 = true;
}
}
int area1 = (abs(Q1[1])-abs(Q1[0])) * (abs(Q1[3]-abs(Q1[2])));
int area2 = (abs(Q2[1])-abs(Q2[0])) * (abs(Q2[3]-abs(Q2[2])));
int area3 = (abs(Q3[1])-abs(Q3[0])) * (abs(Q3[3]-abs(Q3[2])));
int area4 = (abs(Q4[1])-abs(Q4[0])) * (abs(Q4[3]-abs(Q4[2])));
if(!c1 && !c2 && !c3 && !c4){
cout << "No point in any quadrant";
}
else{
if(c1){
cout << "Q1: (" << Q1[0] << ", " << Q1[2] << ") (" << Q1[1] << ", " << Q1[3] << ") " << area1 << endl;
}
if(c2){
cout << "Q2: (" << Q2[0] << ", " << Q2[2] << ") (" << Q2[1] << ", " << Q2[3] << ") " << area2 << endl;
}
if(c3){
cout << "Q3: (" << Q3[0] << ", " << Q3[2] << ") (" << Q3[1] << ", " << Q3[3] << ") " << area3 << endl;
}
if(c4){
cout << "Q4: (" << Q4[0] << ", " << Q4[2] << ") (" << Q4[1] << ", " << Q4[3] << ") " << area4 << endl;
}
}
} | # 2071834, 2024-11-02 15:20:38, P---PP---- (30%)
#include <iostream>
#include <climits>
#include <vector>
using namespace std;
int main(){
//minX, maxX, minY, maxY
vector<int> Q1(4, 0); Q1[1] = INT_MIN; Q1[3] = INT_MIN; Q1[0] = INT_MAX; Q1[2] = INT_MAX;
vector<int> Q2(4, 0); Q2[1] = INT_MIN; Q2[3] = INT_MIN; Q2[0] = INT_MAX; Q2[2] = INT_MAX;
vector<int> Q3(4, 0); Q3[1] = INT_MIN; Q3[3] = INT_MIN; Q3[0] = INT_MAX; Q3[2] = INT_MAX;
vector<int> Q4(4, 0); Q4[1] = INT_MIN; Q4[3] = INT_MIN; Q4[0] = INT_MAX; Q4[2] = INT_MAX;
int n, x, y;
cin >> n;
bool c1 = false, c2 = false, c3 = false, c4 =false;
for(int i = 0; i < n; i++){
cin >> x >> y;
if(x == 0 || y == 0){
continue;
}
else if(x > 0 && y > 0){
//Q1
if(x < Q1[0]) Q1[0] = x;
if(x > Q1[1]) Q1[1] = x;
if(y < Q1[2]) Q1[2] = y;
if(y > Q1[3]) Q1[3] = y;
c1 = true;
}
else if(x < 0 && y > 0){
//Q2
if(x < Q2[0]) Q2[0] = x;
if(x > Q2[1]) Q2[1] = x;
if(y < Q2[2]) Q2[2] = y;
if(y > Q2[3]) Q2[3] = y;
c2 = true;
}
else if(x < 0 && y < 0){
//Q3
if(x < Q3[0]) Q3[0] = x;
if(x > Q3[1]) Q3[1] = x;
if(y < Q3[2]) Q3[2] = y;
if(y > Q3[3]) Q3[3] = y;
c3 = true;
}
else if(x > 0 && y < 0){
//Q4
if(x < Q4[0]) Q4[0] = x;
if(x > Q4[1]) Q4[1] = x;
if(y < Q4[2]) Q4[2] = y;
if(y > Q4[3]) Q4[3] = y;
c4 = true;
}
}
int area1 = (abs(Q1[1])-abs(Q1[0])) * (abs(Q1[3]-abs(Q1[2])));
int area2 = (abs(Q2[1])-abs(Q2[0])) * (abs(Q2[3]-abs(Q2[2])));
int area3 = (abs(Q3[1])-abs(Q3[0])) * (abs(Q3[3]-abs(Q3[2])));
int area4 = (abs(Q4[1])-abs(Q4[0])) * (abs(Q4[3]-abs(Q4[2])));
if(!c1 && !c2 && !c3 && !c4){
cout << "No point in any quadrant";
}
else{
if(c1){
cout << "Q1: (" << Q1[0] << ", " << Q1[2] << ") (" << Q1[1] << ", " << Q1[3] << ") " << area1 << endl;
}
if(c2){
cout << "Q2: (" << Q2[0] << ", " << Q2[2] << ") (" << Q2[1] << ", " << Q2[3] << ") " << area2 << endl;
}
if(c3){
cout << "Q3: (" << Q3[0] << ", " << Q3[2] << ") (" << Q3[1] << ", " << Q3[3] << ") " << area3 << endl;
}
if(c4){
cout << "Q4: (" << Q4[0] << ", " << Q4[2] << ") (" << Q4[1] << ", " << Q4[3] << ") " << area4 << endl;
}
}
} | # 2072023, 2024-11-02 15:32:53, PPPPPPPPPP (100%)
#include <iostream>
#include <climits>
#include <cmath>
#include <vector>
using namespace std;
int main(){
//minX, maxX, minY, maxY
vector<int> Q1(4, 0); Q1[1] = INT_MIN; Q1[3] = INT_MIN; Q1[0] = INT_MAX; Q1[2] = INT_MAX;
vector<int> Q2(4, 0); Q2[1] = INT_MIN; Q2[3] = INT_MIN; Q2[0] = INT_MAX; Q2[2] = INT_MAX;
vector<int> Q3(4, 0); Q3[1] = INT_MIN; Q3[3] = INT_MIN; Q3[0] = INT_MAX; Q3[2] = INT_MAX;
vector<int> Q4(4, 0); Q4[1] = INT_MIN; Q4[3] = INT_MIN; Q4[0] = INT_MAX; Q4[2] = INT_MAX;
int n, x, y;
cin >> n;
bool c1 = false, c2 = false, c3 = false, c4 =false;
for(int i = 0; i < n; i++){
cin >> x >> y;
if(x == 0 || y == 0){
continue;
}
else if(x > 0 && y > 0){
//Q1
if(x < Q1[0]) Q1[0] = x;
if(x > Q1[1]) Q1[1] = x;
if(y < Q1[2]) Q1[2] = y;
if(y > Q1[3]) Q1[3] = y;
c1 = true;
}
else if(x < 0 && y > 0){
//Q2
if(x < Q2[0]) Q2[0] = x;
if(x > Q2[1]) Q2[1] = x;
if(y < Q2[2]) Q2[2] = y;
if(y > Q2[3]) Q2[3] = y;
c2 = true;
}
else if(x < 0 && y < 0){
//Q3
if(x < Q3[0]) Q3[0] = x;
if(x > Q3[1]) Q3[1] = x;
if(y < Q3[2]) Q3[2] = y;
if(y > Q3[3]) Q3[3] = y;
c3 = true;
}
else if(x > 0 && y < 0){
//Q4
if(x < Q4[0]) Q4[0] = x;
if(x > Q4[1]) Q4[1] = x;
if(y < Q4[2]) Q4[2] = y;
if(y > Q4[3]) Q4[3] = y;
c4 = true;
}
}
int area1 = (Q1[1] - Q1[0]) * (Q1[3] - Q1[2]);
int area2 = abs(Q2[1] - Q2[0]) * (Q2[3] - Q2[2]);
int area3 = abs(Q3[1] - Q3[0]) * abs(Q3[3] - Q3[2]);
int area4 = (Q4[1] - Q4[0])* abs(Q4[3] - Q4[2]);
if(!c1 && !c2 && !c3 && !c4){
cout << "No point in any quadrant";
}
else{
if(c1){
cout << "Q1: (" << Q1[0] << ", " << Q1[2] << ") (" << Q1[1] << ", " << Q1[3] << ") " << area1 << endl;
}
if(c2){
cout << "Q2: (" << Q2[0] << ", " << Q2[2] << ") (" << Q2[1] << ", " << Q2[3] << ") " << area2 << endl;
}
if(c3){
cout << "Q3: (" << Q3[0] << ", " << Q3[2] << ") (" << Q3[1] << ", " << Q3[3] << ") " << area3 << endl;
}
if(c4){
cout << "Q4: (" << Q4[0] << ", " << Q4[2] << ") (" << Q4[1] << ", " << Q4[3] << ") " << area4 << endl;
}
}
} |
# 2070397, 2024-11-02 12:07:00, ---------- (0%)
#include <bits/stdc++.h>
using namespace std;
int findminx (vector<pair<int,int>> v){
int min = 1000000;
for (auto itr = v.begin() ; itr != v.end() ; ++itr){
if (min > (*itr).first){
min = (*itr).first;
}
}
return min;
}
int findminy (vector<pair<int,int>> v){
int min = 1000000;
for (auto itr = v.begin() ; itr != v.end() ; ++itr){
if (min > (*itr).second){
min = (*itr).second;
}
}
return min;
}
int findmaxx (vector<pair<int,int>> v){
int max = -1000000;
for (auto itr = v.begin() ; itr != v.end() ; ++itr){
if (max < (*itr).first){
max = (*itr).first;
}
}
return max;
}
int findmaxy (vector<pair<int,int>> v){
int max = -1000000;
for (auto itr = v.begin() ; itr != v.end() ; ++itr){
if (max < (*itr).second){
max = (*itr).second;
}
}
return max;
}
int main() {
int n ;
cin >> n;
int x[n] , y[n];
vector<pair<int , int>> Q1;
vector<pair<int , int>> Q2;
vector<pair<int , int>> Q3;
vector<pair<int , int>> Q4;
for (int i = 0 ; i < n ; ++i){
cin >> x[i] >> y[i];
if (x[i] > 0){
if (y[i] > 0){// Q1
Q1.push_back(make_pair(x[i] , y[i]));
}
else if (y[i] < 0){
Q4.push_back(make_pair(x[i] , y[i]));
}
}
else if (x[i] < 0){
if (y[i] > 0){
Q2.push_back(make_pair(x[i] , y[i]));
}
else if (y[i] < 0){
Q3.push_back(make_pair(x[i] , y[i]));
}
}
}
cout << "Q1: (" << findminx(Q1) << "," << findminy(Q1) << ") (" << findmaxx(Q1) << "," <<findmaxy(Q1) << ") "<< abs(findminx(Q1) - findmaxx(Q1)) * abs(findminy(Q1) - findmaxy(Q1)) << endl;
cout << "Q2: (" << findminx(Q2) << "," << findminy(Q2) << ") (" << findmaxx(Q2) << "," <<findmaxy(Q2) << ") "<< abs(findminx(Q2) - findmaxx(Q2)) * abs(findminy(Q2) - findmaxy(Q2)) << endl;
cout << "Q3: (" << findminx(Q3) << "," << findminy(Q3) << ") (" << findmaxx(Q3) << "," <<findmaxy(Q3) << ") "<< abs(findminx(Q3) - findmaxx(Q3)) * abs(findminy(Q3) - findmaxy(Q3)) << endl;
cout << "Q4: (" << findminx(Q4) << "," << findminy(Q4) << ") (" << findmaxx(Q4) << "," <<findmaxy(Q4) << ") "<< abs(findminx(Q4) - findmaxx(Q4)) * abs(findminy(Q4) - findmaxy(Q4)) << endl;
} | # 2070421, 2024-11-02 12:07:52, ----P-PP-P (40%)
#include <bits/stdc++.h>
using namespace std;
int findminx (vector<pair<int,int>> v){
int min = 1000000;
for (auto itr = v.begin() ; itr != v.end() ; ++itr){
if (min > (*itr).first){
min = (*itr).first;
}
}
return min;
}
int findminy (vector<pair<int,int>> v){
int min = 1000000;
for (auto itr = v.begin() ; itr != v.end() ; ++itr){
if (min > (*itr).second){
min = (*itr).second;
}
}
return min;
}
int findmaxx (vector<pair<int,int>> v){
int max = -1000000;
for (auto itr = v.begin() ; itr != v.end() ; ++itr){
if (max < (*itr).first){
max = (*itr).first;
}
}
return max;
}
int findmaxy (vector<pair<int,int>> v){
int max = -1000000;
for (auto itr = v.begin() ; itr != v.end() ; ++itr){
if (max < (*itr).second){
max = (*itr).second;
}
}
return max;
}
int main() {
int n ;
cin >> n;
int x[n] , y[n];
vector<pair<int , int>> Q1;
vector<pair<int , int>> Q2;
vector<pair<int , int>> Q3;
vector<pair<int , int>> Q4;
for (int i = 0 ; i < n ; ++i){
cin >> x[i] >> y[i];
if (x[i] > 0){
if (y[i] > 0){// Q1
Q1.push_back(make_pair(x[i] , y[i]));
}
else if (y[i] < 0){
Q4.push_back(make_pair(x[i] , y[i]));
}
}
else if (x[i] < 0){
if (y[i] > 0){
Q2.push_back(make_pair(x[i] , y[i]));
}
else if (y[i] < 0){
Q3.push_back(make_pair(x[i] , y[i]));
}
}
}
cout << "Q1: (" << findminx(Q1) << ", " << findminy(Q1) << ") (" << findmaxx(Q1) << ", " <<findmaxy(Q1) << ") "<< abs(findminx(Q1) - findmaxx(Q1)) * abs(findminy(Q1) - findmaxy(Q1)) << endl;
cout << "Q2: (" << findminx(Q2) << ", " << findminy(Q2) << ") (" << findmaxx(Q2) << ", " <<findmaxy(Q2) << ") "<< abs(findminx(Q2) - findmaxx(Q2)) * abs(findminy(Q2) - findmaxy(Q2)) << endl;
cout << "Q3: (" << findminx(Q3) << ", " << findminy(Q3) << ") (" << findmaxx(Q3) << ", " <<findmaxy(Q3) << ") "<< abs(findminx(Q3) - findmaxx(Q3)) * abs(findminy(Q3) - findmaxy(Q3)) << endl;
cout << "Q4: (" << findminx(Q4) << ", " << findminy(Q4) << ") (" << findmaxx(Q4) << ", " <<findmaxy(Q4) << ") "<< abs(findminx(Q4) - findmaxx(Q4)) * abs(findminy(Q4) - findmaxy(Q4)) << endl;
} | # 2070479, 2024-11-02 12:10:02, PPPPP-PPPP (90%)
#include <bits/stdc++.h>
using namespace std;
int findminx (vector<pair<int,int>> v){
int min = 1000000;
for (auto itr = v.begin() ; itr != v.end() ; ++itr){
if (min > (*itr).first){
min = (*itr).first;
}
}
return min;
}
int findminy (vector<pair<int,int>> v){
int min = 1000000;
for (auto itr = v.begin() ; itr != v.end() ; ++itr){
if (min > (*itr).second){
min = (*itr).second;
}
}
return min;
}
int findmaxx (vector<pair<int,int>> v){
int max = -1000000;
for (auto itr = v.begin() ; itr != v.end() ; ++itr){
if (max < (*itr).first){
max = (*itr).first;
}
}
return max;
}
int findmaxy (vector<pair<int,int>> v){
int max = -1000000;
for (auto itr = v.begin() ; itr != v.end() ; ++itr){
if (max < (*itr).second){
max = (*itr).second;
}
}
return max;
}
int main() {
int n ;
cin >> n;
int x[n] , y[n];
vector<pair<int , int>> Q1;
vector<pair<int , int>> Q2;
vector<pair<int , int>> Q3;
vector<pair<int , int>> Q4;
for (int i = 0 ; i < n ; ++i){
cin >> x[i] >> y[i];
if (x[i] > 0){
if (y[i] > 0){// Q1
Q1.push_back(make_pair(x[i] , y[i]));
}
else if (y[i] < 0){
Q4.push_back(make_pair(x[i] , y[i]));
}
}
else if (x[i] < 0){
if (y[i] > 0){
Q2.push_back(make_pair(x[i] , y[i]));
}
else if (y[i] < 0){
Q3.push_back(make_pair(x[i] , y[i]));
}
}
}
if (Q1.size() != 0){
cout << "Q1: (" << findminx(Q1) << ", " << findminy(Q1) << ") (" << findmaxx(Q1) << ", " <<findmaxy(Q1) << ") "<< abs(findminx(Q1) - findmaxx(Q1)) * abs(findminy(Q1) - findmaxy(Q1)) << endl;
}
if (Q2.size() != 0){
cout << "Q2: (" << findminx(Q2) << ", " << findminy(Q2) << ") (" << findmaxx(Q2) << ", " <<findmaxy(Q2) << ") "<< abs(findminx(Q2) - findmaxx(Q2)) * abs(findminy(Q2) - findmaxy(Q2)) << endl;
}
if (Q3.size() != 0){
cout << "Q3: (" << findminx(Q3) << ", " << findminy(Q3) << ") (" << findmaxx(Q3) << ", " <<findmaxy(Q3) << ") "<< abs(findminx(Q3) - findmaxx(Q3)) * abs(findminy(Q3) - findmaxy(Q3)) << endl;
}
if (Q4.size() != 0){
cout << "Q4: (" << findminx(Q4) << ", " << findminy(Q4) << ") (" << findmaxx(Q4) << ", " <<findmaxy(Q4) << ") "<< abs(findminx(Q4) - findmaxx(Q4)) * abs(findminy(Q4) - findmaxy(Q4)) << endl;
}
} | # 2070528, 2024-11-02 12:11:29, PPPPP-PPPP (90%)
#include <bits/stdc++.h>
using namespace std;
int findminx (vector<pair<int,int>> v){
int min = 1000000;
for (auto itr = v.begin() ; itr != v.end() ; ++itr){
if (min > (*itr).first){
min = (*itr).first;
}
}
return min;
}
int findminy (vector<pair<int,int>> v){
int min = 1000000;
for (auto itr = v.begin() ; itr != v.end() ; ++itr){
if (min > (*itr).second){
min = (*itr).second;
}
}
return min;
}
int findmaxx (vector<pair<int,int>> v){
int max = -1000000;
for (auto itr = v.begin() ; itr != v.end() ; ++itr){
if (max < (*itr).first){
max = (*itr).first;
}
}
return max;
}
int findmaxy (vector<pair<int,int>> v){
int max = -1000000;
for (auto itr = v.begin() ; itr != v.end() ; ++itr){
if (max < (*itr).second){
max = (*itr).second;
}
}
return max;
}
int main() {
int n ;
cin >> n;
int x[n] , y[n];
vector<pair<int , int>> Q1;
vector<pair<int , int>> Q2;
vector<pair<int , int>> Q3;
vector<pair<int , int>> Q4;
for (int i = 0 ; i < n ; ++i){
cin >> x[i] >> y[i];
if (x[i] > 0){
if (y[i] > 0){// Q1
Q1.push_back(make_pair(x[i] , y[i]));
}
else if (y[i] < 0){
Q4.push_back(make_pair(x[i] , y[i]));
}
}
else if (x[i] < 0){
if (y[i] > 0){
Q2.push_back(make_pair(x[i] , y[i]));
}
else if (y[i] < 0){
Q3.push_back(make_pair(x[i] , y[i]));
}
}
}
if (Q1.size() != 0){
cout << "Q1: (" << findminx(Q1) << ", " << findminy(Q1) << ") (" << findmaxx(Q1) << ", " <<findmaxy(Q1) << ") "<< abs(findminx(Q1) - findmaxx(Q1)) * abs(findminy(Q1) - findmaxy(Q1)) << endl;
}
if (Q2.size() != 0){
cout << "Q2: (" << findminx(Q2) << ", " << findminy(Q2) << ") (" << findmaxx(Q2) << ", " <<findmaxy(Q2) << ") "<< abs(findminx(Q2) - findmaxx(Q2)) * abs(findminy(Q2) - findmaxy(Q2)) << endl;
}
if (Q3.size() != 0){
cout << "Q3: (" << findminx(Q3) << ", " << findminy(Q3) << ") (" << findmaxx(Q3) << ", " <<findmaxy(Q3) << ") "<< abs(findminx(Q3) - findmaxx(Q3)) * abs(findminy(Q3) - findmaxy(Q3)) << endl;
}
if (Q4.size() != 0){
cout << "Q4: (" << findminx(Q4) << ", " << findminy(Q4) << ") (" << findmaxx(Q4) << ", " <<findmaxy(Q4) << ") "<< abs(findminx(Q4) - findmaxx(Q4)) * abs(findminy(Q4) - findmaxy(Q4)) << endl;
}
if (Q1.size() == 0 && Q2.size() == 0 && Q3.size() != 0 && Q3.size() == 0 && Q4.size() == 0){
cout << "No point in any quadrant";
}
} | # 2070545, 2024-11-02 12:11:55, PPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std;
int findminx (vector<pair<int,int>> v){
int min = 1000000;
for (auto itr = v.begin() ; itr != v.end() ; ++itr){
if (min > (*itr).first){
min = (*itr).first;
}
}
return min;
}
int findminy (vector<pair<int,int>> v){
int min = 1000000;
for (auto itr = v.begin() ; itr != v.end() ; ++itr){
if (min > (*itr).second){
min = (*itr).second;
}
}
return min;
}
int findmaxx (vector<pair<int,int>> v){
int max = -1000000;
for (auto itr = v.begin() ; itr != v.end() ; ++itr){
if (max < (*itr).first){
max = (*itr).first;
}
}
return max;
}
int findmaxy (vector<pair<int,int>> v){
int max = -1000000;
for (auto itr = v.begin() ; itr != v.end() ; ++itr){
if (max < (*itr).second){
max = (*itr).second;
}
}
return max;
}
int main() {
int n ;
cin >> n;
int x[n] , y[n];
vector<pair<int , int>> Q1;
vector<pair<int , int>> Q2;
vector<pair<int , int>> Q3;
vector<pair<int , int>> Q4;
for (int i = 0 ; i < n ; ++i){
cin >> x[i] >> y[i];
if (x[i] > 0){
if (y[i] > 0){// Q1
Q1.push_back(make_pair(x[i] , y[i]));
}
else if (y[i] < 0){
Q4.push_back(make_pair(x[i] , y[i]));
}
}
else if (x[i] < 0){
if (y[i] > 0){
Q2.push_back(make_pair(x[i] , y[i]));
}
else if (y[i] < 0){
Q3.push_back(make_pair(x[i] , y[i]));
}
}
}
if (Q1.size() != 0){
cout << "Q1: (" << findminx(Q1) << ", " << findminy(Q1) << ") (" << findmaxx(Q1) << ", " <<findmaxy(Q1) << ") "<< abs(findminx(Q1) - findmaxx(Q1)) * abs(findminy(Q1) - findmaxy(Q1)) << endl;
}
if (Q2.size() != 0){
cout << "Q2: (" << findminx(Q2) << ", " << findminy(Q2) << ") (" << findmaxx(Q2) << ", " <<findmaxy(Q2) << ") "<< abs(findminx(Q2) - findmaxx(Q2)) * abs(findminy(Q2) - findmaxy(Q2)) << endl;
}
if (Q3.size() != 0){
cout << "Q3: (" << findminx(Q3) << ", " << findminy(Q3) << ") (" << findmaxx(Q3) << ", " <<findmaxy(Q3) << ") "<< abs(findminx(Q3) - findmaxx(Q3)) * abs(findminy(Q3) - findmaxy(Q3)) << endl;
}
if (Q4.size() != 0){
cout << "Q4: (" << findminx(Q4) << ", " << findminy(Q4) << ") (" << findmaxx(Q4) << ", " <<findmaxy(Q4) << ") "<< abs(findminx(Q4) - findmaxx(Q4)) * abs(findminy(Q4) - findmaxy(Q4)) << endl;
}
if (Q1.size() == 0 && Q2.size() == 0 && Q3.size() == 0 && Q3.size() == 0 && Q4.size() == 0){
cout << "No point in any quadrant";
}
} |
# 2069760, 2024-11-02 11:22:26, xxxxPxPPxP (40%)
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<pair<int,int>> xy;
vector<int> x;
vector<int> y;
vector<pair<int,int>> q1;
vector<pair<int,int>> q2;
vector<pair<int,int>> q3;
vector<pair<int,int>> q4;
vector<int> q1x;
vector<int> q2x;
vector<int> q3x;
vector<int> q4x;
vector<int> q1y;
vector<int> q2y;
vector<int> q3y;
vector<int> q4y;
int a, b;
for (int i = 0; i < n; i++) {
cin >> a >> b;
x.push_back(a);
y.push_back(b);
xy.push_back(make_pair(a,b));
}
for (int i = 0; i < xy.size(); i++) {
if (x[i] > 0 && y[i] > 0) { //q1
//q1.push_back(make_pair(x[i],y[i]));
q1x.push_back(x[i]);
q1y.push_back(y[i]);
}
else if (x[i] > 0 && y[i] < 0) { //q4
// q4.push_back(make_pair(x[i],y[i]));
q4x.push_back(x[i]);
q4y.push_back(y[i]);
}
else if (x[i] < 0 && y[i] > 0) { //q2
// q2.push_back(make_pair(x[i],y[i]));
q2x.push_back(x[i]);
q2y.push_back(y[i]);
}
else if (x[i] < 0 && y[i] < 0) { //q3
// q3.push_back(make_pair(x[i],y[i]));
q3x.push_back(x[i]);
q3y.push_back(y[i]);
}
}
// for (int i = 0; i < q1x.size(); i++) {
// cout << q1x[i] << ' ' ;
// }
sort(q1x.begin(),q1x.end()); //less to most
sort(q1y.begin(),q1y.end());
cout << "Q1: (" << q1x[0] << ", " << q1y[0] << ") (";
cout << q1x.back() << ", " << q1y.back() << ") " << (q1x.back()-q1x[0]) * (q1y.back()-q1y[0]) << endl;
sort(q2x.begin(),q2x.end()); //less to most
sort(q2y.begin(),q2y.end());
cout << "Q2: (" << q2x[0] << ", " << q2y[0] << ") (";
cout << q2x.back() << ", " << q2y.back() << ") " << (q2x.back()-q2x[0]) * (q2y.back()-q2y[0]) << endl;
sort(q3x.begin(),q3x.end()); //less to most
sort(q3y.begin(),q3y.end());
cout << "Q3: (" << q3x[0] << ", " << q3y[0] << ") (";
cout << q3x.back() << ", " << q3y.back() << ") " << (q3x.back()-q3x[0]) * (q3y.back()-q3y[0]) << endl;
sort(q4x.begin(),q4x.end()); //less to most
sort(q4y.begin(),q4y.end());
cout << "Q4: (" << q4x[0] << ", " << q4y[0] << ") (";
cout << q4x.back() << ", " << q4y.back() << ") " << (q4x.back()-q4x[0]) * (q4y.back()-q4y[0]) << endl;
} | # 2069867, 2024-11-02 11:31:04, xxxxPPPPxP (50%)
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<pair<int,int>> xy;
vector<int> x;
vector<int> y;
vector<pair<int,int>> q1;
vector<pair<int,int>> q2;
vector<pair<int,int>> q3;
vector<pair<int,int>> q4;
vector<int> q1x;
vector<int> q2x;
vector<int> q3x;
vector<int> q4x;
vector<int> q1y;
vector<int> q2y;
vector<int> q3y;
vector<int> q4y;
int a, b;
for (int i = 0; i < n; i++) {
cin >> a >> b;
x.push_back(a);
y.push_back(b);
xy.push_back(make_pair(a,b));
}
for (int i = 0; i < xy.size(); i++) {
if (x[i] > 0 && y[i] > 0) { //q1
q1.push_back(make_pair(x[i],y[i]));
q1x.push_back(x[i]);
q1y.push_back(y[i]);
}
else if (x[i] > 0 && y[i] < 0) { //q4
q4.push_back(make_pair(x[i],y[i]));
q4x.push_back(x[i]);
q4y.push_back(y[i]);
}
else if (x[i] < 0 && y[i] > 0) { //q2
q2.push_back(make_pair(x[i],y[i]));
q2x.push_back(x[i]);
q2y.push_back(y[i]);
}
else if (x[i] < 0 && y[i] < 0) { //q3
q3.push_back(make_pair(x[i],y[i]));
q3x.push_back(x[i]);
q3y.push_back(y[i]);
}
}
// for (int i = 0; i < q1x.size(); i++) {
// cout << q1x[i] << ' ' ;
// }
if (q1.size() == 0 && q2.size() == 0 && q3.size() == 0 && q3.size() == 0) {
cout << "No point in any quadrant";
}
else {
sort(q1x.begin(),q1x.end()); //less to most
sort(q1y.begin(),q1y.end());
cout << "Q1: (" << q1x[0] << ", " << q1y[0] << ") (";
cout << q1x.back() << ", " << q1y.back() << ") " << (q1x.back()-q1x[0]) * (q1y.back()-q1y[0]) << endl;
sort(q2x.begin(),q2x.end()); //less to most
sort(q2y.begin(),q2y.end());
cout << "Q2: (" << q2x[0] << ", " << q2y[0] << ") (";
cout << q2x.back() << ", " << q2y.back() << ") " << (q2x.back()-q2x[0]) * (q2y.back()-q2y[0]) << endl;
sort(q3x.begin(),q3x.end()); //less to most
sort(q3y.begin(),q3y.end());
cout << "Q3: (" << q3x[0] << ", " << q3y[0] << ") (";
cout << q3x.back() << ", " << q3y.back() << ") " << (q3x.back()-q3x[0]) * (q3y.back()-q3y[0]) << endl;
sort(q4x.begin(),q4x.end()); //less to most
sort(q4y.begin(),q4y.end());
cout << "Q4: (" << q4x[0] << ", " << q4y[0] << ") (";
cout << q4x.back() << ", " << q4y.back() << ") " << (q4x.back()-q4x[0]) * (q4y.back()-q4y[0]) << endl;
}
} | # 2069923, 2024-11-02 11:37:07, PPxxPPPPxP (70%)
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<pair<int,int>> xy;
vector<int> x;
vector<int> y;
vector<pair<int,int>> q1;
vector<pair<int,int>> q2;
vector<pair<int,int>> q3;
vector<pair<int,int>> q4;
vector<int> q1x;
vector<int> q2x;
vector<int> q3x;
vector<int> q4x;
vector<int> q1y;
vector<int> q2y;
vector<int> q3y;
vector<int> q4y;
int a, b;
for (int i = 0; i < n; i++) {
cin >> a >> b;
x.push_back(a);
y.push_back(b);
xy.push_back(make_pair(a,b));
}
for (int i = 0; i < xy.size(); i++) {
if (x[i] > 0 && y[i] > 0) { //q1
q1.push_back(make_pair(x[i],y[i]));
q1x.push_back(x[i]);
q1y.push_back(y[i]);
}
else if (x[i] > 0 && y[i] < 0) { //q4
q4.push_back(make_pair(x[i],y[i]));
q4x.push_back(x[i]);
q4y.push_back(y[i]);
}
else if (x[i] < 0 && y[i] > 0) { //q2
q2.push_back(make_pair(x[i],y[i]));
q2x.push_back(x[i]);
q2y.push_back(y[i]);
}
else if (x[i] < 0 && y[i] < 0) { //q3
q3.push_back(make_pair(x[i],y[i]));
q3x.push_back(x[i]);
q3y.push_back(y[i]);
}
}
// for (int i = 0; i < q1x.size(); i++) {
// cout << q1x[i] << ' ' ;
// }
if (q1.size() == 0 && q2.size() == 0 && q3.size() == 0 && q4.size() == 0) {
cout << "No point in any quadrant";
}
else if (q1.size() != 0 && q2.size() == 0 && q3.size() == 0 && q4.size() == 0) {
sort(q1x.begin(),q1x.end()); //less to most
sort(q1y.begin(),q1y.end());
cout << "Q1: (" << q1x[0] << ", " << q1y[0] << ") (";
cout << q1x.back() << ", " << q1y.back() << ") " << (q1x.back()-q1x[0]) * (q1y.back()-q1y[0]) << endl;
}
else if (q1.size() == 0 && q2.size() != 0 && q3.size() == 0 && q4.size() == 0) {
sort(q2x.begin(),q2x.end()); //less to most
sort(q2y.begin(),q2y.end());
cout << "Q2: (" << q2x[0] << ", " << q2y[0] << ") (";
cout << q2x.back() << ", " << q2y.back() << ") " << (q2x.back()-q2x[0]) * (q2y.back()-q2y[0]) << endl;
}
else if (q1.size() == 0 && q2.size() == 0 && q3.size() != 0 && q4.size() == 0) {
sort(q3x.begin(),q3x.end()); //less to most
sort(q3y.begin(),q3y.end());
cout << "Q3: (" << q3x[0] << ", " << q3y[0] << ") (";
cout << q3x.back() << ", " << q3y.back() << ") " << (q3x.back()-q3x[0]) * (q3y.back()-q3y[0]) << endl;
}
else if (q1.size() == 0 && q2.size() == 0 && q3.size() == 0 && q4.size() != 0) {
sort(q4x.begin(),q4x.end()); //less to most
sort(q4y.begin(),q4y.end());
cout << "Q4: (" << q4x[0] << ", " << q4y[0] << ") (";
cout << q4x.back() << ", " << q4y.back() << ") " << (q4x.back()-q4x[0]) * (q4y.back()-q4y[0]) << endl;
}
else {
sort(q1x.begin(),q1x.end()); //less to most
sort(q1y.begin(),q1y.end());
cout << "Q1: (" << q1x[0] << ", " << q1y[0] << ") (";
cout << q1x.back() << ", " << q1y.back() << ") " << (q1x.back()-q1x[0]) * (q1y.back()-q1y[0]) << endl;
sort(q2x.begin(),q2x.end()); //less to most
sort(q2y.begin(),q2y.end());
cout << "Q2: (" << q2x[0] << ", " << q2y[0] << ") (";
cout << q2x.back() << ", " << q2y.back() << ") " << (q2x.back()-q2x[0]) * (q2y.back()-q2y[0]) << endl;
sort(q3x.begin(),q3x.end()); //less to most
sort(q3y.begin(),q3y.end());
cout << "Q3: (" << q3x[0] << ", " << q3y[0] << ") (";
cout << q3x.back() << ", " << q3y.back() << ") " << (q3x.back()-q3x[0]) * (q3y.back()-q3y[0]) << endl;
sort(q4x.begin(),q4x.end()); //less to most
sort(q4y.begin(),q4y.end());
cout << "Q4: (" << q4x[0] << ", " << q4y[0] << ") (";
cout << q4x.back() << ", " << q4y.back() << ") " << (q4x.back()-q4x[0]) * (q4y.back()-q4y[0]) << endl;
}
} | # 2070012, 2024-11-02 11:44:40, PPxxPPPPPP (80%)
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<pair<int,int>> xy;
vector<int> x;
vector<int> y;
vector<pair<int,int>> q1;
vector<pair<int,int>> q2;
vector<pair<int,int>> q3;
vector<pair<int,int>> q4;
vector<int> q1x;
vector<int> q2x;
vector<int> q3x;
vector<int> q4x;
vector<int> q1y;
vector<int> q2y;
vector<int> q3y;
vector<int> q4y;
int a, b;
for (int i = 0; i < n; i++) {
cin >> a >> b;
x.push_back(a);
y.push_back(b);
xy.push_back(make_pair(a,b));
}
for (int i = 0; i < xy.size(); i++) {
if (x[i] > 0 && y[i] > 0) { //q1
q1.push_back(make_pair(x[i],y[i]));
q1x.push_back(x[i]);
q1y.push_back(y[i]);
}
else if (x[i] > 0 && y[i] < 0) { //q4
q4.push_back(make_pair(x[i],y[i]));
q4x.push_back(x[i]);
q4y.push_back(y[i]);
}
else if (x[i] < 0 && y[i] > 0) { //q2
q2.push_back(make_pair(x[i],y[i]));
q2x.push_back(x[i]);
q2y.push_back(y[i]);
}
else if (x[i] < 0 && y[i] < 0) { //q3
q3.push_back(make_pair(x[i],y[i]));
q3x.push_back(x[i]);
q3y.push_back(y[i]);
}
}
// for (int i = 0; i < q1x.size(); i++) {
// cout << q1x[i] << ' ' ;
// }
if (q1.size() == 0 && q2.size() == 0 && q3.size() == 0 && q4.size() == 0) {
cout << "No point in any quadrant";
}
else if (q1.size() != 0 && q2.size() == 0 && q3.size() == 0 && q4.size() == 0) {
sort(q1x.begin(),q1x.end()); //less to most
sort(q1y.begin(),q1y.end());
cout << "Q1: (" << q1x[0] << ", " << q1y[0] << ") (";
cout << q1x.back() << ", " << q1y.back() << ") " << (q1x.back()-q1x[0]) * (q1y.back()-q1y[0]) << endl;
}
else if (q1.size() == 0 && q2.size() != 0 && q3.size() == 0 && q4.size() == 0) {
sort(q2x.begin(),q2x.end()); //less to most
sort(q2y.begin(),q2y.end());
cout << "Q2: (" << q2x[0] << ", " << q2y[0] << ") (";
cout << q2x.back() << ", " << q2y.back() << ") " << (q2x.back()-q2x[0]) * (q2y.back()-q2y[0]) << endl;
}
else if (q1.size() == 0 && q2.size() == 0 && q3.size() != 0 && q4.size() == 0) {
sort(q3x.begin(),q3x.end()); //less to most
sort(q3y.begin(),q3y.end());
cout << "Q3: (" << q3x[0] << ", " << q3y[0] << ") (";
cout << q3x.back() << ", " << q3y.back() << ") " << (q3x.back()-q3x[0]) * (q3y.back()-q3y[0]) << endl;
}
else if (q1.size() == 0 && q2.size() == 0 && q3.size() == 0 && q4.size() != 0) {
sort(q4x.begin(),q4x.end()); //less to most
sort(q4y.begin(),q4y.end());
cout << "Q4: (" << q4x[0] << ", " << q4y[0] << ") (";
cout << q4x.back() << ", " << q4y.back() << ") " << (q4x.back()-q4x[0]) * (q4y.back()-q4y[0]) << endl;
}
else if (q1.size() == 0 && q2.size() != 0 && q3.size() != 0 && q4.size() != 0) {
sort(q2x.begin(),q2x.end()); //less to most
sort(q2y.begin(),q2y.end());
cout << "Q2: (" << q2x[0] << ", " << q2y[0] << ") (";
cout << q2x.back() << ", " << q2y.back() << ") " << (q2x.back()-q2x[0]) * (q2y.back()-q2y[0]) << endl;
sort(q3x.begin(),q3x.end()); //less to most
sort(q3y.begin(),q3y.end());
cout << "Q3: (" << q3x[0] << ", " << q3y[0] << ") (";
cout << q3x.back() << ", " << q3y.back() << ") " << (q3x.back()-q3x[0]) * (q3y.back()-q3y[0]) << endl;
sort(q4x.begin(),q4x.end()); //less to most
sort(q4y.begin(),q4y.end());
cout << "Q4: (" << q4x[0] << ", " << q4y[0] << ") (";
cout << q4x.back() << ", " << q4y.back() << ") " << (q4x.back()-q4x[0]) * (q4y.back()-q4y[0]) << endl;
}
else if (q1.size() != 0 && q2.size() == 0 && q3.size() != 0 && q4.size() != 0) {
sort(q1x.begin(),q1x.end()); //less to most
sort(q1y.begin(),q1y.end());
cout << "Q1: (" << q1x[0] << ", " << q1y[0] << ") (";
cout << q1x.back() << ", " << q1y.back() << ") " << (q1x.back()-q1x[0]) * (q1y.back()-q1y[0]) << endl;
sort(q3x.begin(),q3x.end()); //less to most
sort(q3y.begin(),q3y.end());
cout << "Q3: (" << q3x[0] << ", " << q3y[0] << ") (";
cout << q3x.back() << ", " << q3y.back() << ") " << (q3x.back()-q3x[0]) * (q3y.back()-q3y[0]) << endl;
sort(q4x.begin(),q4x.end()); //less to most
sort(q4y.begin(),q4y.end());
cout << "Q4: (" << q4x[0] << ", " << q4y[0] << ") (";
cout << q4x.back() << ", " << q4y.back() << ") " << (q4x.back()-q4x[0]) * (q4y.back()-q4y[0]) << endl;
}
else if (q1.size() != 0 && q2.size() != 0 && q3.size() == 0 && q4.size() != 0) {
sort(q1x.begin(),q1x.end()); //less to most
sort(q1y.begin(),q1y.end());
cout << "Q1: (" << q1x[0] << ", " << q1y[0] << ") (";
cout << q1x.back() << ", " << q1y.back() << ") " << (q1x.back()-q1x[0]) * (q1y.back()-q1y[0]) << endl;
sort(q2x.begin(),q2x.end()); //less to most
sort(q2y.begin(),q2y.end());
cout << "Q2: (" << q2x[0] << ", " << q2y[0] << ") (";
cout << q2x.back() << ", " << q2y.back() << ") " << (q2x.back()-q2x[0]) * (q2y.back()-q2y[0]) << endl;
sort(q4x.begin(),q4x.end()); //less to most
sort(q4y.begin(),q4y.end());
cout << "Q4: (" << q4x[0] << ", " << q4y[0] << ") (";
cout << q4x.back() << ", " << q4y.back() << ") " << (q4x.back()-q4x[0]) * (q4y.back()-q4y[0]) << endl;
}
else if (q1.size() != 0 && q2.size() != 0 && q3.size() != 0 && q4.size() == 0) {
sort(q1x.begin(),q1x.end()); //less to most
sort(q1y.begin(),q1y.end());
cout << "Q1: (" << q1x[0] << ", " << q1y[0] << ") (";
cout << q1x.back() << ", " << q1y.back() << ") " << (q1x.back()-q1x[0]) * (q1y.back()-q1y[0]) << endl;
sort(q2x.begin(),q2x.end()); //less to most
sort(q2y.begin(),q2y.end());
cout << "Q2: (" << q2x[0] << ", " << q2y[0] << ") (";
cout << q2x.back() << ", " << q2y.back() << ") " << (q2x.back()-q2x[0]) * (q2y.back()-q2y[0]) << endl;
sort(q3x.begin(),q3x.end()); //less to most
sort(q3y.begin(),q3y.end());
cout << "Q3: (" << q3x[0] << ", " << q3y[0] << ") (";
cout << q3x.back() << ", " << q3y.back() << ") " << (q3x.back()-q3x[0]) * (q3y.back()-q3y[0]) << endl;
}
else {
sort(q1x.begin(),q1x.end()); //less to most
sort(q1y.begin(),q1y.end());
cout << "Q1: (" << q1x[0] << ", " << q1y[0] << ") (";
cout << q1x.back() << ", " << q1y.back() << ") " << (q1x.back()-q1x[0]) * (q1y.back()-q1y[0]) << endl;
sort(q2x.begin(),q2x.end()); //less to most
sort(q2y.begin(),q2y.end());
cout << "Q2: (" << q2x[0] << ", " << q2y[0] << ") (";
cout << q2x.back() << ", " << q2y.back() << ") " << (q2x.back()-q2x[0]) * (q2y.back()-q2y[0]) << endl;
sort(q3x.begin(),q3x.end()); //less to most
sort(q3y.begin(),q3y.end());
cout << "Q3: (" << q3x[0] << ", " << q3y[0] << ") (";
cout << q3x.back() << ", " << q3y.back() << ") " << (q3x.back()-q3x[0]) * (q3y.back()-q3y[0]) << endl;
sort(q4x.begin(),q4x.end()); //less to most
sort(q4y.begin(),q4y.end());
cout << "Q4: (" << q4x[0] << ", " << q4y[0] << ") (";
cout << q4x.back() << ", " << q4y.back() << ") " << (q4x.back()-q4x[0]) * (q4y.back()-q4y[0]) << endl;
}
} | # 2070139, 2024-11-02 11:53:29, PPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<pair<int,int>> xy;
vector<int> x;
vector<int> y;
vector<pair<int,int>> q1;
vector<pair<int,int>> q2;
vector<pair<int,int>> q3;
vector<pair<int,int>> q4;
vector<int> q1x;
vector<int> q2x;
vector<int> q3x;
vector<int> q4x;
vector<int> q1y;
vector<int> q2y;
vector<int> q3y;
vector<int> q4y;
int a, b;
for (int i = 0; i < n; i++) {
cin >> a >> b;
x.push_back(a);
y.push_back(b);
xy.push_back(make_pair(a,b));
}
for (int i = 0; i < xy.size(); i++) {
if (x[i] > 0 && y[i] > 0) { //q1
q1.push_back(make_pair(x[i],y[i]));
q1x.push_back(x[i]);
q1y.push_back(y[i]);
}
else if (x[i] > 0 && y[i] < 0) { //q4
q4.push_back(make_pair(x[i],y[i]));
q4x.push_back(x[i]);
q4y.push_back(y[i]);
}
else if (x[i] < 0 && y[i] > 0) { //q2
q2.push_back(make_pair(x[i],y[i]));
q2x.push_back(x[i]);
q2y.push_back(y[i]);
}
else if (x[i] < 0 && y[i] < 0) { //q3
q3.push_back(make_pair(x[i],y[i]));
q3x.push_back(x[i]);
q3y.push_back(y[i]);
}
}
// for (int i = 0; i < q1x.size(); i++) {
// cout << q1x[i] << ' ' ;
// }
if (q1.size() == 0 && q2.size() == 0 && q3.size() == 0 && q4.size() == 0) {
cout << "No point in any quadrant";
}
////////////////////////////////////
else if (q1.size() != 0 && q2.size() == 0 && q3.size() == 0 && q4.size() == 0) {
sort(q1x.begin(),q1x.end()); //less to most
sort(q1y.begin(),q1y.end());
cout << "Q1: (" << q1x[0] << ", " << q1y[0] << ") (";
cout << q1x.back() << ", " << q1y.back() << ") " << (q1x.back()-q1x[0]) * (q1y.back()-q1y[0]) << endl;
}
else if (q1.size() == 0 && q2.size() != 0 && q3.size() == 0 && q4.size() == 0) {
sort(q2x.begin(),q2x.end()); //less to most
sort(q2y.begin(),q2y.end());
cout << "Q2: (" << q2x[0] << ", " << q2y[0] << ") (";
cout << q2x.back() << ", " << q2y.back() << ") " << (q2x.back()-q2x[0]) * (q2y.back()-q2y[0]) << endl;
}
else if (q1.size() == 0 && q2.size() == 0 && q3.size() != 0 && q4.size() == 0) {
sort(q3x.begin(),q3x.end()); //less to most
sort(q3y.begin(),q3y.end());
cout << "Q3: (" << q3x[0] << ", " << q3y[0] << ") (";
cout << q3x.back() << ", " << q3y.back() << ") " << (q3x.back()-q3x[0]) * (q3y.back()-q3y[0]) << endl;
}
else if (q1.size() == 0 && q2.size() == 0 && q3.size() == 0 && q4.size() != 0) {
sort(q4x.begin(),q4x.end()); //less to most
sort(q4y.begin(),q4y.end());
cout << "Q4: (" << q4x[0] << ", " << q4y[0] << ") (";
cout << q4x.back() << ", " << q4y.back() << ") " << (q4x.back()-q4x[0]) * (q4y.back()-q4y[0]) << endl;
}
////////////////////////////////////////////////////////
else if (q1.size() == 0 && q2.size() != 0 && q3.size() != 0 && q4.size() != 0) {
sort(q2x.begin(),q2x.end()); //less to most
sort(q2y.begin(),q2y.end());
cout << "Q2: (" << q2x[0] << ", " << q2y[0] << ") (";
cout << q2x.back() << ", " << q2y.back() << ") " << (q2x.back()-q2x[0]) * (q2y.back()-q2y[0]) << endl;
sort(q3x.begin(),q3x.end()); //less to most
sort(q3y.begin(),q3y.end());
cout << "Q3: (" << q3x[0] << ", " << q3y[0] << ") (";
cout << q3x.back() << ", " << q3y.back() << ") " << (q3x.back()-q3x[0]) * (q3y.back()-q3y[0]) << endl;
sort(q4x.begin(),q4x.end()); //less to most
sort(q4y.begin(),q4y.end());
cout << "Q4: (" << q4x[0] << ", " << q4y[0] << ") (";
cout << q4x.back() << ", " << q4y.back() << ") " << (q4x.back()-q4x[0]) * (q4y.back()-q4y[0]) << endl;
}
else if (q1.size() != 0 && q2.size() == 0 && q3.size() != 0 && q4.size() != 0) {
sort(q1x.begin(),q1x.end()); //less to most
sort(q1y.begin(),q1y.end());
cout << "Q1: (" << q1x[0] << ", " << q1y[0] << ") (";
cout << q1x.back() << ", " << q1y.back() << ") " << (q1x.back()-q1x[0]) * (q1y.back()-q1y[0]) << endl;
sort(q3x.begin(),q3x.end()); //less to most
sort(q3y.begin(),q3y.end());
cout << "Q3: (" << q3x[0] << ", " << q3y[0] << ") (";
cout << q3x.back() << ", " << q3y.back() << ") " << (q3x.back()-q3x[0]) * (q3y.back()-q3y[0]) << endl;
sort(q4x.begin(),q4x.end()); //less to most
sort(q4y.begin(),q4y.end());
cout << "Q4: (" << q4x[0] << ", " << q4y[0] << ") (";
cout << q4x.back() << ", " << q4y.back() << ") " << (q4x.back()-q4x[0]) * (q4y.back()-q4y[0]) << endl;
}
else if (q1.size() != 0 && q2.size() != 0 && q3.size() == 0 && q4.size() != 0) {
sort(q1x.begin(),q1x.end()); //less to most
sort(q1y.begin(),q1y.end());
cout << "Q1: (" << q1x[0] << ", " << q1y[0] << ") (";
cout << q1x.back() << ", " << q1y.back() << ") " << (q1x.back()-q1x[0]) * (q1y.back()-q1y[0]) << endl;
sort(q2x.begin(),q2x.end()); //less to most
sort(q2y.begin(),q2y.end());
cout << "Q2: (" << q2x[0] << ", " << q2y[0] << ") (";
cout << q2x.back() << ", " << q2y.back() << ") " << (q2x.back()-q2x[0]) * (q2y.back()-q2y[0]) << endl;
sort(q4x.begin(),q4x.end()); //less to most
sort(q4y.begin(),q4y.end());
cout << "Q4: (" << q4x[0] << ", " << q4y[0] << ") (";
cout << q4x.back() << ", " << q4y.back() << ") " << (q4x.back()-q4x[0]) * (q4y.back()-q4y[0]) << endl;
}
else if (q1.size() != 0 && q2.size() != 0 && q3.size() != 0 && q4.size() == 0) {
sort(q1x.begin(),q1x.end()); //less to most
sort(q1y.begin(),q1y.end());
cout << "Q1: (" << q1x[0] << ", " << q1y[0] << ") (";
cout << q1x.back() << ", " << q1y.back() << ") " << (q1x.back()-q1x[0]) * (q1y.back()-q1y[0]) << endl;
sort(q2x.begin(),q2x.end()); //less to most
sort(q2y.begin(),q2y.end());
cout << "Q2: (" << q2x[0] << ", " << q2y[0] << ") (";
cout << q2x.back() << ", " << q2y.back() << ") " << (q2x.back()-q2x[0]) * (q2y.back()-q2y[0]) << endl;
sort(q3x.begin(),q3x.end()); //less to most
sort(q3y.begin(),q3y.end());
cout << "Q3: (" << q3x[0] << ", " << q3y[0] << ") (";
cout << q3x.back() << ", " << q3y.back() << ") " << (q3x.back()-q3x[0]) * (q3y.back()-q3y[0]) << endl;
}
///////////////////////////////////////////////////////////////
else if (q1.size() != 0 && q2.size() != 0 && q3.size() == 0 && q4.size() == 0) {
sort(q1x.begin(),q1x.end()); //less to most
sort(q1y.begin(),q1y.end());
cout << "Q1: (" << q1x[0] << ", " << q1y[0] << ") (";
cout << q1x.back() << ", " << q1y.back() << ") " << (q1x.back()-q1x[0]) * (q1y.back()-q1y[0]) << endl;
sort(q2x.begin(),q2x.end()); //less to most
sort(q2y.begin(),q2y.end());
cout << "Q2: (" << q2x[0] << ", " << q2y[0] << ") (";
cout << q2x.back() << ", " << q2y.back() << ") " << (q2x.back()-q2x[0]) * (q2y.back()-q2y[0]) << endl;
}
else if (q1.size() != 0 && q2.size() == 0 && q3.size() != 0 && q4.size() == 0) {
sort(q1x.begin(),q1x.end()); //less to most
sort(q1y.begin(),q1y.end());
cout << "Q1: (" << q1x[0] << ", " << q1y[0] << ") (";
cout << q1x.back() << ", " << q1y.back() << ") " << (q1x.back()-q1x[0]) * (q1y.back()-q1y[0]) << endl;
sort(q3x.begin(),q3x.end()); //less to most
sort(q3y.begin(),q3y.end());
cout << "Q3: (" << q3x[0] << ", " << q3y[0] << ") (";
cout << q3x.back() << ", " << q3y.back() << ") " << (q3x.back()-q3x[0]) * (q3y.back()-q3y[0]) << endl;
}
else if (q1.size() != 0 && q2.size() == 0 && q3.size() == 0 && q4.size() != 0) {
sort(q1x.begin(),q1x.end()); //less to most
sort(q1y.begin(),q1y.end());
cout << "Q1: (" << q1x[0] << ", " << q1y[0] << ") (";
cout << q1x.back() << ", " << q1y.back() << ") " << (q1x.back()-q1x[0]) * (q1y.back()-q1y[0]) << endl;
sort(q4x.begin(),q4x.end()); //less to most
sort(q4y.begin(),q4y.end());
cout << "Q4: (" << q4x[0] << ", " << q4y[0] << ") (";
cout << q4x.back() << ", " << q4y.back() << ") " << (q4x.back()-q4x[0]) * (q4y.back()-q4y[0]) << endl;
}
else if (q1.size() == 0 && q2.size() != 0 && q3.size() != 0 && q4.size() == 0) {
sort(q2x.begin(),q2x.end()); //less to most
sort(q2y.begin(),q2y.end());
cout << "Q2: (" << q2x[0] << ", " << q2y[0] << ") (";
cout << q2x.back() << ", " << q2y.back() << ") " << (q2x.back()-q2x[0]) * (q2y.back()-q2y[0]) << endl;
sort(q3x.begin(),q3x.end()); //less to most
sort(q3y.begin(),q3y.end());
cout << "Q3: (" << q3x[0] << ", " << q3y[0] << ") (";
cout << q3x.back() << ", " << q3y.back() << ") " << (q3x.back()-q3x[0]) * (q3y.back()-q3y[0]) << endl;
}
else if (q1.size() == 0 && q2.size() != 0 && q3.size() == 0 && q4.size() != 0) {
sort(q2x.begin(),q2x.end()); //less to most
sort(q2y.begin(),q2y.end());
cout << "Q2: (" << q2x[0] << ", " << q2y[0] << ") (";
cout << q2x.back() << ", " << q2y.back() << ") " << (q2x.back()-q2x[0]) * (q2y.back()-q2y[0]) << endl;
sort(q4x.begin(),q4x.end()); //less to most
sort(q4y.begin(),q4y.end());
cout << "Q4: (" << q4x[0] << ", " << q4y[0] << ") (";
cout << q4x.back() << ", " << q4y.back() << ") " << (q4x.back()-q4x[0]) * (q4y.back()-q4y[0]) << endl;
}
else if (q1.size() == 0 && q2.size() == 0 && q3.size() != 0 && q4.size() != 0) {
sort(q3x.begin(),q3x.end()); //less to most
sort(q3y.begin(),q3y.end());
cout << "Q3: (" << q3x[0] << ", " << q3y[0] << ") (";
cout << q3x.back() << ", " << q3y.back() << ") " << (q3x.back()-q3x[0]) * (q3y.back()-q3y[0]) << endl;
sort(q4x.begin(),q4x.end()); //less to most
sort(q4y.begin(),q4y.end());
cout << "Q4: (" << q4x[0] << ", " << q4y[0] << ") (";
cout << q4x.back() << ", " << q4y.back() << ") " << (q4x.back()-q4x[0]) * (q4y.back()-q4y[0]) << endl;
}
else {
sort(q1x.begin(),q1x.end()); //less to most
sort(q1y.begin(),q1y.end());
cout << "Q1: (" << q1x[0] << ", " << q1y[0] << ") (";
cout << q1x.back() << ", " << q1y.back() << ") " << (q1x.back()-q1x[0]) * (q1y.back()-q1y[0]) << endl;
sort(q2x.begin(),q2x.end()); //less to most
sort(q2y.begin(),q2y.end());
cout << "Q2: (" << q2x[0] << ", " << q2y[0] << ") (";
cout << q2x.back() << ", " << q2y.back() << ") " << (q2x.back()-q2x[0]) * (q2y.back()-q2y[0]) << endl;
sort(q3x.begin(),q3x.end()); //less to most
sort(q3y.begin(),q3y.end());
cout << "Q3: (" << q3x[0] << ", " << q3y[0] << ") (";
cout << q3x.back() << ", " << q3y.back() << ") " << (q3x.back()-q3x[0]) * (q3y.back()-q3y[0]) << endl;
sort(q4x.begin(),q4x.end()); //less to most
sort(q4y.begin(),q4y.end());
cout << "Q4: (" << q4x[0] << ", " << q4y[0] << ") (";
cout << q4x.back() << ", " << q4y.back() << ") " << (q4x.back()-q4x[0]) * (q4y.back()-q4y[0]) << endl;
}
} |
# 2069260, 2024-11-02 10:32:06, -----P---- (10%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;cin>>n;
vector<pair<int,int>> q1;
vector<pair<int,int>> q2;
vector<pair<int,int>> q3;
vector<pair<int,int>> q4;
int maxxq1 = 0;
int maxxq2= -1e6;
int maxxq3= -1e6;
int maxxq4= 0;
int minxq1= 1e6;
int minxq2= 0;
int minxq3= 0;
int minxq4= 1e6;
int maxyq1= 0;
int maxyq2= -1e6;
int maxyq3= -1e6;
int maxyq4= -1e6;
int minyq1= 1e6;
int minyq2= 1e6;
int minyq3= 0;
int minyq4= 0;
int x,y;
bool cq1=false;
bool cq2=false;
bool cq3=false;
bool cq4=false;
for(int i=0;i<n;i++){
cin>>x>>y;
//q1
if(x>0&&y>0){
cq1 = true;
q1.push_back(make_pair(x,y));
if(x>maxxq1){
maxxq1 = x;
}
if(y>maxyq1){
maxyq1 = y;
}
if(x<minxq1){
minxq1 = x;
}
if(y<minyq1){
minyq1 = y;
}
}
//q2
if(x<0&&y>0){
cq2 = true;
q2.push_back(make_pair(x,y));
if(x>maxxq2){
maxxq2 = x;
}
if(y>maxyq2){
maxyq2 = y;
}
if(x<minxq2){
minxq2 = x;
}
if(y<minyq2){
minyq2 = y;
}
}
//q3
if(x<0&&y<0){
cq3 = true;
q3.push_back(make_pair(x,y));
if(x>maxxq3){
maxxq3 = x;
}
if(y>maxyq3){
maxyq3 = y;
}
if(x<minxq3){
minxq3 = x;
}
if(y<minyq3){
minyq3 = y;
}
}
//q4
if(x>0&&y<0){
cq4 = true;
q4.push_back(make_pair(x,y));
if(x>maxxq4){
maxxq4 = x;
}
if(y>maxyq4){
maxyq4 = y;
}
if(x<minxq4){
minxq4 = x;
}
if(y<minyq4){
minyq4 = y;
}
}
}
if(cq1){
int a = (maxxq1-minxq1)*(maxyq1-minyq1);
cout<<"Q1: ("<<minxq1<<","<<minyq1<<") ("<<maxxq1<<","<<maxyq1<<") "<<a<<endl;
}
if(cq2){
int a = (maxxq2-minxq2)*(maxyq2-minyq2);
cout<<"Q2: ("<<minxq2<<","<<minyq2<<") ("<<maxxq2<<","<<maxyq2<<") "<<a<<endl;
}
if(cq3){
int a = (maxxq3-minxq3)*(maxyq3-minyq3);
cout<<"Q3: ("<<minxq3<<","<<minyq3<<") ("<<maxxq3<<","<<maxyq3<<") "<<a<<endl;
}
if(cq4){
int a = (maxxq4-minxq4)*(maxyq4-minyq4);
cout<<"Q1: ("<<minxq4<<","<<minyq4<<") ("<<maxxq4<<","<<maxyq4<<") "<<a<<endl;
}
if(!(cq1||cq2||cq3||cq4)){
cout<<"No point in any quadrant";
}
} | # 2069269, 2024-11-02 10:32:53, -----P---- (10%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;cin>>n;
vector<pair<int,int>> q1;
vector<pair<int,int>> q2;
vector<pair<int,int>> q3;
vector<pair<int,int>> q4;
int maxxq1 = 0;
int maxxq2= -1e6;
int maxxq3= -1e6;
int maxxq4= 0;
int minxq1= 1e6;
int minxq2= 0;
int minxq3= 0;
int minxq4= 1e6;
int maxyq1= 0;
int maxyq2= -1e6;
int maxyq3= -1e6;
int maxyq4= -1e6;
int minyq1= 1e6;
int minyq2= 1e6;
int minyq3= 0;
int minyq4= 0;
int x,y;
bool cq1=false;
bool cq2=false;
bool cq3=false;
bool cq4=false;
for(int i=0;i<n;i++){
cin>>x>>y;
//q1
if(x>0&&y>0){
cq1 = true;
q1.push_back(make_pair(x,y));
if(x>maxxq1){
maxxq1 = x;
}
if(y>maxyq1){
maxyq1 = y;
}
if(x<minxq1){
minxq1 = x;
}
if(y<minyq1){
minyq1 = y;
}
}
//q2
if(x<0&&y>0){
cq2 = true;
q2.push_back(make_pair(x,y));
if(x>maxxq2){
maxxq2 = x;
}
if(y>maxyq2){
maxyq2 = y;
}
if(x<minxq2){
minxq2 = x;
}
if(y<minyq2){
minyq2 = y;
}
}
//q3
if(x<0&&y<0){
cq3 = true;
q3.push_back(make_pair(x,y));
if(x>maxxq3){
maxxq3 = x;
}
if(y>maxyq3){
maxyq3 = y;
}
if(x<minxq3){
minxq3 = x;
}
if(y<minyq3){
minyq3 = y;
}
}
//q4
if(x>0&&y<0){
cq4 = true;
q4.push_back(make_pair(x,y));
if(x>maxxq4){
maxxq4 = x;
}
if(y>maxyq4){
maxyq4 = y;
}
if(x<minxq4){
minxq4 = x;
}
if(y<minyq4){
minyq4 = y;
}
}
}
if(cq1){
int a = (maxxq1-minxq1)*(maxyq1-minyq1);
cout<<"Q1: ("<<minxq1<<","<<minyq1<<") ("<<maxxq1<<","<<maxyq1<<") "<<a<<endl;
}
if(cq2){
int a = (maxxq2-minxq2)*(maxyq2-minyq2);
cout<<"Q2: ("<<minxq2<<","<<minyq2<<") ("<<maxxq2<<","<<maxyq2<<") "<<a<<endl;
}
if(cq3){
int a = (maxxq3-minxq3)*(maxyq3-minyq3);
cout<<"Q3: ("<<minxq3<<","<<minyq3<<") ("<<maxxq3<<","<<maxyq3<<") "<<a<<endl;
}
if(cq4){
int a = (maxxq4-minxq4)*(maxyq4-minyq4);
cout<<"Q4: ("<<minxq4<<","<<minyq4<<") ("<<maxxq4<<","<<maxyq4<<") "<<a<<endl;
}
if(!(cq1||cq2||cq3||cq4)){
cout<<"No point in any quadrant";
}
} | # 2069283, 2024-11-02 10:34:03, -----P---- (10%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;cin>>n;
vector<pair<int,int>> q1;
vector<pair<int,int>> q2;
vector<pair<int,int>> q3;
vector<pair<int,int>> q4;
int maxxq1 = 0;
int maxxq2= -1e6;
int maxxq3= -1e6;
int maxxq4= 0;
int minxq1= 1e6;
int minxq2= 0;
int minxq3= 0;
int minxq4= 1e6;
int maxyq1= 0;
int maxyq2= -1e6;
int maxyq3= -1e6;
int maxyq4= -1e6;
int minyq1= 1e6;
int minyq2= 1e6;
int minyq3= 0;
int minyq4= 0;
int x,y;
bool cq1=false;
bool cq2=false;
bool cq3=false;
bool cq4=false;
for(int i=0;i<n;i++){
cin>>x>>y;
//q1
if(x>0&&y>0){
cq1 = true;
q1.push_back(make_pair(x,y));
if(x>maxxq1){
maxxq1 = x;
}
if(y>maxyq1){
maxyq1 = y;
}
if(x<minxq1){
minxq1 = x;
}
if(y<minyq1){
minyq1 = y;
}
}
//q2
if(x<0&&y>0){
cq2 = true;
q2.push_back(make_pair(x,y));
if(x>maxxq2){
maxxq2 = x;
}
if(y>maxyq2){
maxyq2 = y;
}
if(x<minxq2){
minxq2 = x;
}
if(y<minyq2){
minyq2 = y;
}
}
//q3
if(x<0&&y<0){
cq3 = true;
q3.push_back(make_pair(x,y));
if(x>maxxq3){
maxxq3 = x;
}
if(y>maxyq3){
maxyq3 = y;
}
if(x<minxq3){
minxq3 = x;
}
if(y<minyq3){
minyq3 = y;
}
}
//q4
if(x>0&&y<0){
cq4 = true;
q4.push_back(make_pair(x,y));
if(x>maxxq4){
maxxq4 = x;
}
if(y>maxyq4){
maxyq4 = y;
}
if(x<minxq4){
minxq4 = x;
}
if(y<minyq4){
minyq4 = y;
}
}
}
if(cq1){
int a = (maxxq1-minxq1)*(maxyq1-minyq1);
cout<<"Q1: ("<<minxq1<<","<<minyq1<<") ("<<maxxq1<<","<<maxyq1<<") "<<a<<endl;
}
if(cq2){
int a = (maxxq2-minxq2)*(maxyq2-minyq2);
cout<<"Q2: ("<<minxq2<<","<<minyq2<<") ("<<maxxq2<<","<<maxyq2<<") "<<a<<endl;
}
if(cq3){
int a = (maxxq3-minxq3)*(maxyq3-minyq3);
cout<<"Q3: ("<<minxq3<<","<<minyq3<<") ("<<maxxq3<<","<<maxyq3<<") "<<a<<endl;
}
if(cq4){
int a = (maxxq4-minxq4)*(maxyq4-minyq4);
cout<<"Q4: ("<<minxq4<<","<<minyq4<<") ("<<maxxq4<<","<<maxyq4<<") "<<a<<endl;
}
if(!(cq1||cq2||cq3||cq4)){
cout<<"No point in any quadrant";
}
} | # 2069325, 2024-11-02 10:36:32, -----P---- (10%)
#include<bits/stdc++.h>
using namespace std;
int main(){
double n;cin>>n;
vector<pair<double,double>> q1;
vector<pair<double,double>> q2;
vector<pair<double,double>> q3;
vector<pair<double,double>> q4;
double maxxq1 = 0;
double maxxq2= -1e6;
double maxxq3= -1e6;
double maxxq4= 0;
double minxq1= 1e6;
double minxq2= 0;
double minxq3= 0;
double minxq4= 1e6;
double maxyq1= 0;
double maxyq2= -1e6;
double maxyq3= -1e6;
double maxyq4= -1e6;
double minyq1= 1e6;
double minyq2= 1e6;
double minyq3= 0;
double minyq4= 0;
double x,y;
bool cq1=false;
bool cq2=false;
bool cq3=false;
bool cq4=false;
for(double i=0;i<n;i++){
cin>>x>>y;
//q1
if(x>0&&y>0){
cq1 = true;
q1.push_back(make_pair(x,y));
if(x>maxxq1){
maxxq1 = x;
}
if(y>maxyq1){
maxyq1 = y;
}
if(x<minxq1){
minxq1 = x;
}
if(y<minyq1){
minyq1 = y;
}
}
//q2
if(x<0&&y>0){
cq2 = true;
q2.push_back(make_pair(x,y));
if(x>maxxq2){
maxxq2 = x;
}
if(y>maxyq2){
maxyq2 = y;
}
if(x<minxq2){
minxq2 = x;
}
if(y<minyq2){
minyq2 = y;
}
}
//q3
if(x<0&&y<0){
cq3 = true;
q3.push_back(make_pair(x,y));
if(x>maxxq3){
maxxq3 = x;
}
if(y>maxyq3){
maxyq3 = y;
}
if(x<minxq3){
minxq3 = x;
}
if(y<minyq3){
minyq3 = y;
}
}
//q4
if(x>0&&y<0){
cq4 = true;
q4.push_back(make_pair(x,y));
if(x>maxxq4){
maxxq4 = x;
}
if(y>maxyq4){
maxyq4 = y;
}
if(x<minxq4){
minxq4 = x;
}
if(y<minyq4){
minyq4 = y;
}
}
}
if(cq1){
double a = (maxxq1-minxq1)*(maxyq1-minyq1);
cout<<"Q1: ("<<minxq1<<","<<minyq1<<") ("<<maxxq1<<","<<maxyq1<<") "<<a<<endl;
}
if(cq2){
double a = (maxxq2-minxq2)*(maxyq2-minyq2);
cout<<"Q2: ("<<minxq2<<","<<minyq2<<") ("<<maxxq2<<","<<maxyq2<<") "<<a<<endl;
}
if(cq3){
double a = (maxxq3-minxq3)*(maxyq3-minyq3);
cout<<"Q3: ("<<minxq3<<","<<minyq3<<") ("<<maxxq3<<","<<maxyq3<<") "<<a<<endl;
}
if(cq4){
double a = (maxxq4-minxq4)*(maxyq4-minyq4);
cout<<"Q4: ("<<minxq4<<","<<minyq4<<") ("<<maxxq4<<","<<maxyq4<<") "<<a<<endl;
}
if(!(cq1||cq2||cq3||cq4)){
cout<<"No point in any quadrant";
}
} | # 2069368, 2024-11-02 10:40:30, PPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
int main(){
double n;cin>>n;
vector<pair<double,double>> q1;
vector<pair<double,double>> q2;
vector<pair<double,double>> q3;
vector<pair<double,double>> q4;
double maxxq1 = 0;
double maxxq2= -1e6;
double maxxq3= -1e6;
double maxxq4= 0;
double minxq1= 1e6;
double minxq2= 0;
double minxq3= 0;
double minxq4= 1e6;
double maxyq1= 0;
double maxyq2= 0;
double maxyq3= -1e6;
double maxyq4= -1e6;
double minyq1= 1e6;
double minyq2= 1e6;
double minyq3= 0;
double minyq4= 0;
double x,y;
bool cq1=false;
bool cq2=false;
bool cq3=false;
bool cq4=false;
for(double i=0;i<n;i++){
cin>>x>>y;
//q1
if(x>0&&y>0){
cq1 = true;
q1.push_back(make_pair(x,y));
if(x>maxxq1){
maxxq1 = x;
}
if(y>maxyq1){
maxyq1 = y;
}
if(x<minxq1){
minxq1 = x;
}
if(y<minyq1){
minyq1 = y;
}
}
//q2
if(x<0&&y>0){
cq2 = true;
q2.push_back(make_pair(x,y));
if(x>maxxq2){
maxxq2 = x;
}
if(y>maxyq2){
maxyq2 = y;
}
if(x<minxq2){
minxq2 = x;
}
if(y<minyq2){
minyq2 = y;
}
}
//q3
if(x<0&&y<0){
cq3 = true;
q3.push_back(make_pair(x,y));
if(x>maxxq3){
maxxq3 = x;
}
if(y>maxyq3){
maxyq3 = y;
}
if(x<minxq3){
minxq3 = x;
}
if(y<minyq3){
minyq3 = y;
}
}
//q4
if(x>0&&y<0){
cq4 = true;
q4.push_back(make_pair(x,y));
if(x>maxxq4){
maxxq4 = x;
}
if(y>maxyq4){
maxyq4 = y;
}
if(x<minxq4){
minxq4 = x;
}
if(y<minyq4){
minyq4 = y;
}
}
}
if(cq1){
double a = (maxxq1-minxq1)*(maxyq1-minyq1);
cout<<"Q1: ("<<minxq1<<", "<<minyq1<<") ("<<maxxq1<<", "<<maxyq1<<") "<<a<<endl;
}
if(cq2){
double a = (maxxq2-minxq2)*(maxyq2-minyq2);
cout<<"Q2: ("<<minxq2<<", "<<minyq2<<") ("<<maxxq2<<", "<<maxyq2<<") "<<a<<endl;
}
if(cq3){
double a = (maxxq3-minxq3)*(maxyq3-minyq3);
cout<<"Q3: ("<<minxq3<<", "<<minyq3<<") ("<<maxxq3<<", "<<maxyq3<<") "<<a<<endl;
}
if(cq4){
double a = (maxxq4-minxq4)*(maxyq4-minyq4);
cout<<"Q4: ("<<minxq4<<", "<<minyq4<<") ("<<maxxq4<<", "<<maxyq4<<") "<<a<<endl;
}
if(!(cq1||cq2||cq3||cq4)){
cout<<"No point in any quadrant";
}
} |
# 2069458, 2024-11-02 10:48:42, ---------- (0%)
#include <bits/stdc++.h>
using namespace std;
int main(){
// concept: keep xq yq in vector
map<int, int> q1, q2, q3, q4;
int n, x, y;
cin >> n;
for(int i=0; i<n; i++){
cin >> x >> y;
if(x>0 && y>0){
q1[x] = y;
}else if(x<0 && y>0){
q2[x] = y;
}else if(x<0 && y<0){
q3[x] = y;
}else if(x>0 && y<0){
q4[x]=y;
}
}
// Q1
int maxX = 0,maxY = 0,minX = 1e9,minY = 1e9;
for(auto m:q1){
maxX = max(maxX,m.first);
maxY = max(maxY,m.second);
minX = min(minX, m.first);
minY = min(minY, m.second);
}
int space = 0;
space = (maxX - minX) * (maxY - minY);
cout << "Q1: (" << minX << ", " << minY << ")" << " (" << maxX << ", " << maxY << ") " << space << endl;
// Q2
maxX = 0,maxY = 0,minX = 1e9,minY = 1e9;
for(auto m:q2){
maxX = max(maxX,m.first);
maxY = max(maxY,m.second);
minX = min(minX, m.first);
minY = min(minY, m.second);
}
space = 0;
space = (maxX - minX) * (maxY - minY);
cout << "Q2: (" << minX << ", " << minY << ")" << " (" << maxX << ", " << maxY << ") " << space << endl;
// Q3
maxX = 0,maxY = 0,minX = 1e9,minY = 1e9;
for(auto m:q3){
maxX = max(maxX,m.first);
maxY = max(maxY,m.second);
minX = min(minX, m.first);
minY = min(minY, m.second);
}
space = 0;
space = (maxX - minX) * (maxY - minY);
cout << "Q3: (" << minX << ", " << minY << ")" << " (" << maxX << ", " << maxY << ") " << space << endl;
// Q4
maxX = 0,maxY = 0,minX = 1e9,minY = 1e9;
for(auto m:q4){
maxX = max(maxX,m.first);
maxY = max(maxY,m.second);
minX = min(minX, m.first);
minY = min(minY, m.second);
}
space = 0;
space = (maxX - minX) * (maxY - minY);
cout << "Q4: (" << minX << ", " << minY << ")" << " (" << maxX << ", " << maxY << ") " << space << endl;
} | # 2069502, 2024-11-02 10:53:08, ----P-PP-P (40%)
#include <bits/stdc++.h>
using namespace std;
int main(){
// concept: keep xq yq in vector
map<int, int> q1, q2, q3, q4;
int n, x, y;
cin >> n;
for(int i=0; i<n; i++){
cin >> x >> y;
if(x>0 && y>0){
q1[x] = y;
}else if(x<0 && y>0){
q2[x] = y;
}else if(x<0 && y<0){
q3[x] = y;
}else if(x>0 && y<0){
q4[x]=y;
}
}
// Q1
int maxX = -1e9,maxY = -1e9,minX = 1e9,minY = 1e9;
for(auto m:q1){
maxX = max(maxX,m.first);
maxY = max(maxY,m.second);
minX = min(minX, m.first);
minY = min(minY, m.second);
}
int space = 0;
space = (maxX - minX) * (maxY - minY);
cout << "Q1: (" << minX << ", " << minY << ")" << " (" << maxX << ", " << maxY << ") " << space << endl;
// Q2
maxX = -1e9,maxY = -1e9,minX = 1e9,minY = 1e9;
for(auto m:q2){
maxX = max(maxX,m.first);
maxY = max(maxY,m.second);
minX = min(minX, m.first);
minY = min(minY, m.second);
}
space = 0;
space = (maxX - minX) * (maxY - minY);
cout << "Q2: (" << minX << ", " << minY << ")" << " (" << maxX << ", " << maxY << ") " << space << endl;
// Q3
maxX = -1e9,maxY = -1e9,minX = 1e9,minY = 1e9;
for(auto m:q3){
maxX = max(maxX,m.first);
maxY = max(maxY,m.second);
minX = min(minX, m.first);
minY = min(minY, m.second);
}
space = 0;
space = (maxX - minX) * (maxY - minY);
cout << "Q3: (" << minX << ", " << minY << ")" << " (" << maxX << ", " << maxY << ") " << space << endl;
// Q4
maxX = -1e9,maxY = -1e9,minX = 1e9,minY = 1e9;
for(auto m:q4){
maxX = max(maxX,m.first);
maxY = max(maxY,m.second);
minX = min(minX, m.first);
minY = min(minY, m.second);
}
space = 0;
space = (maxX - minX) * (maxY - minY);
cout << "Q4: (" << minX << ", " << minY << ")" << " (" << maxX << ", " << maxY << ") " << space << endl;
} | # 2069610, 2024-11-02 11:03:29, PP-PPPPPPP (90%)
#include <bits/stdc++.h>
using namespace std;
int main(){
// concept: keep xq yq in vector -> if every map not empty -->
map<int, int> q1, q2, q3, q4;
int n, x, y;
cin >> n;
for(int i=0; i<n; i++){
cin >> x >> y;
if(x>0 && y>0){
q1[x] = y;
}else if(x<0 && y>0){
q2[x] = y;
}else if(x<0 && y<0){
q3[x] = y;
}else if(x>0 && y<0){
q4[x]=y;
}
}
int maxX = -1e9,maxY = -1e9,minX = 1e9,minY = 1e9;
int space = 0;
bool q1emp = false, q2emp = false, q3emp = false, q4emp = false;
// Q1
if(!q1.empty()){
maxX = -1e9,maxY = -1e9,minX = 1e9,minY = 1e9;
for(auto m:q1){
maxX = max(maxX,m.first);
maxY = max(maxY,m.second);
minX = min(minX, m.first);
minY = min(minY, m.second);
}
space = 0;
space = (maxX - minX) * (maxY - minY);
cout << "Q1: (" << minX << ", " << minY << ")" << " (" << maxX << ", " << maxY << ") " << space << endl;
}else{
q1emp = true;
}
// Q2
if(!q2.empty()){
maxX = -1e9,maxY = -1e9,minX = 1e9,minY = 1e9;
for(auto m:q2){
maxX = max(maxX,m.first);
maxY = max(maxY,m.second);
minX = min(minX, m.first);
minY = min(minY, m.second);
}
space = 0;
space = (maxX - minX) * (maxY - minY);
cout << "Q2: (" << minX << ", " << minY << ")" << " (" << maxX << ", " << maxY << ") " << space << endl;
}else{
q2emp = true;
}
// Q3
if(!q3.empty()){
maxX = -1e9,maxY = -1e9,minX = 1e9,minY = 1e9;
for(auto m:q3){
maxX = max(maxX,m.first);
maxY = max(maxY,m.second);
minX = min(minX, m.first);
minY = min(minY, m.second);
}
space = 0;
space = (maxX - minX) * (maxY - minY);
cout << "Q3: (" << minX << ", " << minY << ")" << " (" << maxX << ", " << maxY << ") " << space << endl;
}else{
q3emp = true;
}
// Q4
if(!q4.empty()){
maxX = -1e9,maxY = -1e9,minX = 1e9,minY = 1e9;
for(auto m:q4){
maxX = max(maxX,m.first);
maxY = max(maxY,m.second);
minX = min(minX, m.first);
minY = min(minY, m.second);
}
space = 0;
space = (maxX - minX) * (maxY - minY);
cout << "Q4: (" << minX << ", " << minY << ")" << " (" << maxX << ", " << maxY << ") " << space << endl;
}else{
q4emp = true;
}
if(q1emp && q2emp && q3emp && q4emp){
cout << "No point in any quadrant";
}
} | # 2069685, 2024-11-02 11:13:17, PPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std;
int main(){
// concept: keep xq yq in vector -> if every map not empty -->
//map<int, int> q1, q2, q3, q4;
vector<pair<int, int>> q1,q2,q3,q4;
int n, x, y;
cin >> n;
for(int i=0; i<n; i++){
cin >> x >> y;
if(x>0 && y>0){
q1.push_back(make_pair(x,y));
}else if(x<0 && y>0){
q2.push_back(make_pair(x,y));
}else if(x<0 && y<0){
q3.push_back(make_pair(x,y));
}else if(x>0 && y<0){
q4.push_back(make_pair(x,y));
}
}
int maxX = -1e9,maxY = -1e9,minX = 1e9,minY = 1e9;
int space = 0;
bool q1emp = false, q2emp = false, q3emp = false, q4emp = false;
// cout << "-----------------" << endl;
// for(auto m:q1){
// cout << m.first << " " << m.second << endl;
// }
// cout << "-----------------" << endl;
// Q1
if(!q1.empty()){
maxX = -1e9,maxY = -1e9,minX = 1e9,minY = 1e9;
for(auto m:q1){
maxX = max(maxX,m.first);
maxY = max(maxY,m.second);
minX = min(minX, m.first);
minY = min(minY, m.second);
}
space = 0;
space = (maxX - minX) * (maxY - minY);
cout << "Q1: (" << minX << ", " << minY << ")" << " (" << maxX << ", " << maxY << ") " << space << endl;
}else{
q1emp = true;
}
// Q2
if(!q2.empty()){
maxX = -1e9,maxY = -1e9,minX = 1e9,minY = 1e9;
for(auto m:q2){
maxX = max(maxX,m.first);
maxY = max(maxY,m.second);
minX = min(minX, m.first);
minY = min(minY, m.second);
}
space = 0;
space = (maxX - minX) * (maxY - minY);
cout << "Q2: (" << minX << ", " << minY << ")" << " (" << maxX << ", " << maxY << ") " << space << endl;
}else{
q2emp = true;
}
// Q3
if(!q3.empty()){
maxX = -1e9,maxY = -1e9,minX = 1e9,minY = 1e9;
for(auto m:q3){
maxX = max(maxX,m.first);
maxY = max(maxY,m.second);
minX = min(minX, m.first);
minY = min(minY, m.second);
}
space = 0;
space = (maxX - minX) * (maxY - minY);
cout << "Q3: (" << minX << ", " << minY << ")" << " (" << maxX << ", " << maxY << ") " << space << endl;
}else{
q3emp = true;
}
// Q4
if(!q4.empty()){
maxX = -1e9,maxY = -1e9,minX = 1e9,minY = 1e9;
for(auto m:q4){
maxX = max(maxX,m.first);
maxY = max(maxY,m.second);
minX = min(minX, m.first);
minY = min(minY, m.second);
}
space = 0;
space = (maxX - minX) * (maxY - minY);
cout << "Q4: (" << minX << ", " << minY << ")" << " (" << maxX << ", " << maxY << ") " << space << endl;
}else{
q4emp = true;
}
if(q1emp && q2emp && q3emp && q4emp){
cout << "No point in any quadrant";
}
} |
# 2069411, 2024-11-02 10:44:22, Compilation error (0%)
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
int n;
cin >> n;
int x[n],y[n];
for(int i=0;i<n;i++) {
cin >> x[i] >> y[i];
}
int mx_1=-1;
int mx_2=-1;
int mx_3=-1;
int mx_4=-1;
int mn_1x=INT_MAX;
int mn_2x=INT_MAX;
int mn_3x=INT_MAX;
int mn_4x=INT_MAX;
int my_1=-1;
int my_2=-1;
int my_3=-1;
int my_4=-1;
int mn_1y=INT_MAX;
int mn_2y=INT_MAX;
int mn_3y=INT_MAX;
int mn_4y=INT_MAX;
int c1=0;
int c2=0;
int c3=0;
int c4=0;
for(int i=0;i<n;i++) {
if(x[i]>0 && y[i]>0) {
mx_1=max(mx_1,x[i]);
my_1=max(my_1,y[i]);
mn_1x=min(mn_1x,x[i]);
mn_1y=min(mn_1y,y[i]);
c1++;
}else if(x[i]<0 && y[i]>0) {
mx_2=max(mx_2,x[i]);
my_2=max(my_2,y[i]);
mn_2x=min(mn_2x,x[i]);
mn_2y=min(mn_2y,y[i]);
c2++;
}else if(x[i]<0 && y[i]<0) {
mx_3=max(mx_3,x[i]);
my_3=max(my_3,y[i]);
mn_3x=min(mn_3x,x[i]);
mn_3y=min(mn_3y,y[i]);
c3++;
}else if(x[i]>0 && y[i]<0) {
mx_4=max(mx_4,x[i]);
my_4=max(my_4,y[i]);
mn_4x=min(mn_4x,x[i]);
mn_4y=min(mn_4y,y[i]);
c4++;
}
}
if(c1!=0) cout << "Q1: (" << mn_1x << ", " << mn_1y << ") (" << mx_1 << ", " << my_1 << ") " << (mx_1-mn_1x)*(my_1-mn_1y) <<endl;
if(c2!=0) cout << "Q2: (" << mn_2x << ", " << mn_2y << ") (" << mx_2 << ", " << my_2 << ") " << (mx_2-mn_2x)*(my_2-mn_2y) <<endl;
if(c3!=0) cout << "Q3: (" << mn_3x << ", " << mn_3y << ") (" << mx_3 << ", " << my_3 << ") " << (mx_3-mn_3x)*(my_3-mn_3y) <<endl;
if(c4!=0) cout << "Q4: (" << mn_4x << ", " << mn_4y << ") (" << mx_4 << ", " << my_4 << ") " << (mx_4-mn_4x)*(my_4-mn_4y) <<endl;
if(c1==0 && c2==0 && c3==0 && c4==0) cout << "No point in any quadrant"
} | # 2069416, 2024-11-02 10:44:47, Compilation error (0%)
#include<iostream>
#include<algorithm>
#include<climits>
using namespace std;
int main() {
int n;
cin >> n;
int x[n],y[n];
for(int i=0;i<n;i++) {
cin >> x[i] >> y[i];
}
int mx_1=-1;
int mx_2=-1;
int mx_3=-1;
int mx_4=-1;
int mn_1x=INT_MAX;
int mn_2x=INT_MAX;
int mn_3x=INT_MAX;
int mn_4x=INT_MAX;
int my_1=-1;
int my_2=-1;
int my_3=-1;
int my_4=-1;
int mn_1y=INT_MAX;
int mn_2y=INT_MAX;
int mn_3y=INT_MAX;
int mn_4y=INT_MAX;
int c1=0;
int c2=0;
int c3=0;
int c4=0;
for(int i=0;i<n;i++) {
if(x[i]>0 && y[i]>0) {
mx_1=max(mx_1,x[i]);
my_1=max(my_1,y[i]);
mn_1x=min(mn_1x,x[i]);
mn_1y=min(mn_1y,y[i]);
c1++;
}else if(x[i]<0 && y[i]>0) {
mx_2=max(mx_2,x[i]);
my_2=max(my_2,y[i]);
mn_2x=min(mn_2x,x[i]);
mn_2y=min(mn_2y,y[i]);
c2++;
}else if(x[i]<0 && y[i]<0) {
mx_3=max(mx_3,x[i]);
my_3=max(my_3,y[i]);
mn_3x=min(mn_3x,x[i]);
mn_3y=min(mn_3y,y[i]);
c3++;
}else if(x[i]>0 && y[i]<0) {
mx_4=max(mx_4,x[i]);
my_4=max(my_4,y[i]);
mn_4x=min(mn_4x,x[i]);
mn_4y=min(mn_4y,y[i]);
c4++;
}
}
if(c1!=0) cout << "Q1: (" << mn_1x << ", " << mn_1y << ") (" << mx_1 << ", " << my_1 << ") " << (mx_1-mn_1x)*(my_1-mn_1y) <<endl;
if(c2!=0) cout << "Q2: (" << mn_2x << ", " << mn_2y << ") (" << mx_2 << ", " << my_2 << ") " << (mx_2-mn_2x)*(my_2-mn_2y) <<endl;
if(c3!=0) cout << "Q3: (" << mn_3x << ", " << mn_3y << ") (" << mx_3 << ", " << my_3 << ") " << (mx_3-mn_3x)*(my_3-mn_3y) <<endl;
if(c4!=0) cout << "Q4: (" << mn_4x << ", " << mn_4y << ") (" << mx_4 << ", " << my_4 << ") " << (mx_4-mn_4x)*(my_4-mn_4y) <<endl;
if(c1==0 && c2==0 && c3==0 && c4==0) cout << "No point in any quadrant"
} | # 2069419, 2024-11-02 10:44:58, PP---P---- (30%)
#include<iostream>
#include<algorithm>
#include<climits>
using namespace std;
int main() {
int n;
cin >> n;
int x[n],y[n];
for(int i=0;i<n;i++) {
cin >> x[i] >> y[i];
}
int mx_1=-1;
int mx_2=-1;
int mx_3=-1;
int mx_4=-1;
int mn_1x=INT_MAX;
int mn_2x=INT_MAX;
int mn_3x=INT_MAX;
int mn_4x=INT_MAX;
int my_1=-1;
int my_2=-1;
int my_3=-1;
int my_4=-1;
int mn_1y=INT_MAX;
int mn_2y=INT_MAX;
int mn_3y=INT_MAX;
int mn_4y=INT_MAX;
int c1=0;
int c2=0;
int c3=0;
int c4=0;
for(int i=0;i<n;i++) {
if(x[i]>0 && y[i]>0) {
mx_1=max(mx_1,x[i]);
my_1=max(my_1,y[i]);
mn_1x=min(mn_1x,x[i]);
mn_1y=min(mn_1y,y[i]);
c1++;
}else if(x[i]<0 && y[i]>0) {
mx_2=max(mx_2,x[i]);
my_2=max(my_2,y[i]);
mn_2x=min(mn_2x,x[i]);
mn_2y=min(mn_2y,y[i]);
c2++;
}else if(x[i]<0 && y[i]<0) {
mx_3=max(mx_3,x[i]);
my_3=max(my_3,y[i]);
mn_3x=min(mn_3x,x[i]);
mn_3y=min(mn_3y,y[i]);
c3++;
}else if(x[i]>0 && y[i]<0) {
mx_4=max(mx_4,x[i]);
my_4=max(my_4,y[i]);
mn_4x=min(mn_4x,x[i]);
mn_4y=min(mn_4y,y[i]);
c4++;
}
}
if(c1!=0) cout << "Q1: (" << mn_1x << ", " << mn_1y << ") (" << mx_1 << ", " << my_1 << ") " << (mx_1-mn_1x)*(my_1-mn_1y) <<endl;
if(c2!=0) cout << "Q2: (" << mn_2x << ", " << mn_2y << ") (" << mx_2 << ", " << my_2 << ") " << (mx_2-mn_2x)*(my_2-mn_2y) <<endl;
if(c3!=0) cout << "Q3: (" << mn_3x << ", " << mn_3y << ") (" << mx_3 << ", " << my_3 << ") " << (mx_3-mn_3x)*(my_3-mn_3y) <<endl;
if(c4!=0) cout << "Q4: (" << mn_4x << ", " << mn_4y << ") (" << mx_4 << ", " << my_4 << ") " << (mx_4-mn_4x)*(my_4-mn_4y) <<endl;
if(c1==0 && c2==0 && c3==0 && c4==0) cout << "No point in any quadrant";
} | # 2069494, 2024-11-02 10:52:14, PPPPPPPPPP (100%)
#include<iostream>
#include<algorithm>
#include<climits>
using namespace std;
int main() {
int n;
cin >> n;
int x[n],y[n];
for(int i=0;i<n;i++) {
cin >> x[i] >> y[i];
}
int mx_1=INT_MIN;
int mx_2=INT_MIN;
int mx_3=INT_MIN;
int mx_4=INT_MIN;
int mn_1x=INT_MAX;
int mn_2x=INT_MAX;
int mn_3x=INT_MAX;
int mn_4x=INT_MAX;
int my_1=INT_MIN;
int my_2=INT_MIN;
int my_3=INT_MIN;
int my_4=INT_MIN;
int mn_1y=INT_MAX;
int mn_2y=INT_MAX;
int mn_3y=INT_MAX;
int mn_4y=INT_MAX;
int c1=0;
int c2=0;
int c3=0;
int c4=0;
for(int i=0;i<n;i++) {
if(x[i]>0 && y[i]>0) {
mx_1=max(mx_1,x[i]);
my_1=max(my_1,y[i]);
mn_1x=min(mn_1x,x[i]);
mn_1y=min(mn_1y,y[i]);
c1++;
}else if(x[i]<0 && y[i]>0) {
mx_2=max(mx_2,x[i]);
my_2=max(my_2,y[i]);
mn_2x=min(mn_2x,x[i]);
mn_2y=min(mn_2y,y[i]);
c2++;
}else if(x[i]<0 && y[i]<0) {
mx_3=max(mx_3,x[i]);
my_3=max(my_3,y[i]);
mn_3x=min(mn_3x,x[i]);
mn_3y=min(mn_3y,y[i]);
c3++;
}else if(x[i]>0 && y[i]<0) {
mx_4=max(mx_4,x[i]);
my_4=max(my_4,y[i]);
mn_4x=min(mn_4x,x[i]);
mn_4y=min(mn_4y,y[i]);
c4++;
}
}
if(c1!=0) cout << "Q1: (" << mn_1x << ", " << mn_1y << ") (" << mx_1 << ", " << my_1 << ") " << (mx_1-mn_1x)*(my_1-mn_1y) <<endl;
if(c2!=0) cout << "Q2: (" << mn_2x << ", " << mn_2y << ") (" << mx_2 << ", " << my_2 << ") " << (mx_2-mn_2x)*(my_2-mn_2y) <<endl;
if(c3!=0) cout << "Q3: (" << mn_3x << ", " << mn_3y << ") (" << mx_3 << ", " << my_3 << ") " << (mx_3-mn_3x)*(my_3-mn_3y) <<endl;
if(c4!=0) cout << "Q4: (" << mn_4x << ", " << mn_4y << ") (" << mx_4 << ", " << my_4 << ") " << (mx_4-mn_4x)*(my_4-mn_4y) <<endl;
if(c1==0 && c2==0 && c3==0 && c4==0) cout << "No point in any quadrant";
} |
# 2069193, 2024-11-02 10:24:16, -----P---- (10%)
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<utility>
using namespace std;
int main()
{
int N;
cin >> N;
int x,y;
set<pair<int,int>> Q1, Q2, Q3, Q4;
for (int i = 0; i < N; i++)
{
cin >> x >> y;
if (x == 0 || y == 0) continue;
if (x > 0 && y > 0) Q1.insert(make_pair(x,y));
if (x < 0 && y > 0) Q2.insert(make_pair(x,y));
if (x < 0 && y < 0) Q3.insert(make_pair(x,y));
if (x > 0 && y < 0) Q4.insert(make_pair(x,y));
}
if (Q1.size() <= 1 && Q2.size() <= 1 && Q3.size() <= 1 && Q4.size() <= 1)
{
cout << "No point in any quadrant" << endl;
return 0;
}
cout << "Test";
} | # 2069782, 2024-11-02 11:24:30, -----P---- (10%)
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<utility>
#include<map>
using namespace std;
int main()
{
int N;
cin >> N;
int x,y;
vector<pair<int,int>> Q1, Q2, Q3, Q4;
for (int i = 0; i < N; i++)
{
cin >> x >> y;
if (x == 0 || y == 0) continue;
if (x > 0 && y > 0) Q1.push_back(make_pair(x,y));
if (x < 0 && y > 0) Q2.push_back(make_pair(x,y));
if (x < 0 && y < 0) Q3.push_back(make_pair(x,y));
if (x > 0 && y < 0) Q4.push_back(make_pair(x,y));
sort(Q1.begin(),Q1.end());
sort(Q2.begin(),Q2.end());
sort(Q3.begin(),Q3.end());
sort(Q4.begin(),Q4.end());
}
if (Q1.size() <= 1 && Q2.size() <= 1 && Q3.size() <= 1 && Q4.size() <= 1)
{
cout << "No point in any quadrant" << endl;
return 0;
}
vector<pair<int,int>> Q1sq, Q2sq, Q3sq, Q4sq;
vector<int> area;
//Q1
if (!Q1.empty())
{
Q1sq.push_back(make_pair(Q1[0].first , Q1[0].second));
Q1sq.push_back(make_pair(Q1[Q1.size()-1].first , Q1[Q1.size()-1].second));
area.push_back((Q1[Q1.size()-1].first - Q1[0].first) * (Q1[Q1.size()-1].second - Q1[0].second));
}
if (!Q2.empty())
{
Q2sq.push_back(make_pair(Q2[0].first , Q2[0].second));
Q2sq.push_back(make_pair(Q2[Q2.size()-1].first , Q2[Q2.size()-1].second));
area.push_back((Q2[Q2.size()-1].first - Q2[0].first) * (Q2[Q2.size()-1].second - Q2[0].second));
}
if (!Q3.empty())
{
Q3sq.push_back(make_pair(Q3[0].first , Q3[0].second));
Q3sq.push_back(make_pair(Q3[Q3.size()-1].first , Q3[Q3.size()-1].second));
area.push_back((Q3[Q3.size()-1].first - Q3[0].first) * (Q3[Q3.size()-1].second - Q3[0].second));
}
if (!Q4.empty())
{
Q4sq.push_back(make_pair(Q4[0].first , Q4[0].second));
Q4sq.push_back(make_pair(Q4[Q4.size()-1].first , Q4[Q4.size()-1].second));
area.push_back((Q4[Q4.size()-1].first - Q4[0].first) * (Q4[Q4.size()-1].second - Q4[0].second));
}
if (!Q1.empty())
{
cout << "Q1: (" << Q1sq[0].first << ", " << Q1sq[0].second << ") (" << Q1sq[1].first << ", " << Q1sq[1].second << ") " << area[0] << endl;
}
if (!Q2.empty())
{
cout << "Q2: (" << Q2sq[0].first << ", " << Q2sq[0].second << ") (" << Q2sq[1].first << ", " << Q2sq[1].second << ") " << area[1-Q1.empty()] << endl;
}
if (!Q3.empty())
{
cout << "Q3: (" << Q3sq[0].first << ", " << Q3sq[0].second << ") (" << Q3sq[1].first << ", " << Q3sq[1].second << ") " << area[2-Q1.empty()-Q2.empty()] << endl;
}
if (!Q4.empty())
{
cout << "Q4: (" << Q4sq[0].first << ", " << Q4sq[0].second << ") (" << Q4sq[1].first << ", " << Q4sq[1].second << ") " << area[3-Q1.empty()-Q2.empty()-Q3.empty()] << endl;
}
} | # 2070044, 2024-11-02 11:46:58, PPPP-PPPPP (90%)
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<utility>
#include<map>
using namespace std;
int main()
{
int N;
cin >> N;
int x,y;
vector<pair<int,int>> Q1, Q2, Q3, Q4, Q1y, Q2y, Q3y, Q4y;
for (int i = 0; i < N; i++)
{
cin >> x >> y;
if (x == 0 || y == 0) continue;
if (x > 0 && y > 0)
{
Q1.push_back(make_pair(x,y));
Q1y.push_back(make_pair(y,x));
}
if (x < 0 && y > 0)
{
Q2.push_back(make_pair(x,y));
Q2y.push_back(make_pair(y,x));
}
if (x < 0 && y < 0)
{
Q3.push_back(make_pair(x,y));
Q3y.push_back(make_pair(y,x));
}
if (x > 0 && y < 0)
{
Q4.push_back(make_pair(x,y));
Q4y.push_back(make_pair(y,x));
}
sort(Q1.begin(),Q1.end());
sort(Q2.begin(),Q2.end());
sort(Q3.begin(),Q3.end());
sort(Q4.begin(),Q4.end());
sort(Q1y.begin(),Q1y.end());
sort(Q2y.begin(),Q2y.end());
sort(Q3y.begin(),Q3y.end());
sort(Q4y.begin(),Q4y.end());
}
if (Q1.size() <= 1 && Q2.size() <= 1 && Q3.size() <= 1 && Q4.size() <= 1)
{
cout << "No point in any quadrant" << endl;
return 0;
}
vector<pair<int,int>> Q1sq, Q2sq, Q3sq, Q4sq;
vector<int> area;
//Q1
if (!Q1.empty())
{
Q1sq.push_back(make_pair(Q1[0].first , Q1y[0].first));
Q1sq.push_back(make_pair(Q1[Q1.size()-1].first , Q1y[Q1y.size()-1].first));
area.push_back((Q1y[Q1y.size()-1].first - Q1y[0].first) * (Q1[Q1.size()-1].first - Q1[0].first));
}
if (!Q2.empty())
{
Q2sq.push_back(make_pair(Q2[0].first , Q2y[0].first));
Q2sq.push_back(make_pair(Q2[Q2.size()-1].first , Q2y[Q2y.size()-1].first));
area.push_back((Q2y[Q2y.size()-1].first - Q2y[0].first) * (Q2[Q2.size()-1].first - Q2[0].first));
}
if (!Q3.empty())
{
Q3sq.push_back(make_pair(Q3[0].first , Q3y[0].first));
Q3sq.push_back(make_pair(Q3[Q3.size()-1].first , Q3y[Q3y.size()-1].first));
area.push_back((Q3y[Q3y.size()-1].first - Q3y[0].first) * (Q3[Q3.size()-1].first - Q3[0].first));
}
if (!Q4.empty())
{
Q4sq.push_back(make_pair(Q4[0].first , Q4y[0].first));
Q4sq.push_back(make_pair(Q4[Q4.size()-1].first , Q4y[Q4y.size()-1].first));
area.push_back((Q4y[Q4y.size()-1].first - Q4y[0].first) * (Q4[Q4.size()-1].first - Q4[0].first));
}
if (!Q1.empty())
{
cout << "Q1: (" << Q1sq[0].first << ", " << Q1sq[0].second << ") (" << Q1sq[1].first << ", " << Q1sq[1].second << ") " << area[0] << endl;
}
if (!Q2.empty())
{
cout << "Q2: (" << Q2sq[0].first << ", " << Q2sq[0].second << ") (" << Q2sq[1].first << ", " << Q2sq[1].second << ") " << area[1-Q1.empty()] << endl;
}
if (!Q3.empty())
{
cout << "Q3: (" << Q3sq[0].first << ", " << Q3sq[0].second << ") (" << Q3sq[1].first << ", " << Q3sq[1].second << ") " << area[2-Q1.empty()-Q2.empty()] << endl;
}
if (!Q4.empty())
{
cout << "Q4: (" << Q4sq[0].first << ", " << Q4sq[0].second << ") (" << Q4sq[1].first << ", " << Q4sq[1].second << ") " << area[3-Q1.empty()-Q2.empty()-Q3.empty()] << endl;
}
} | # 2070096, 2024-11-02 11:50:16, PPPPPPPPPP (100%)
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<utility>
#include<map>
using namespace std;
int main()
{
int N;
cin >> N;
int x,y;
vector<pair<int,int>> Q1, Q2, Q3, Q4, Q1y, Q2y, Q3y, Q4y;
for (int i = 0; i < N; i++)
{
cin >> x >> y;
if (x == 0 || y == 0) continue;
if (x > 0 && y > 0)
{
Q1.push_back(make_pair(x,y));
Q1y.push_back(make_pair(y,x));
}
if (x < 0 && y > 0)
{
Q2.push_back(make_pair(x,y));
Q2y.push_back(make_pair(y,x));
}
if (x < 0 && y < 0)
{
Q3.push_back(make_pair(x,y));
Q3y.push_back(make_pair(y,x));
}
if (x > 0 && y < 0)
{
Q4.push_back(make_pair(x,y));
Q4y.push_back(make_pair(y,x));
}
sort(Q1.begin(),Q1.end());
sort(Q2.begin(),Q2.end());
sort(Q3.begin(),Q3.end());
sort(Q4.begin(),Q4.end());
sort(Q1y.begin(),Q1y.end());
sort(Q2y.begin(),Q2y.end());
sort(Q3y.begin(),Q3y.end());
sort(Q4y.begin(),Q4y.end());
}
if (Q1.size() < 1 && Q2.size() < 1 && Q3.size() < 1 && Q4.size() < 1)
{
cout << "No point in any quadrant" << endl;
return 0;
}
vector<pair<int,int>> Q1sq, Q2sq, Q3sq, Q4sq;
vector<int> area;
//Q1
if (!Q1.empty())
{
Q1sq.push_back(make_pair(Q1[0].first , Q1y[0].first));
Q1sq.push_back(make_pair(Q1[Q1.size()-1].first , Q1y[Q1y.size()-1].first));
area.push_back((Q1y[Q1y.size()-1].first - Q1y[0].first) * (Q1[Q1.size()-1].first - Q1[0].first));
}
if (!Q2.empty())
{
Q2sq.push_back(make_pair(Q2[0].first , Q2y[0].first));
Q2sq.push_back(make_pair(Q2[Q2.size()-1].first , Q2y[Q2y.size()-1].first));
area.push_back((Q2y[Q2y.size()-1].first - Q2y[0].first) * (Q2[Q2.size()-1].first - Q2[0].first));
}
if (!Q3.empty())
{
Q3sq.push_back(make_pair(Q3[0].first , Q3y[0].first));
Q3sq.push_back(make_pair(Q3[Q3.size()-1].first , Q3y[Q3y.size()-1].first));
area.push_back((Q3y[Q3y.size()-1].first - Q3y[0].first) * (Q3[Q3.size()-1].first - Q3[0].first));
}
if (!Q4.empty())
{
Q4sq.push_back(make_pair(Q4[0].first , Q4y[0].first));
Q4sq.push_back(make_pair(Q4[Q4.size()-1].first , Q4y[Q4y.size()-1].first));
area.push_back((Q4y[Q4y.size()-1].first - Q4y[0].first) * (Q4[Q4.size()-1].first - Q4[0].first));
}
if (!Q1.empty())
{
cout << "Q1: (" << Q1sq[0].first << ", " << Q1sq[0].second << ") (" << Q1sq[1].first << ", " << Q1sq[1].second << ") " << area[0] << endl;
}
if (!Q2.empty())
{
cout << "Q2: (" << Q2sq[0].first << ", " << Q2sq[0].second << ") (" << Q2sq[1].first << ", " << Q2sq[1].second << ") " << area[1-Q1.empty()] << endl;
}
if (!Q3.empty())
{
cout << "Q3: (" << Q3sq[0].first << ", " << Q3sq[0].second << ") (" << Q3sq[1].first << ", " << Q3sq[1].second << ") " << area[2-Q1.empty()-Q2.empty()] << endl;
}
if (!Q4.empty())
{
cout << "Q4: (" << Q4sq[0].first << ", " << Q4sq[0].second << ") (" << Q4sq[1].first << ", " << Q4sq[1].second << ") " << area[3-Q1.empty()-Q2.empty()-Q3.empty()] << endl;
}
} |
# 2069370, 2024-11-02 10:41:12, xxxx-xxxx- (0%)
#include<bits/stdc++.h>
#include <cmath>
using namespace std;
int main(){
int k ;
cin >> k;
int x,y;
map<string,vector<pair<int,int>>> Quad;
map<string,int> square;
Quad["Q1"] ={};
Quad["Q2"] ={};
Quad["Q3"] ={};
Quad["Q4"] ={};
Quad["trash"] ={};
while (k--)
{
cin >>x>>y;
if(x == 0 || y == 0){
Quad["trash"].push_back(make_pair(x,y));
} else if(x>0 &&y>0){
Quad["Q1"].push_back(make_pair(x,y));
} else if( x<0 && y> 0 ){
Quad["Q2"].push_back(make_pair(x,y));
} else if( x<0 && y < 0 ){
Quad["Q3"].push_back(make_pair(x,y));
} else if(x>0 && y< 0 ){
Quad["Q4"].push_back(make_pair(x,y));
}
}
for ( auto &e : Quad)
{
multiset<int> ax;
multiset<int> ay;
for (auto &p : e.second)
{
ax.insert(p.first);
ay.insert(p.second);
}
auto itrx = ax.begin();
auto itry = ay.begin();
auto itrx2 = ax.end();
auto itry2 = ay.end();
int mul = (*itrx - *(--itrx2)) * (*itry - *(--itry2));
square[e.first] = mul;
mul = 0;
}
for ( auto &e : Quad)
{
if(e.first == "trash"){
break;
}
if (e.second.size() == 0 ){
continue;
}
cout << e.first <<": ";
for (auto &p : e.second)
{
cout << "("<<p.first<<", "<<p.second << ") ";
}
cout << square[e.first] ;
cout << endl;
}
} | # 2069483, 2024-11-02 10:51:04, xxxxPxxxxP (20%)
#include<bits/stdc++.h>
#include <cmath>
using namespace std;
int main(){
int k ;
cin >> k;
int x,y;
map<string,vector<pair<int,int>>> Quad;
map<string,vector<pair<int,int>>> Quad2;
map<string,int> square;
Quad["Q1"] ={};
Quad["Q2"] ={};
Quad["Q3"] ={};
Quad["Q4"] ={};
Quad["trash"] ={};
while (k--)
{
cin >>x>>y;
if(x == 0 || y == 0){
Quad["trash"].push_back(make_pair(x,y));
} else if(x>0 &&y>0){
Quad["Q1"].push_back(make_pair(x,y));
} else if( x<0 && y> 0 ){
Quad["Q2"].push_back(make_pair(x,y));
} else if( x<0 && y < 0 ){
Quad["Q3"].push_back(make_pair(x,y));
} else if(x>0 && y< 0 ){
Quad["Q4"].push_back(make_pair(x,y));
}
}
for ( auto &e : Quad)
{
multiset<int> ax;
multiset<int> ay;
for (auto &p : e.second)
{
ax.insert(p.first);
ay.insert(p.second);
}
auto itrx = ax.begin();
auto itry = ay.begin();
auto itrx2 = ax.end();
auto itry2 = ay.end();
Quad2[e.first].push_back(make_pair(*itrx , *itry));
int mul = (*itrx - *(--itrx2)) * (*itry - *(--itry2));
Quad2[e.first].push_back(make_pair(*itrx2, *itry2));
square[e.first] = mul;
mul = 0;
}
for ( auto &e : Quad)
{
if(e.first == "trash"){
break;
}
if (e.second.size() == 0 ){
continue;
}
cout << e.first <<": ";
for (auto &p : Quad2[e.first])
{
cout << "("<<p.first<<", "<<p.second << ") ";
}
cout << square[e.first] ;
cout << endl;
}
} | # 2069557, 2024-11-02 10:58:21, PPPPP-PPPP (90%)
#include<bits/stdc++.h>
#include <cmath>
using namespace std;
int main(){
int k ;
cin >> k;
int x,y;
map<string,vector<pair<int,int>>> Quad;
map<string,vector<pair<int,int>>> Quad2;
map<string,int> square;
Quad["Q1"] ={};
Quad["Q2"] ={};
Quad["Q3"] ={};
Quad["Q4"] ={};
Quad["trash"] ={};
while (k--)
{
cin >>x>>y;
if(x == 0 || y == 0){
Quad["trash"].push_back(make_pair(x,y));
} else if(x>0 &&y>0){
Quad["Q1"].push_back(make_pair(x,y));
} else if( x<0 && y> 0 ){
Quad["Q2"].push_back(make_pair(x,y));
} else if( x<0 && y < 0 ){
Quad["Q3"].push_back(make_pair(x,y));
} else if(x>0 && y< 0 ){
Quad["Q4"].push_back(make_pair(x,y));
}
}
for ( auto &e : Quad)
{
if(e.first == "trash"){
break;
}
multiset<int> ax;
multiset<int> ay;
for (auto &p : e.second)
{
ax.insert(p.first);
ay.insert(p.second);
}
auto itrx = ax.begin();
auto itry = ay.begin();
auto itrx2 = ax.end();
auto itry2 = ay.end();
int mul;
Quad2[e.first].push_back(make_pair(*itrx , *itry));
if (itrx != itrx2 || itry != itry2)
{
mul = (*itrx - *(--itrx2)) * (*itry - *(--itry2));
} else {
mul = 0 ;
}
Quad2[e.first].push_back(make_pair(*itrx2, *itry2));
square[e.first] = mul;
mul = 0;
}
bool notfound = true;
for ( auto &e : Quad)
{
if(e.first == "trash"){
break;
}
if (e.second.size() == 0 ){
continue;
}
cout << e.first <<": ";
for (auto &p : Quad2[e.first])
{
cout << "("<<p.first<<", "<<p.second << ") ";
notfound = false;
}
cout << square[e.first] ;
cout << endl;
if(notfound){
cout << "No point in any quadrant";
}
}
} | # 2069596, 2024-11-02 11:02:32, PPPPPPPPPP (100%)
#include<bits/stdc++.h>
#include <cmath>
using namespace std;
int main(){
int k ;
cin >> k;
int x,y;
map<string,vector<pair<int,int>>> Quad;
map<string,vector<pair<int,int>>> Quad2;
map<string,int> square;
Quad["Q1"] ={};
Quad["Q2"] ={};
Quad["Q3"] ={};
Quad["Q4"] ={};
Quad["trash"] ={};
while (k--)
{
cin >>x>>y;
if(x == 0 || y == 0){
Quad["trash"].push_back(make_pair(x,y));
} else if(x>0 &&y>0){
Quad["Q1"].push_back(make_pair(x,y));
} else if( x<0 && y> 0 ){
Quad["Q2"].push_back(make_pair(x,y));
} else if( x<0 && y < 0 ){
Quad["Q3"].push_back(make_pair(x,y));
} else if(x>0 && y< 0 ){
Quad["Q4"].push_back(make_pair(x,y));
}
}
for ( auto &e : Quad)
{
if(e.first == "trash"){
break;
}
multiset<int> ax;
multiset<int> ay;
for (auto &p : e.second)
{
ax.insert(p.first);
ay.insert(p.second);
}
auto itrx = ax.begin();
auto itry = ay.begin();
auto itrx2 = ax.end();
auto itry2 = ay.end();
int mul;
Quad2[e.first].push_back(make_pair(*itrx , *itry));
if (itrx != itrx2 || itry != itry2)
{
mul = (*itrx - *(--itrx2)) * (*itry - *(--itry2));
} else {
mul = 0 ;
}
Quad2[e.first].push_back(make_pair(*itrx2, *itry2));
square[e.first] = mul;
mul = 0;
}
bool notfound = true;
for ( auto &e : Quad)
{
if(e.first == "trash"){
break;
}
if (e.second.size() == 0 ){
continue;
}
cout << e.first <<": ";
for (auto &p : Quad2[e.first])
{
cout << "("<<p.first<<", "<<p.second << ") ";
notfound = false;
}
cout << square[e.first] ;
cout << endl;
}
if((notfound)){
cout << "No point in any quadrant";
}
} |
# 2069059, 2024-11-02 10:08:16, ---------- (0%)
#include<iostream>
#include<vector>
#include<cmath>
using namespace std;
int main(){
int n;cin >> n;
string ask; cin >> ask;
vector<float> x_val,y_val;
for(int i = 0;i<n;i++)
{
float tempx,tempy;
cin >> tempx >> tempy;
x_val.push_back(tempx);
y_val.push_back(tempy);
}
float m;
float b;
//m
float sec1_m = 0.0;
for(int i = 0;i<n;i++){
sec1_m += x_val[i]*y_val[i];
}
sec1_m *= (n);
float sec2_m = 0.0;
float sumx_m = 0.0;
float sumy_m = 0.0;
for(int i =0;i<n;i++){
sumx_m += x_val[i];
sumy_m += y_val[i];
}
sec2_m = sumx_m*sumy_m;
float sec3_m = 0.0;
float pow_sumx = 0.0;
for(int i =0;i<n;i++){
pow_sumx += pow(x_val[i],2);
}
sec3_m = pow_sumx*n;
float sec4_m = pow(sumx_m,2);
m = (sec1_m - sec2_m)/(sec3_m-sec4_m);
//b
float sec1_b = 0.0;
for(int i = 0;i<n;i++){
sec1_b += y_val[i];
}
b = (sec1_b- (m*sumx_m))/float(n);
if(ask == "mb"){
cout << round(m*1e3)/1e3 << endl;
cout << round(b*1e3)/1e3 << endl;
}
else if(ask == "func"){
cout << "y = ";
float out_m = round(m*1e3)/1e3 ;
float out_b = round(b*1e3)/1e3 ;
if(out_m == 0 && out_b == 0){
cout << 0;
return 0;
}
if(out_m == 0){
cout << out_b;
return 0;
}
if(out_m == 1 && out_b != 0){
cout<< "x " << (out_b < 0? "- ": "+ ") << fabs(out_b) ;
return 0;
}
if(out_m == -1 && out_b != 0){
cout<< "-x " << (out_b < 0? "- ": "+ ") << fabs(out_b) ;
return 0;
}
if(out_m == 1 && out_b == 0){
cout<< "x ";
return 0;
}
if(out_m == -1 && out_b == 0){
cout<< "-x ";
return 0;
}
cout<< out_m <<"x " << (out_b < 0? "- ": "+ ") << fabs(out_b) ;
}
} | # 2069081, 2024-11-02 10:10:22, ---------- (0%)
#include<iostream>
#include<vector>
#include<cmath>
using namespace std;
int main(){
int n;cin >> n;
string ask; cin >> ask;
vector<float> x_val,y_val;
for(int i = 0;i<n;i++)
{
float tempx,tempy;
cin >> tempx >> tempy;
x_val.push_back(tempx);
y_val.push_back(tempy);
}
float m;
float b;
//m
float sec1_m = 0.0;
for(int i = 0;i<n;i++){
sec1_m += x_val[i]*y_val[i];
}
sec1_m *= float(n);
float sec2_m = 0.0;
float sumx_m = 0.0;
float sumy_m = 0.0;
for(int i =0;i<n;i++){
sumx_m += x_val[i];
sumy_m += y_val[i];
}
sec2_m = sumx_m*sumy_m;
float sec3_m = 0.0;
float pow_sumx = 0.0;
for(int i =0;i<n;i++){
pow_sumx += pow(x_val[i],2);
}
sec3_m = pow_sumx*float(n);
float sec4_m = pow(sumx_m,2);
m = (sec1_m - sec2_m)/(sec3_m-sec4_m);
//b
float sec1_b = 0.0;
for(int i = 0;i<n;i++){
sec1_b += y_val[i];
}
b = (sec1_b- (m*sumx_m))/float(n);
if(ask == "mb"){
cout << round(m*1e3)/1e3 << endl;
cout << round(b*1e3)/1e3 << endl;
}
else if(ask == "func"){
cout << "y = ";
float out_m = round(m*1e3)/1e3 ;
float out_b = round(b*1e3)/1e3 ;
if(out_m == 0 && out_b == 0){
cout << 0;
return 0;
}
if(out_m == 0){
cout << out_b;
return 0;
}
if(out_m == 1 && out_b != 0){
cout<< "x " << (out_b < 0? "- ": "+ ") << fabs(out_b) ;
return 0;
}
if(out_m == -1 && out_b != 0){
cout<< "-x " << (out_b < 0? "- ": "+ ") << fabs(out_b) ;
return 0;
}
if(out_m == 1 && out_b == 0){
cout<< "x ";
return 0;
}
if(out_m == -1 && out_b == 0){
cout<< "-x ";
return 0;
}
cout<< out_m <<"x " << (out_b < 0? "- ": "+ ") << fabs(out_b) ;
}
} | # 2069391, 2024-11-02 10:43:01, -----P---- (10%)
#include<iostream>
#include<vector>
#include<utility>
#include<algorithm>
using namespace std;
int main(){
int n; cin >> n;
vector<int> all_point_x , in_q1_x ,in_q2_x,in_q3_x,in_q4_x;
vector<int> all_point_y , in_q1_y ,in_q2_y,in_q3_y,in_q4_y;
while (n--)
{
int tempx; cin>> tempx;
int tempy; cin >> tempy;
if(tempx != 0 && tempy != 0){
if(tempx > 0 && tempy > 0){
in_q1_x.push_back(tempx);
in_q1_y.push_back(tempy);
}
else if(tempx < 0 && tempy > 0){
in_q2_x.push_back(tempx);
in_q2_y.push_back(tempy);
}
else if(tempx < 0 && tempy < 0){
in_q3_x.push_back(tempx);
in_q3_y.push_back(tempy);
}
else if(tempx > 0 && tempy < 0){
in_q4_x.push_back(tempx);
in_q4_y.push_back(tempy);
}
}
}
if(in_q1_x.size() == 0 && in_q1_y.size() == 0 && in_q2_x.size() == 0 && in_q2_y.size() == 0
&& in_q3_x.size() == 0 && in_q3_y.size() == 0 && in_q4_x.size() == 0 && in_q4_y.size() == 0){
cout << "No point in any quadrant";
}
else{
if(in_q1_x.size() != 0 && in_q1_y.size() != 0){
cout << "Q1: " << "(" << *min_element(in_q1_x.begin(),in_q1_x.end()) << "," << *min_element(in_q1_y.begin(),in_q1_y.end()) << ")";
cout << " " << "(" << *max_element(in_q1_x.begin(),in_q1_x.end()) << "," << *max_element(in_q1_y.begin(),in_q1_y.end()) << ")";
cout << " " << (*max_element(in_q1_x.begin(),in_q1_x.end()) - *min_element(in_q1_x.begin(),in_q1_x.end())) * (*max_element(in_q1_y.begin(),in_q1_y.end()) - *min_element(in_q1_y.begin(),in_q1_y.end()));
cout << endl;
}
if(in_q2_x.size() != 0 && in_q2_y.size() != 0){
cout << "Q2: " << "(" << *min_element(in_q2_x.begin(),in_q2_x.end()) << "," << *min_element(in_q2_y.begin(),in_q2_y.end()) << ")";
cout << " " << "(" << *max_element(in_q2_x.begin(),in_q2_x.end()) << "," << *max_element(in_q2_y.begin(),in_q2_y.end()) << ")";
cout << " " << (*max_element(in_q2_x.begin(),in_q2_x.end()) - *min_element(in_q2_x.begin(),in_q2_x.end())) * (*max_element(in_q2_y.begin(),in_q2_y.end()) - *min_element(in_q2_y.begin(),in_q2_y.end()));
cout << endl;
}
if(in_q3_x.size() != 0 && in_q3_y.size() != 0){
cout << "Q3: " << "(" << *min_element(in_q3_x.begin(),in_q3_x.end()) << "," << *min_element(in_q3_y.begin(),in_q3_y.end()) << ")";
cout << " " << "(" << *max_element(in_q3_x.begin(),in_q3_x.end()) << "," << *max_element(in_q3_y.begin(),in_q3_y.end()) << ")";
cout << " " << (*max_element(in_q3_x.begin(),in_q3_x.end()) - *min_element(in_q3_x.begin(),in_q3_x.end())) * (*max_element(in_q3_y.begin(),in_q3_y.end()) - *min_element(in_q3_y.begin(),in_q3_y.end()));
cout << endl;
}
if(in_q4_x.size() != 0 && in_q4_y.size() != 0){
cout << "Q4: " << "(" << *min_element(in_q4_x.begin(),in_q4_x.end()) << "," << *min_element(in_q4_y.begin(),in_q4_y.end()) << ")";
cout << " " << "(" << *max_element(in_q4_x.begin(),in_q4_x.end()) << "," << *max_element(in_q4_y.begin(),in_q4_y.end()) << ")";
cout << " " << (*max_element(in_q4_x.begin(),in_q4_x.end()) - *min_element(in_q4_x.begin(),in_q4_x.end())) * (*max_element(in_q4_y.begin(),in_q4_y.end()) - *min_element(in_q4_y.begin(),in_q4_y.end()));
cout << endl;
}
}
} | # 2069415, 2024-11-02 10:44:38, PPPPPPPPPP (100%)
#include<iostream>
#include<vector>
#include<utility>
#include<algorithm>
using namespace std;
int main(){
int n; cin >> n;
vector<int> all_point_x , in_q1_x ,in_q2_x,in_q3_x,in_q4_x;
vector<int> all_point_y , in_q1_y ,in_q2_y,in_q3_y,in_q4_y;
while (n--)
{
int tempx; cin>> tempx;
int tempy; cin >> tempy;
if(tempx != 0 && tempy != 0){
if(tempx > 0 && tempy > 0){
in_q1_x.push_back(tempx);
in_q1_y.push_back(tempy);
}
else if(tempx < 0 && tempy > 0){
in_q2_x.push_back(tempx);
in_q2_y.push_back(tempy);
}
else if(tempx < 0 && tempy < 0){
in_q3_x.push_back(tempx);
in_q3_y.push_back(tempy);
}
else if(tempx > 0 && tempy < 0){
in_q4_x.push_back(tempx);
in_q4_y.push_back(tempy);
}
}
}
if(in_q1_x.size() == 0 && in_q1_y.size() == 0 && in_q2_x.size() == 0 && in_q2_y.size() == 0
&& in_q3_x.size() == 0 && in_q3_y.size() == 0 && in_q4_x.size() == 0 && in_q4_y.size() == 0){
cout << "No point in any quadrant";
}
else{
if(in_q1_x.size() != 0 && in_q1_y.size() != 0){
cout << "Q1: " << "(" << *min_element(in_q1_x.begin(),in_q1_x.end()) << ", " << *min_element(in_q1_y.begin(),in_q1_y.end()) << ")";
cout << " " << "(" << *max_element(in_q1_x.begin(),in_q1_x.end()) << ", " << *max_element(in_q1_y.begin(),in_q1_y.end()) << ")";
cout << " " << (*max_element(in_q1_x.begin(),in_q1_x.end()) - *min_element(in_q1_x.begin(),in_q1_x.end())) * (*max_element(in_q1_y.begin(),in_q1_y.end()) - *min_element(in_q1_y.begin(),in_q1_y.end()));
cout << endl;
}
if(in_q2_x.size() != 0 && in_q2_y.size() != 0){
cout << "Q2: " << "(" << *min_element(in_q2_x.begin(),in_q2_x.end()) << ", " << *min_element(in_q2_y.begin(),in_q2_y.end()) << ")";
cout << " " << "(" << *max_element(in_q2_x.begin(),in_q2_x.end()) << ", " << *max_element(in_q2_y.begin(),in_q2_y.end()) << ")";
cout << " " << (*max_element(in_q2_x.begin(),in_q2_x.end()) - *min_element(in_q2_x.begin(),in_q2_x.end())) * (*max_element(in_q2_y.begin(),in_q2_y.end()) - *min_element(in_q2_y.begin(),in_q2_y.end()));
cout << endl;
}
if(in_q3_x.size() != 0 && in_q3_y.size() != 0){
cout << "Q3: " << "(" << *min_element(in_q3_x.begin(),in_q3_x.end()) << ", " << *min_element(in_q3_y.begin(),in_q3_y.end()) << ")";
cout << " " << "(" << *max_element(in_q3_x.begin(),in_q3_x.end()) << ", " << *max_element(in_q3_y.begin(),in_q3_y.end()) << ")";
cout << " " << (*max_element(in_q3_x.begin(),in_q3_x.end()) - *min_element(in_q3_x.begin(),in_q3_x.end())) * (*max_element(in_q3_y.begin(),in_q3_y.end()) - *min_element(in_q3_y.begin(),in_q3_y.end()));
cout << endl;
}
if(in_q4_x.size() != 0 && in_q4_y.size() != 0){
cout << "Q4: " << "(" << *min_element(in_q4_x.begin(),in_q4_x.end()) << ", " << *min_element(in_q4_y.begin(),in_q4_y.end()) << ")";
cout << " " << "(" << *max_element(in_q4_x.begin(),in_q4_x.end()) << ", " << *max_element(in_q4_y.begin(),in_q4_y.end()) << ")";
cout << " " << (*max_element(in_q4_x.begin(),in_q4_x.end()) - *min_element(in_q4_x.begin(),in_q4_x.end())) * (*max_element(in_q4_y.begin(),in_q4_y.end()) - *min_element(in_q4_y.begin(),in_q4_y.end()));
cout << endl;
}
}
} |
# 2069487, 2024-11-02 10:51:30, -----P---- (10%)
#include <iostream>
#include <vector>
#include <string>
#include <map>
using namespace std;
void change(int x, int y, map<int, pair<pair<int, int>, pair<int, int>>> &g) {
int d = 0;
if (x > 0 && y > 0) d = 1;
else if (x < 0 && y > 0) d = 2;
else if (x < 0 && y < 0) d = 3;
else if (x > 0 && y < 0) d = 4;
if (d != 0) {
pair<int, int> mnVal = make_pair(min(x, g[d].first.first), min(y, g[d].first.second));
pair<int, int> mxVal = make_pair(max(x, g[d].second.first), max(y, g[d].second.second));
g[d] = make_pair(mnVal, mxVal);
}
}
int area(pair<pair<int, int>, pair<int, int>> p) {
int w = p.second.first - p.first.first;
int h = p.second.second - p.first.second;
return (w * h);
}
int main() {
int n; cin >> n;
map<int, pair<pair<int, int>, pair<int, int>>> g;
int maxX = -99, maxY = -99, minX = 99, minY = 99;
for (int i = 1; i <= 4; i++) {
g[i] = make_pair(make_pair(minX, minY), make_pair(maxX, maxY));
}
bool noQ = true;
while (n--) {
int x, y; cin >> x >> y;
if ( x != 0 && y != 0) {
noQ = false;
change(x, y, g);
}
}
if (!noQ) {
for (int i = 1; i <= 4; i++) {
cout << "Q" << i << ": " << "(" << g[i].first.first << "," << g[i].first.second << ") " << "(" << g[i].second.first << "," << g[i].second.second << ") " << area(g[i]) << endl;
}
}
else cout << "No point in any quadrant";
} | # 2069510, 2024-11-02 10:54:12, -----P---- (10%)
#include <iostream>
#include <vector>
#include <string>
#include <map>
using namespace std;
void change(int x, int y, map<int, pair<pair<int, int>, pair<int, int>>> &g) {
int d = 0;
if (x > 0 && y > 0) d = 1;
else if (x < 0 && y > 0) d = 2;
else if (x < 0 && y < 0) d = 3;
else if (x > 0 && y < 0) d = 4;
if (d != 0) {
pair<int, int> mnVal = make_pair(min(x, g[d].first.first), min(y, g[d].first.second));
pair<int, int> mxVal = make_pair(max(x, g[d].second.first), max(y, g[d].second.second));
g[d] = make_pair(mnVal, mxVal);
}
}
int area(pair<pair<int, int>, pair<int, int>> p) {
int w = p.second.first - p.first.first;
int h = p.second.second - p.first.second;
return (w * h);
}
int main() {
int n; cin >> n;
map<int, pair<pair<int, int>, pair<int, int>>> g;
int maxX = -99, maxY = -99, minX = 99, minY = 99;
for (int i = 1; i <= 4; i++) {
g[i] = make_pair(make_pair(minX, minY), make_pair(maxX, maxY));
}
bool noQ = true;
while (n--) {
int x, y; cin >> x >> y;
if ( x != 0 && y != 0) {
noQ = false;
change(x, y, g);
}
}
if (!noQ) {
for (int i = 1; i <= 4; i++) {
if (g[i].first.first != 99 && g[i].first.second != 99 && g[i].second.first != -99 && g[i].second.second != -99) {
cout << "Q" << i << ": " << "(" << g[i].first.first << "," << g[i].first.second << ") " << "(" << g[i].second.first << "," << g[i].second.second << ") " << area(g[i]) << endl;
}
}
}
else cout << "No point in any quadrant";
} | # 2069518, 2024-11-02 10:54:26, -----P---- (10%)
#include <iostream>
#include <vector>
#include <string>
#include <map>
using namespace std;
void change(int x, int y, map<int, pair<pair<int, int>, pair<int, int>>> &g) {
int d = 0;
if (x > 0 && y > 0) d = 1;
else if (x < 0 && y > 0) d = 2;
else if (x < 0 && y < 0) d = 3;
else if (x > 0 && y < 0) d = 4;
if (d != 0) {
pair<int, int> mnVal = make_pair(min(x, g[d].first.first), min(y, g[d].first.second));
pair<int, int> mxVal = make_pair(max(x, g[d].second.first), max(y, g[d].second.second));
g[d] = make_pair(mnVal, mxVal);
}
}
int area(pair<pair<int, int>, pair<int, int>> p) {
int w = p.second.first - p.first.first;
int h = p.second.second - p.first.second;
return (w * h);
}
int main() {
int n; cin >> n;
map<int, pair<pair<int, int>, pair<int, int>>> g;
int maxX = -99, maxY = -99, minX = 99, minY = 99;
for (int i = 1; i <= 4; i++) {
g[i] = make_pair(make_pair(minX, minY), make_pair(maxX, maxY));
}
bool noQ = true;
while (n--) {
int x, y; cin >> x >> y;
if ( x != 0 && y != 0) {
noQ = false;
change(x, y, g);
}
}
if (!noQ) {
for (int i = 1; i <= 4; i++) {
if (g[i].first.first != 99 && g[i].first.second != 99 && g[i].second.first != -99 && g[i].second.second != -99) {
cout << "Q" << i << ": " << "(" << g[i].first.first << "," << g[i].first.second << ") " << "(" << g[i].second.first << "," << g[i].second.second << ") " << area(g[i]) << endl;
}
}
}
else cout << "No point in any quadrant";
} | # 2069549, 2024-11-02 10:57:45, PPPPPPPPPP (100%)
#include <iostream>
#include <vector>
#include <string>
#include <map>
using namespace std;
void change(int x, int y, map<int, pair<pair<int, int>, pair<int, int>>> &g) {
int d = 0;
if (x > 0 && y > 0) d = 1;
else if (x < 0 && y > 0) d = 2;
else if (x < 0 && y < 0) d = 3;
else if (x > 0 && y < 0) d = 4;
if (d != 0) {
pair<int, int> mnVal = make_pair(min(x, g[d].first.first), min(y, g[d].first.second));
pair<int, int> mxVal = make_pair(max(x, g[d].second.first), max(y, g[d].second.second));
g[d] = make_pair(mnVal, mxVal);
}
}
int area(pair<pair<int, int>, pair<int, int>> p) {
int w = p.second.first - p.first.first;
int h = p.second.second - p.first.second;
return (w * h);
}
int main() {
int n; cin >> n;
map<int, pair<pair<int, int>, pair<int, int>>> g;
int maxX = -99, maxY = -99, minX = 99, minY = 99;
for (int i = 1; i <= 4; i++) {
g[i] = make_pair(make_pair(minX, minY), make_pair(maxX, maxY));
}
bool noQ = true;
int x, y;
while (n--) {
cin >> x >> y;
if ( x != 0 && y != 0) {
noQ = false;
change(x, y, g);
}
}
if (!noQ) {
for (int i = 1; i <= 4; i++) {
if (g[i].first.first != 99 && g[i].first.second != 99 && g[i].second.first != -99 && g[i].second.second != -99) {
cout << "Q" << i << ": " << "(" << g[i].first.first << ", " << g[i].first.second << ") " << "(" << g[i].second.first << ", " << g[i].second.second << ") " << area(g[i]) << endl;
}
}
}
else cout << "No point in any quadrant";
} |
# 2071534, 2024-11-02 14:46:06, ---------- (0%)
#include<bits/stdc++.h>
using namespace std ;
int main () {
int n;
int x,y ;
map<int,vector<pair<int,int>>> q;
cin>>n;
for (int i=0;i<n;i++) {
cin>>x>>y ;
if(x!=0) {
if (y!=0) {
if (x>0&&y>0) {
q[1].push_back((make_pair(x,y))) ;
}
if (x<0&&y>0) {
q[2].push_back((make_pair(x,y))) ;
}
if (x<0&&y<0) {
q[3].push_back((make_pair(x,y))) ;
}
if (x>0&&y<0) {
q[4].push_back((make_pair(x,y))) ;
}
}
}
}
for (auto& itr:q) {
int minx=100000000,maxx=-10000000000,miny=100000000,maxy=-1000000000 ;
//cout<<"q"<<itr.first<<":" ;
for (auto &it:itr.second) {
//cout<<"("<<it.first<<","<<it.second<<")" ;
if (it.first>maxx) {
maxx=it.first ;
}
if (it.first<minx) {
minx=it.first ;
}
if (it.second<miny) {
miny=it.second ;
}
if (it.second>maxy) {
maxy=it.second ;
}
}
//cout<<endl;
cout<<"Q"<<itr.first<<": "<<"("<<minx<<","<<miny<<")"<<" "<<"("<<maxx<<","<<maxy<<") ";
int a = (maxx-minx)*(maxy-miny) ;
cout<<a<<endl;
}
} | # 2071555, 2024-11-02 14:48:27, -----P---- (10%)
#include<bits/stdc++.h>
using namespace std ;
int main () {
int n;
int x,y ;
map<int,vector<pair<int,int>>> q;
cin>>n;
for (int i=0;i<n;i++) {
cin>>x>>y ;
if(x!=0) {
if (y!=0) {
if (x>0&&y>0) {
q[1].push_back((make_pair(x,y))) ;
}
if (x<0&&y>0) {
q[2].push_back((make_pair(x,y))) ;
}
if (x<0&&y<0) {
q[3].push_back((make_pair(x,y))) ;
}
if (x>0&&y<0) {
q[4].push_back((make_pair(x,y))) ;
}
}
}
}
for (auto& itr:q) {
int minx=100000000,maxx=-10000000000,miny=100000000,maxy=-1000000000 ;
//cout<<"q"<<itr.first<<":" ;
for (auto &it:itr.second) {
//cout<<"("<<it.first<<","<<it.second<<")" ;
if (it.first>maxx) {
maxx=it.first ;
}
if (it.first<minx) {
minx=it.first ;
}
if (it.second<miny) {
miny=it.second ;
}
if (it.second>maxy) {
maxy=it.second ;
}
}
//cout<<endl;
cout<<"Q"<<itr.first<<": "<<"("<<minx<<","<<miny<<")"<<" "<<"("<<maxx<<","<<maxy<<") ";
int a = (maxx-minx)*(maxy-miny) ;
cout<<a<<endl;
}
if (q.empty()) cout<<"No point in any quadrant"<<endl;
} | # 2071568, 2024-11-02 14:49:36, -----P---- (10%)
#include<bits/stdc++.h>
using namespace std ;
int main () {
int n;
int x,y ;
map<int,vector<pair<int,int>>> q;
cin>>n;
for (int i=0;i<n;i++) {
cin>>x>>y ;
if(x!=0) {
if (y!=0) {
if (x>0&&y>0) {
q[1].push_back((make_pair(x,y))) ;
}
if (x<0&&y>0) {
q[2].push_back((make_pair(x,y))) ;
}
if (x<0&&y<0) {
q[3].push_back((make_pair(x,y))) ;
}
if (x>0&&y<0) {
q[4].push_back((make_pair(x,y))) ;
}
}
}
}
for (auto& itr:q) {
int minx=100000000,maxx=-10000000000,miny=100000000,maxy=-1000000000 ;
//cout<<"q"<<itr.first<<":" ;
for (auto &it:itr.second) {
//cout<<"("<<it.first<<","<<it.second<<")" ;
if (it.first>maxx) {
maxx=it.first ;
}
if (it.first<minx) {
minx=it.first ;
}
if (it.second<miny) {
miny=it.second ;
}
if (it.second>maxy) {
maxy=it.second ;
}
}
//cout<<endl;
cout<<"Q"<<itr.first<<": "<<"("<<minx<<", "<<miny<<")"<<" "<<"("<<maxx<<","<<maxy<<") ";
int a = (maxx-minx)*(maxy-miny) ;
cout<<a<<endl;
}
if (q.empty()) cout<<"No point in any quadrant"<<endl;
} | # 2071575, 2024-11-02 14:50:22, PPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std ;
int main () {
int n;
int x,y ;
map<int,vector<pair<int,int>>> q;
cin>>n;
for (int i=0;i<n;i++) {
cin>>x>>y ;
if(x!=0) {
if (y!=0) {
if (x>0&&y>0) {
q[1].push_back((make_pair(x,y))) ;
}
if (x<0&&y>0) {
q[2].push_back((make_pair(x,y))) ;
}
if (x<0&&y<0) {
q[3].push_back((make_pair(x,y))) ;
}
if (x>0&&y<0) {
q[4].push_back((make_pair(x,y))) ;
}
}
}
}
for (auto& itr:q) {
int minx=100000000,maxx=-10000000000,miny=100000000,maxy=-1000000000 ;
//cout<<"q"<<itr.first<<":" ;
for (auto &it:itr.second) {
//cout<<"("<<it.first<<","<<it.second<<")" ;
if (it.first>maxx) {
maxx=it.first ;
}
if (it.first<minx) {
minx=it.first ;
}
if (it.second<miny) {
miny=it.second ;
}
if (it.second>maxy) {
maxy=it.second ;
}
}
//cout<<endl;
cout<<"Q"<<itr.first<<": "<<"("<<minx<<", "<<miny<<")"<<" "<<"("<<maxx<<", "<<maxy<<") ";
int a = (maxx-minx)*(maxy-miny) ;
cout<<a<<endl;
}
if (q.empty()) cout<<"No point in any quadrant"<<endl;
} |
# 2071571, 2024-11-02 14:50:00, ----PP---- (20%)
#include <bits/stdc++.h>
using namespace std;
void rectang (set<pair<int,int>> &q) {
int xmax, xmin, ymax, ymin;
bool start = true;
for (auto e : q) {
if (start) {
xmax = e.first;
xmin = e.first;
ymax = e.second;
ymin = e.second;
start = false;
}
else {
//xmax
if (e.first > xmax) {
xmax = e.first;
}
//xmin
if (e.first < xmin) {
xmin = e.first;
}
//ymax
if (e.second > ymax) {
ymax = e.second;
}
//ymin
if (e.second > ymin) {
ymin = e.second;
}
}
}
cout << "(" << xmin << ", " << ymin << ") (" << xmax << ", " << ymax << ") ";
int area = abs(xmax - xmin) * abs(ymax - ymin);
cout << area << endl;
}
int main() {
int n; cin >> n;
cin.ignore();
set<pair<int,int>> xy;
//store point
for (int i = 0; i < n; i++) {
int x, y; cin >> x >> y;
if (x != 0 && y != 0) {
xy.insert(make_pair(x,y));
}
}
//separating quardant
set<pair<int,int>> q1;
set<pair<int,int>> q2;
set<pair<int,int>> q3;
set<pair<int,int>> q4;
for (auto e : xy) {
if (e.first > 0 && e.second > 0) {
q1.insert(e);
}
else if (e.first < 0 && e.second > 0) {
q2.insert(e);
}
else if (e.first < 0 && e.second < 0) {
q3.insert(e);
}
else if (e.first > 0 && e.second < 0) {
q4.insert(e);
}
}
//display
if (q1.empty() && q2.empty() && q3.empty() && q4.empty()) {
cout << "No point in any quadrant";
}
else {
if (!q1.empty()) {
cout << "Q1: ";
rectang(q1);
}
if (!q2.empty()) {
cout << "Q2: ";
rectang(q2);
}
if (!q3.empty()) {
cout << "Q3: ";
rectang(q3);
}
if (!q4.empty()) {
cout << "Q4: ";
rectang(q4);
}
}
} | # 2071644, 2024-11-02 14:58:44, ----PP---- (20%)
#include <bits/stdc++.h>
using namespace std;
void rectang (set<pair<int,int>> &q) {
int xmax, xmin, ymax, ymin;
bool start = true;
for (auto e : q) {
if (start) {
xmax = e.first;
xmin = e.first;
ymax = e.second;
ymin = e.second;
start = false;
}
else {
//xmax
if (e.first > xmax) {
xmax = e.first;
}
//xmin
else if (e.first < xmin) {
xmin = e.first;
}
//ymax
if (e.second > ymax) {
ymax = e.second;
}
//ymin
else if (e.second > ymin) {
ymin = e.second;
}
}
}
cout << "(" << xmin << ", " << ymin << ") (" << xmax << ", " << ymax << ") ";
int area = abs(xmax - xmin) * abs(ymax - ymin);
cout << area << endl;
}
int main() {
int n; cin >> n;
cin.ignore();
set<pair<int,int>> xy;
//store point
for (int i = 0; i < n; i++) {
int x, y; cin >> x >> y;
if (x != 0 && y != 0) {
xy.insert(make_pair(x,y));
}
}
//separating quardant
set<pair<int,int>> q1;
set<pair<int,int>> q2;
set<pair<int,int>> q3;
set<pair<int,int>> q4;
for (auto e : xy) {
if (e.first > 0 && e.second > 0) {
q1.insert(e);
}
else if (e.first < 0 && e.second > 0) {
q2.insert(e);
}
else if (e.first < 0 && e.second < 0) {
q3.insert(e);
}
else if (e.first > 0 && e.second < 0) {
q4.insert(e);
}
}
//display
if (q1.empty() && q2.empty() && q3.empty() && q4.empty()) {
cout << "No point in any quadrant";
}
else {
if (!q1.empty()) {
cout << "Q1: ";
rectang(q1);
}
if (!q2.empty()) {
cout << "Q2: ";
rectang(q2);
}
if (!q3.empty()) {
cout << "Q3: ";
rectang(q3);
}
if (!q4.empty()) {
cout << "Q4: ";
rectang(q4);
}
}
} | # 2071704, 2024-11-02 15:06:18, -----P---- (10%)
#include <bits/stdc++.h>
using namespace std;
void rectang (set<pair<int,int>> &q) {
int xmax, xmin, ymax, ymin;
bool start = true;
for (auto e : q) {
if (start) {
xmax = 0;
xmin = e.first;
ymax = 0;
ymin = e.second;
start = false;
}
else {
//xmax
if (e.first > xmax || xmax == 0) {
xmax = e.first;
}
//ymax
if (e.second > ymax || ymax == 0) {
ymax = e.second;
}
}
}
cout << "(" << xmin << ", " << ymin << ") (" << xmax << ", " << ymax << ") ";
int area = abs(xmax - xmin) * abs(ymax - ymin);
cout << area << endl;
}
int main() {
int n; cin >> n;
cin.ignore();
set<pair<int,int>> xy;
//store point
for (int i = 0; i < n; i++) {
int x, y; cin >> x >> y;
if (x != 0 && y != 0) {
xy.insert(make_pair(x,y));
}
}
//separating quardant
set<pair<int,int>> q1;
set<pair<int,int>> q2;
set<pair<int,int>> q3;
set<pair<int,int>> q4;
for (auto e : xy) {
if (e.first > 0 && e.second > 0) {
q1.insert(e);
}
else if (e.first < 0 && e.second > 0) {
q2.insert(e);
}
else if (e.first < 0 && e.second < 0) {
q3.insert(e);
}
else if (e.first > 0 && e.second < 0) {
q4.insert(e);
}
}
//display
if (q1.empty() && q2.empty() && q3.empty() && q4.empty()) {
cout << "No point in any quadrant";
}
else {
if (!q1.empty()) {
cout << "Q1: ";
rectang(q1);
}
if (!q2.empty()) {
cout << "Q2: ";
rectang(q2);
}
if (!q3.empty()) {
cout << "Q3: ";
rectang(q3);
}
if (!q4.empty()) {
cout << "Q4: ";
rectang(q4);
}
}
} | # 2071733, 2024-11-02 15:09:37, PPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std;
void rectang (set<pair<int,int>> &q) {
int xmax, xmin, ymax, ymin;
bool start = true;
for (auto e : q) {
if (start) {
xmax = e.first;
xmin = e.first;
ymax = e.second;
ymin = e.second;
start = false;
}
else {
//xmax
if (e.first > xmax || xmax == 0) {
xmax = e.first;
}
//ymax
if (e.second > ymax || ymax == 0) {
ymax = e.second;
}
if (e.second < ymin || ymin == 0) {
ymin = e.second;
}
}
}
cout << "(" << xmin << ", " << ymin << ") (" << xmax << ", " << ymax << ") ";
int area = abs(xmax - xmin) * abs(ymax - ymin);
cout << area << endl;
}
int main() {
int n; cin >> n;
cin.ignore();
set<pair<int,int>> xy;
//store point
for (int i = 0; i < n; i++) {
int x, y; cin >> x >> y;
if (x != 0 && y != 0) {
xy.insert(make_pair(x,y));
}
}
//separating quardant
set<pair<int,int>> q1;
set<pair<int,int>> q2;
set<pair<int,int>> q3;
set<pair<int,int>> q4;
for (auto e : xy) {
if (e.first > 0 && e.second > 0) {
q1.insert(e);
}
else if (e.first < 0 && e.second > 0) {
q2.insert(e);
}
else if (e.first < 0 && e.second < 0) {
q3.insert(e);
}
else if (e.first > 0 && e.second < 0) {
q4.insert(e);
}
}
//display
if (q1.empty() && q2.empty() && q3.empty() && q4.empty()) {
cout << "No point in any quadrant";
}
else {
if (!q1.empty()) {
cout << "Q1: ";
rectang(q1);
}
if (!q2.empty()) {
cout << "Q2: ";
rectang(q2);
}
if (!q3.empty()) {
cout << "Q3: ";
rectang(q3);
}
if (!q4.empty()) {
cout << "Q4: ";
rectang(q4);
}
}
} |
# 2070789, 2024-11-02 13:16:44, -----P---- (10%)
#include<bits/stdc++.h>
using namespace std;
int main()
{
set<pair<int,int>> Q1,Q2,Q3,Q4;
int n;
cin >> n;
for(int i=0;i<n;i++)
{
int x,y;
cin >> x >> y;
if(x>0 && y > 0) Q1.insert(make_pair(x,y));
if(x<0 && y > 0) Q2.insert(make_pair(x,y));
if(x<0 && y < 0) Q3.insert(make_pair(x,y));
if(x>0 && y < 0) Q4.insert(make_pair(x,y));
}
if(Q1.size() < 1 && Q2.size() < 1 && Q3.size() < 1 && Q4.size() < 1) {cout << "No point in any quadrant"; return 0;}
if(Q1.size() > 1)
{
int mnX =INT_MAX, mnY = INT_MAX;
int mxX =INT_MIN, mxY = INT_MIN;
cout << "Q1 : ";
for(auto x : Q1)
{
mnX = min(mnX,x.first);
mnY = min(mnY,x.second);
mxX = max(mxX,x.first);
mxY = max(mxY,x.second);
}
cout << '(' << mnX <<',' <<mnY <<") ";
cout << '(' << mxX <<',' <<mxY <<") ";
int area = (mxX-mnX) * (mxY-mnY);
cout << area<<"\n";
}
if(Q2.size() > 1)
{
int mnX =INT_MAX, mnY = INT_MAX;
int mxX =INT_MIN, mxY = INT_MIN;
cout << "Q2 : ";
for(auto x : Q2)
{
mnX = min(mnX,x.first);
mnY = min(mnY,x.second);
mxX = max(mxX,x.first);
mxY = max(mxY,x.second);
}
cout << '(' << mnX <<',' <<mnY <<") ";
cout << '(' << mxX <<',' <<mxY <<") ";
int area = (mxX-mnX) * (mxY-mnY);
cout << area;
cout << "\n";
}
if(Q3.size() > 1)
{
int mnX =INT_MAX, mnY = INT_MAX;
int mxX =INT_MIN, mxY = INT_MIN;
cout << "Q3 : ";
for(auto x : Q3)
{
mnX = min(mnX,x.first);
mnY = min(mnY,x.second);
mxX = max(mxX,x.first);
mxY = max(mxY,x.second);
}
cout << '(' << mnX <<',' <<mnY <<") ";
cout << '(' << mxX <<',' <<mxY <<") ";
int area = (mxX-mnX) * (mxY-mnY);
cout << area;
cout << "\n";
}
if(Q4.size() > 1)
{
int mnX =INT_MAX, mnY = INT_MAX;
int mxX =INT_MIN, mxY = INT_MIN;
cout << "Q4 : ";
for(auto x : Q4)
{
mnX = min(mnX,x.first);
mnY = min(mnY,x.second);
mxX = max(mxX,x.first);
mxY = max(mxY,x.second);
}
cout << '(' << mnX <<',' <<mnY <<") ";
cout << '(' << mxX <<',' <<mxY <<") ";
int area = (mxX-mnX) * (mxY-mnY);
cout << area;
cout << "\n";
}
} | # 2070795, 2024-11-02 13:17:43, -----P---- (10%)
#include<bits/stdc++.h>
using namespace std;
int main()
{
set<pair<int,int>> Q1,Q2,Q3,Q4;
int n;
cin >> n;
for(int i=0;i<n;i++)
{
int x,y;
cin >> x >> y;
if(x>0 && y > 0) Q1.insert(make_pair(x,y));
if(x<0 && y > 0) Q2.insert(make_pair(x,y));
if(x<0 && y < 0) Q3.insert(make_pair(x,y));
if(x>0 && y < 0) Q4.insert(make_pair(x,y));
}
if(Q1.size() < 1 && Q2.size() < 1 && Q3.size() < 1 && Q4.size() < 1) {cout << "No point in any quadrant"; return 0;}
if(Q1.size() > 1)
{
int mnX =INT_MAX, mnY = INT_MAX;
int mxX =INT_MIN, mxY = INT_MIN;
cout << "Q1: ";
for(auto x : Q1)
{
mnX = min(mnX,x.first);
mnY = min(mnY,x.second);
mxX = max(mxX,x.first);
mxY = max(mxY,x.second);
}
cout << '(' << mnX <<',' <<mnY <<") ";
cout << '(' << mxX <<',' <<mxY <<") ";
int area = (mxX-mnX) * (mxY-mnY);
cout << area<<"\n";
}
if(Q2.size() > 1)
{
int mnX =INT_MAX, mnY = INT_MAX;
int mxX =INT_MIN, mxY = INT_MIN;
cout << "Q2: ";
for(auto x : Q2)
{
mnX = min(mnX,x.first);
mnY = min(mnY,x.second);
mxX = max(mxX,x.first);
mxY = max(mxY,x.second);
}
cout << '(' << mnX <<',' <<mnY <<") ";
cout << '(' << mxX <<',' <<mxY <<") ";
int area = (mxX-mnX) * (mxY-mnY);
cout << area;
cout << "\n";
}
if(Q3.size() > 1)
{
int mnX =INT_MAX, mnY = INT_MAX;
int mxX =INT_MIN, mxY = INT_MIN;
cout << "Q3: ";
for(auto x : Q3)
{
mnX = min(mnX,x.first);
mnY = min(mnY,x.second);
mxX = max(mxX,x.first);
mxY = max(mxY,x.second);
}
cout << '(' << mnX <<',' <<mnY <<") ";
cout << '(' << mxX <<',' <<mxY <<") ";
int area = (mxX-mnX) * (mxY-mnY);
cout << area;
cout << "\n";
}
if(Q4.size() > 1)
{
int mnX =INT_MAX, mnY = INT_MAX;
int mxX =INT_MIN, mxY = INT_MIN;
cout << "Q4: ";
for(auto x : Q4)
{
mnX = min(mnX,x.first);
mnY = min(mnY,x.second);
mxX = max(mxX,x.first);
mxY = max(mxY,x.second);
}
cout << '(' << mnX <<',' <<mnY <<") ";
cout << '(' << mxX <<',' <<mxY <<") ";
int area = (mxX-mnX) * (mxY-mnY);
cout << area;
cout << "\n";
}
} | # 2070807, 2024-11-02 13:19:10, PPPP-PP-PP (80%)
#include<bits/stdc++.h>
using namespace std;
int main()
{
set<pair<int,int>> Q1,Q2,Q3,Q4;
int n;
cin >> n;
for(int i=0;i<n;i++)
{
int x,y;
cin >> x >> y;
if(x>0 && y > 0) Q1.insert(make_pair(x,y));
if(x<0 && y > 0) Q2.insert(make_pair(x,y));
if(x<0 && y < 0) Q3.insert(make_pair(x,y));
if(x>0 && y < 0) Q4.insert(make_pair(x,y));
}
if(Q1.size() < 1 && Q2.size() < 1 && Q3.size() < 1 && Q4.size() < 1) {cout << "No point in any quadrant"; return 0;}
if(Q1.size() > 1)
{
int mnX =INT_MAX, mnY = INT_MAX;
int mxX =INT_MIN, mxY = INT_MIN;
cout << "Q1: ";
for(auto x : Q1)
{
mnX = min(mnX,x.first);
mnY = min(mnY,x.second);
mxX = max(mxX,x.first);
mxY = max(mxY,x.second);
}
cout << '(' << mnX <<", " <<mnY <<") ";
cout << '(' << mxX <<", " <<mxY <<") ";
int area = (mxX-mnX) * (mxY-mnY);
cout << area<<"\n";
}
if(Q2.size() > 1)
{
int mnX =INT_MAX, mnY = INT_MAX;
int mxX =INT_MIN, mxY = INT_MIN;
cout << "Q2: ";
for(auto x : Q2)
{
mnX = min(mnX,x.first);
mnY = min(mnY,x.second);
mxX = max(mxX,x.first);
mxY = max(mxY,x.second);
}
cout << '(' << mnX <<", " <<mnY <<") ";
cout << '(' << mxX <<", " <<mxY <<") ";
int area = (mxX-mnX) * (mxY-mnY);
cout << area;
cout << "\n";
}
if(Q3.size() > 1)
{
int mnX =INT_MAX, mnY = INT_MAX;
int mxX =INT_MIN, mxY = INT_MIN;
cout << "Q3: ";
for(auto x : Q3)
{
mnX = min(mnX,x.first);
mnY = min(mnY,x.second);
mxX = max(mxX,x.first);
mxY = max(mxY,x.second);
}
cout << '(' << mnX <<", " <<mnY <<") ";
cout << '(' << mxX <<", " <<mxY <<") ";
int area = (mxX-mnX) * (mxY-mnY);
cout << area;
cout << "\n";
}
if(Q4.size() > 1)
{
int mnX =INT_MAX, mnY = INT_MAX;
int mxX =INT_MIN, mxY = INT_MIN;
cout << "Q4: ";
for(auto x : Q4)
{
mnX = min(mnX,x.first);
mnY = min(mnY,x.second);
mxX = max(mxX,x.first);
mxY = max(mxY,x.second);
}
cout << '(' << mnX <<", " <<mnY <<") ";
cout << '(' << mxX <<", " <<mxY <<") ";
int area = (mxX-mnX) * (mxY-mnY);
cout << area;
cout << "\n";
}
} | # 2070821, 2024-11-02 13:21:22, PPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
int main()
{
set<pair<int,int>> Q1,Q2,Q3,Q4;
int n;
cin >> n;
for(int i=0;i<n;i++)
{
int x,y;
cin >> x >> y;
if(x>0 && y > 0) Q1.insert(make_pair(x,y));
if(x<0 && y > 0) Q2.insert(make_pair(x,y));
if(x<0 && y < 0) Q3.insert(make_pair(x,y));
if(x>0 && y < 0) Q4.insert(make_pair(x,y));
}
if(Q1.size() == 0 && Q2.size() == 0 && Q3.size() == 0 && Q4.size()== 0) {cout << "No point in any quadrant"; return 0;}
if(Q1.size() != 0)
{
int mnX =INT_MAX, mnY = INT_MAX;
int mxX =INT_MIN, mxY = INT_MIN;
cout << "Q1: ";
for(auto x : Q1)
{
mnX = min(mnX,x.first);
mnY = min(mnY,x.second);
mxX = max(mxX,x.first);
mxY = max(mxY,x.second);
}
cout << '(' << mnX <<", " <<mnY <<") ";
cout << '(' << mxX <<", " <<mxY <<") ";
int area = (mxX-mnX) * (mxY-mnY);
cout << area<<"\n";
}
if(Q2.size() != 0)
{
int mnX =INT_MAX, mnY = INT_MAX;
int mxX =INT_MIN, mxY = INT_MIN;
cout << "Q2: ";
for(auto x : Q2)
{
mnX = min(mnX,x.first);
mnY = min(mnY,x.second);
mxX = max(mxX,x.first);
mxY = max(mxY,x.second);
}
cout << '(' << mnX <<", " <<mnY <<") ";
cout << '(' << mxX <<", " <<mxY <<") ";
int area = (mxX-mnX) * (mxY-mnY);
cout << area;
cout << "\n";
}
if(Q3.size() != 0)
{
int mnX =INT_MAX, mnY = INT_MAX;
int mxX =INT_MIN, mxY = INT_MIN;
cout << "Q3: ";
for(auto x : Q3)
{
mnX = min(mnX,x.first);
mnY = min(mnY,x.second);
mxX = max(mxX,x.first);
mxY = max(mxY,x.second);
}
cout << '(' << mnX <<", " <<mnY <<") ";
cout << '(' << mxX <<", " <<mxY <<") ";
int area = (mxX-mnX) * (mxY-mnY);
cout << area;
cout << "\n";
}
if(Q4.size() != 0)
{
int mnX =INT_MAX, mnY = INT_MAX;
int mxX =INT_MIN, mxY = INT_MIN;
cout << "Q4: ";
for(auto x : Q4)
{
mnX = min(mnX,x.first);
mnY = min(mnY,x.second);
mxX = max(mxX,x.first);
mxY = max(mxY,x.second);
}
cout << '(' << mnX <<", " <<mnY <<") ";
cout << '(' << mxX <<", " <<mxY <<") ";
int area = (mxX-mnX) * (mxY-mnY);
cout << area;
cout << "\n";
}
} |
# 2069470, 2024-11-02 10:50:12, ---------- (0%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n = 0, x = 0, y =0;
cin >> n;
vector<int> q1x,q1y, q2x,q2y, q3x,q3y, q4x,q4y;
while(cin >> x >> y && x != 1){
if(x > 0 && y > 0){
q1x.push_back(x);
q1y.push_back(y);
}
else if(x < 0 && y > 0){
q2x.push_back(x);
q2y.push_back(y);
}
else if(x < 0 && y < 0){
q3x.push_back(x);
q3y.push_back(y);
}
else if(x > 0 && y < 0){
q4x.push_back(x);
q4y.push_back(y);
}
}
// sort(q1x.begin(). q1y.begin());
// Q1: (2, 2) (5, 6) 12
if(!q1x.empty() && !q1y.empty()){
sort(q1x.begin(), q1x.end());
sort(q1y.begin(), q1y.end());
cout << "Q1: (" << q1x[0] << ", " << q1y[0] << ") (" << q1x[q1x.size()-1] << ", " << q1y[q1y.size()- 1] << ") " <<
(q1x[q1x.size()-1] - q1x[0]) * (q1y[q1y.size()-1] - q1y[0]) << '\n';
}
if(!q2x.empty() && !q2y.empty()){
sort(q2x.begin(), q2x.end());
sort(q2y.begin(), q2y.end());
cout << "Q2: (" << q2x[0] << ", " << q2y[0] << ") (" << q2x[q2x.size()-1] << ", " << q2y[q2y.size()- 1] << ") " <<
(q2x[q2x.size()-1] + q2x[0]) * (q2y[q2y.size()-1] - q2y[0]) << '\n';
}
if(!q3x.empty() && !q3x.empty()){
sort(q3x.begin(), q3x.end());
sort(q3y.begin(), q3y.end());
cout << "Q3: (" << q3x[0] << ", " << q3y[0] << ") (" << q3x[q3x.size()-1] << ", " << q3y[q3y.size()- 1] << ") " <<
(q3x[q3x.size()-1] + q3x[0]) * (q3y[q3y.size()-1] + q3y[0]) << '\n';
}
if(!q4x.empty() && !q4x.empty()){
sort(q4x.begin(), q4x.end());
sort(q4y.begin(), q4y.end());
cout << "Q4: (" << q4x[0] << ", " << q4y[0] << ") (" << q4x[q4x.size()-1] << ", " << q4y[q4y.size()- 1] << ") " <<
(q4x[q4x.size()-1] - q4x[0]) * (q4y[q4y.size()-1] + q4y[0]) << '\n';
}
} | # 2069492, 2024-11-02 10:52:04, -P-PP--PP- (50%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n = 0, x = 0, y =0;
cin >> n;
vector<int> q1x,q1y, q2x,q2y, q3x,q3y, q4x,q4y;
while(cin >> x >> y && x != 1){
if(x > 0 && y > 0){
q1x.push_back(x);
q1y.push_back(y);
}
else if(x < 0 && y > 0){
q2x.push_back(x);
q2y.push_back(y);
}
else if(x < 0 && y < 0){
q3x.push_back(x);
q3y.push_back(y);
}
else if(x > 0 && y < 0){
q4x.push_back(x);
q4y.push_back(y);
}
}
// sort(q1x.begin(). q1y.begin());
// Q1: (2, 2) (5, 6) 12
if(!q1x.empty() && !q1y.empty()){
sort(q1x.begin(), q1x.end());
sort(q1y.begin(), q1y.end());
cout << "Q1: (" << q1x[0] << ", " << q1y[0] << ") (" << q1x[q1x.size()-1] << ", " << q1y[q1y.size()- 1] << ") " <<
(q1x[q1x.size()-1] - q1x[0]) * (q1y[q1y.size()-1] - q1y[0]) << '\n';
}
if(!q2x.empty() && !q2y.empty()){
sort(q2x.begin(), q2x.end());
sort(q2y.begin(), q2y.end());
cout << "Q2: (" << q2x[0] << ", " << q2y[0] << ") (" << q2x[q2x.size()-1] << ", " << q2y[q2y.size()- 1] << ") " <<
(q2x[q2x.size()-1] - q2x[0]) * (q2y[q2y.size()-1] - q2y[0]) << '\n';
}
if(!q3x.empty() && !q3x.empty()){
sort(q3x.begin(), q3x.end());
sort(q3y.begin(), q3y.end());
cout << "Q3: (" << q3x[0] << ", " << q3y[0] << ") (" << q3x[q3x.size()-1] << ", " << q3y[q3y.size()- 1] << ") " <<
(q3x[q3x.size()-1] - q3x[0]) * (q3y[q3y.size()-1] - q3y[0]) << '\n';
}
if(!q4x.empty() && !q4x.empty()){
sort(q4x.begin(), q4x.end());
sort(q4y.begin(), q4y.end());
cout << "Q4: (" << q4x[0] << ", " << q4y[0] << ") (" << q4x[q4x.size()-1] << ", " << q4y[q4y.size()- 1] << ") " <<
(q4x[q4x.size()-1] - q4x[0]) * (q4y[q4y.size()-1] - q4y[0]) << '\n';
}
} | # 2069512, 2024-11-02 10:54:14, -P-PPP-PP- (60%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n = 0, x = 0, y =0;
cin >> n;
vector<int> q1x,q1y, q2x,q2y, q3x,q3y, q4x,q4y;
while(cin >> x >> y && x != 1){
if(x > 0 && y > 0){
q1x.push_back(x);
q1y.push_back(y);
}
else if(x < 0 && y > 0){
q2x.push_back(x);
q2y.push_back(y);
}
else if(x < 0 && y < 0){
q3x.push_back(x);
q3y.push_back(y);
}
else if(x > 0 && y < 0){
q4x.push_back(x);
q4y.push_back(y);
}
}
// sort(q1x.begin(). q1y.begin());
// Q1: (2, 2) (5, 6) 12
if(!q1x.empty() && !q1y.empty()){
sort(q1x.begin(), q1x.end());
sort(q1y.begin(), q1y.end());
cout << "Q1: (" << q1x[0] << ", " << q1y[0] << ") (" << q1x[q1x.size()-1] << ", " << q1y[q1y.size()- 1] << ") " <<
(q1x[q1x.size()-1] - q1x[0]) * (q1y[q1y.size()-1] - q1y[0]) << '\n';
}
if(!q2x.empty() && !q2y.empty()){
sort(q2x.begin(), q2x.end());
sort(q2y.begin(), q2y.end());
cout << "Q2: (" << q2x[0] << ", " << q2y[0] << ") (" << q2x[q2x.size()-1] << ", " << q2y[q2y.size()- 1] << ") " <<
(q2x[q2x.size()-1] - q2x[0]) * (q2y[q2y.size()-1] - q2y[0]) << '\n';
}
if(!q3x.empty() && !q3x.empty()){
sort(q3x.begin(), q3x.end());
sort(q3y.begin(), q3y.end());
cout << "Q3: (" << q3x[0] << ", " << q3y[0] << ") (" << q3x[q3x.size()-1] << ", " << q3y[q3y.size()- 1] << ") " <<
(q3x[q3x.size()-1] - q3x[0]) * (q3y[q3y.size()-1] - q3y[0]) << '\n';
}
if(!q4x.empty() && !q4x.empty()){
sort(q4x.begin(), q4x.end());
sort(q4y.begin(), q4y.end());
cout << "Q4: (" << q4x[0] << ", " << q4y[0] << ") (" << q4x[q4x.size()-1] << ", " << q4y[q4y.size()- 1] << ") " <<
(q4x[q4x.size()-1] - q4x[0]) * (q4y[q4y.size()-1] - q4y[0]) << '\n';
}
if(q1x.empty() && q1y.empty() && q2x.empty() && q2y.empty() && q3x.empty() && q3y.empty() && q4x.empty() && q4y.empty()){
cout << "No point in any quadrant";
}
} | # 2069543, 2024-11-02 10:56:48, PPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n = 0, x = 0, y =0;
cin >> n;
vector<int> q1x,q1y, q2x,q2y, q3x,q3y, q4x,q4y;
while(cin >> x >> y){
if(x > 0 && y > 0){
q1x.push_back(x);
q1y.push_back(y);
}
else if(x < 0 && y > 0){
q2x.push_back(x);
q2y.push_back(y);
}
else if(x < 0 && y < 0){
q3x.push_back(x);
q3y.push_back(y);
}
else if(x > 0 && y < 0){
q4x.push_back(x);
q4y.push_back(y);
}
}
// sort(q1x.begin(). q1y.begin());
// Q1: (2, 2) (5, 6) 12
if(!q1x.empty() && !q1y.empty()){
sort(q1x.begin(), q1x.end());
sort(q1y.begin(), q1y.end());
cout << "Q1: (" << q1x[0] << ", " << q1y[0] << ") (" << q1x[q1x.size()-1] << ", " << q1y[q1y.size()- 1] << ") " <<
(q1x[q1x.size()-1] - q1x[0]) * (q1y[q1y.size()-1] - q1y[0]) << '\n';
}
if(!q2x.empty() && !q2y.empty()){
sort(q2x.begin(), q2x.end());
sort(q2y.begin(), q2y.end());
cout << "Q2: (" << q2x[0] << ", " << q2y[0] << ") (" << q2x[q2x.size()-1] << ", " << q2y[q2y.size()- 1] << ") " <<
(q2x[q2x.size()-1] - q2x[0]) * (q2y[q2y.size()-1] - q2y[0]) << '\n';
}
if(!q3x.empty() && !q3x.empty()){
sort(q3x.begin(), q3x.end());
sort(q3y.begin(), q3y.end());
cout << "Q3: (" << q3x[0] << ", " << q3y[0] << ") (" << q3x[q3x.size()-1] << ", " << q3y[q3y.size()- 1] << ") " <<
(q3x[q3x.size()-1] - q3x[0]) * (q3y[q3y.size()-1] - q3y[0]) << '\n';
}
if(!q4x.empty() && !q4x.empty()){
sort(q4x.begin(), q4x.end());
sort(q4y.begin(), q4y.end());
cout << "Q4: (" << q4x[0] << ", " << q4y[0] << ") (" << q4x[q4x.size()-1] << ", " << q4y[q4y.size()- 1] << ") " <<
(q4x[q4x.size()-1] - q4x[0]) * (q4y[q4y.size()-1] - q4y[0]) << '\n';
}
if(q1x.empty() && q1y.empty() && q2x.empty() && q2y.empty() && q3x.empty() && q3y.empty() && q4x.empty() && q4y.empty()){
cout << "No point in any quadrant";
}
} |
# 2068999, 2024-11-02 10:01:58, -----P---- (10%)
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin>>n;
vector<pair<int,int>> q1;
vector<pair<int,int>> q2;
vector<pair<int,int>> q3;
vector<pair<int,int>> q4;
bool found = false;
bool one = false;
bool two = false;
bool three = false;
bool four = false;
for (int i = 0; i < n; i++) {
int x,y;
cin>>x>>y;
if (x == 0 || y == 0) {
continue;
}
//q1
else if (x > 0 && y>0) {
q1.push_back(make_pair(x,y));
found = true;
one = true;
}
//q2
else if (x < 0 && y > 0) {
q2.push_back(make_pair(x,y));
found = true;
two = true;
}
//q3
else if (x < 0 && y < 0) {
q3.push_back(make_pair(x,y));
found = true;
three = true;
}
//q4
else if (x > 0 && y < 0) {
q4.push_back(make_pair(x,y));
found = true;
four = true;
}
}
if (!found) {
cout << "No point in any quadrant" << endl;
return 0;
}
int leasty, mostx, mosty, leastx;
if (one) {
leastx = 10000000, mostx = 0, mosty = 0, leasty= 10000000;
for (auto a : q1) {
if (a.first > mostx) {
mostx = a.first;
}
if (a.first < leastx) {
leastx = a.first;
}
if (a.second > mosty) {
mosty = a.second;
}
if (a.second < leasty) {
leasty = a.second;
}
}
int area = (mostx-leastx) * (mosty-leasty);
cout<< "Q1: (" << leastx <<"," <<leasty<<") ("<<mostx<<","<<leasty<<") "<< area << endl;
}
if (two) {
leastx = 10000000, mostx = 0, mosty = 0, leasty= 10000000;
for (auto a : q1) {
if (a.first > mostx) {
mostx = a.first;
}
if (a.first < leastx) {
leastx = a.first;
}
if (a.second > mosty) {
mosty = a.second;
}
if (a.second < leasty) {
leasty = a.second;
}
}
int area = (mostx-leastx) * (mosty-leasty);
cout<< "Q2: (" << leastx <<"," <<leasty<<") ("<<mostx<<","<<leasty<<") "<< area << endl;
}
if (three) {
leastx = 10000000, mostx = 0, mosty = 0, leasty= 10000000;
for (auto a : q1) {
if (a.first > mostx) {
mostx = a.first;
}
if (a.first < leastx) {
leastx = a.first;
}
if (a.second > mosty) {
mosty = a.second;
}
if (a.second < leasty) {
leasty = a.second;
}
}
int area = (mostx-leastx) * (mosty-leasty);
cout<< "Q3: (" << leastx <<"," <<leasty<<") ("<<mostx<<","<<leasty<<") "<< area << endl;
}
if (four) {
leastx = 10000000, mostx = 0, mosty = 0, leasty= 10000000;
for (auto a : q1) {
if (a.first > mostx) {
mostx = a.first;
}
if (a.first < leastx) {
leastx = a.first;
}
if (a.second > mosty) {
mosty = a.second;
}
if (a.second < leasty) {
leasty = a.second;
}
}
int area = (mostx-leastx) * (mosty-leasty);
cout<< "Q4: (" << leastx <<"," <<leasty<<") ("<<mostx<<","<<leasty<<") "<< area << endl;
}
} | # 2069012, 2024-11-02 10:03:02, -----P---- (10%)
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin>>n;
vector<pair<int,int>> q1;
vector<pair<int,int>> q2;
vector<pair<int,int>> q3;
vector<pair<int,int>> q4;
bool found = false;
bool one = false;
bool two = false;
bool three = false;
bool four = false;
for (int i = 0; i < n; i++) {
int x,y;
cin>>x>>y;
if (x == 0 || y == 0) {
continue;
}
//q1
else if (x > 0 && y>0) {
q1.push_back(make_pair(x,y));
found = true;
one = true;
}
//q2
else if (x < 0 && y > 0) {
q2.push_back(make_pair(x,y));
found = true;
two = true;
}
//q3
else if (x < 0 && y < 0) {
q3.push_back(make_pair(x,y));
found = true;
three = true;
}
//q4
else if (x > 0 && y < 0) {
q4.push_back(make_pair(x,y));
found = true;
four = true;
}
}
if (!found) {
cout << "No point in any quadrant" << endl;
return 0;
}
int leasty, mostx, mosty, leastx;
if (one) {
leastx = 10000000, mostx = 0, mosty = 0, leasty= 10000000;
for (auto a : q1) {
if (a.first > mostx) {
mostx = a.first;
}
if (a.first < leastx) {
leastx = a.first;
}
if (a.second > mosty) {
mosty = a.second;
}
if (a.second < leasty) {
leasty = a.second;
}
}
int area = (mostx-leastx) * (mosty-leasty);
cout<< "Q1: (" << leastx <<"," <<leasty<<") ("<<mostx<<","<<leasty<<") "<< area << endl;
}
if (two) {
leastx = 10000000, mostx = 0, mosty = 0, leasty= 10000000;
for (auto a : q2) {
if (a.first > mostx) {
mostx = a.first;
}
if (a.first < leastx) {
leastx = a.first;
}
if (a.second > mosty) {
mosty = a.second;
}
if (a.second < leasty) {
leasty = a.second;
}
}
int area = (mostx-leastx) * (mosty-leasty);
cout<< "Q2: (" << leastx <<"," <<leasty<<") ("<<mostx<<","<<leasty<<") "<< area << endl;
}
if (three) {
leastx = 10000000, mostx = 0, mosty = 0, leasty= 10000000;
for (auto a : q3) {
if (a.first > mostx) {
mostx = a.first;
}
if (a.first < leastx) {
leastx = a.first;
}
if (a.second > mosty) {
mosty = a.second;
}
if (a.second < leasty) {
leasty = a.second;
}
}
int area = (mostx-leastx) * (mosty-leasty);
cout<< "Q3: (" << leastx <<"," <<leasty<<") ("<<mostx<<","<<leasty<<") "<< area << endl;
}
if (four) {
leastx = 10000000, mostx = 0, mosty = 0, leasty= 10000000;
for (auto a : q4) {
if (a.first > mostx) {
mostx = a.first;
}
if (a.first < leastx) {
leastx = a.first;
}
if (a.second > mosty) {
mosty = a.second;
}
if (a.second < leasty) {
leasty = a.second;
}
}
int area = (mostx-leastx) * (mosty-leasty);
cout<< "Q4: (" << leastx <<"," <<leasty<<") ("<<mostx<<","<<leasty<<") "<< area << endl;
}
} | # 2069042, 2024-11-02 10:06:20, -----P---- (10%)
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin>>n;
vector<pair<int,int>> q1;
vector<pair<int,int>> q2;
vector<pair<int,int>> q3;
vector<pair<int,int>> q4;
bool found = false;
bool one = false;
bool two = false;
bool three = false;
bool four = false;
for (int i = 0; i < n; i++) {
int x,y;
cin>>x>>y;
if (x == 0 || y == 0) {
continue;
}
//q1
else if (x > 0 && y>0) {
q1.push_back(make_pair(x,y));
found = true;
one = true;
}
//q2
else if (x < 0 && y > 0) {
q2.push_back(make_pair(x,y));
found = true;
two = true;
}
//q3
else if (x < 0 && y < 0) {
q3.push_back(make_pair(x,y));
found = true;
three = true;
}
//q4
else if (x > 0 && y < 0) {
q4.push_back(make_pair(x,y));
found = true;
four = true;
}
}
if (!found) {
cout << "No point in any quadrant" << endl;
return 0;
}
int leasty, mostx, mosty, leastx;
if (one) {
leastx = 10000000, mostx = 0, mosty = 0, leasty= 10000000;
for (auto a : q1) {
if (a.first > mostx) {
mostx = a.first;
}
if (a.first < leastx) {
leastx = a.first;
}
if (a.second > mosty) {
mosty = a.second;
}
if (a.second < leasty) {
leasty = a.second;
}
}
int area = (mostx-leastx) * (mosty-leasty);
cout<< "Q1: (" << leastx <<"," <<leasty<<") ("<<mostx<<","<<mosty<<") "<< area << endl;
}
if (two) {
leastx = 10000000, mostx = -10000000, mosty = -10000000, leasty= 10000000;
for (auto a : q2) {
if (a.first > mostx) {
mostx = a.first;
}
if (a.first < leastx) {
leastx = a.first;
}
if (a.second > mosty) {
mosty = a.second;
}
if (a.second < leasty) {
leasty = a.second;
}
}
int area = (mostx-leastx) * (mosty-leasty);
cout<< "Q2: (" << leastx <<"," <<leasty<<") ("<<mostx<<","<<mosty<<") "<< area << endl;
}
if (three) {
leastx = 10000000, mostx = -10000000, mosty = -10000000, leasty= 10000000;
for (auto a : q3) {
if (a.first > mostx) {
mostx = a.first;
}
if (a.first < leastx) {
leastx = a.first;
}
if (a.second > mosty) {
mosty = a.second;
}
if (a.second < leasty) {
leasty = a.second;
}
}
int area = (mostx-leastx) * (mosty-leasty);
cout<< "Q3: (" << leastx <<"," <<leasty<<") ("<<mostx<<","<<mosty<<") "<< area << endl;
}
if (four) {
leastx = 10000000, mostx = -10000000, mosty = -10000000, leasty= 10000000;
for (auto a : q4) {
if (a.first > mostx) {
mostx = a.first;
}
if (a.first < leastx) {
leastx = a.first;
}
if (a.second > mosty) {
mosty = a.second;
}
if (a.second < leasty) {
leasty = a.second;
}
}
int area = (mostx-leastx) * (mosty-leasty);
cout<< "Q4: (" << leastx <<"," <<leasty<<") ("<<mostx<<","<<mosty<<") "<< area << endl;
}
} | # 2069052, 2024-11-02 10:07:26, PPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin>>n;
vector<pair<int,int>> q1;
vector<pair<int,int>> q2;
vector<pair<int,int>> q3;
vector<pair<int,int>> q4;
bool found = false;
bool one = false;
bool two = false;
bool three = false;
bool four = false;
for (int i = 0; i < n; i++) {
int x,y;
cin>>x>>y;
if (x == 0 || y == 0) {
continue;
}
//q1
else if (x > 0 && y>0) {
q1.push_back(make_pair(x,y));
found = true;
one = true;
}
//q2
else if (x < 0 && y > 0) {
q2.push_back(make_pair(x,y));
found = true;
two = true;
}
//q3
else if (x < 0 && y < 0) {
q3.push_back(make_pair(x,y));
found = true;
three = true;
}
//q4
else if (x > 0 && y < 0) {
q4.push_back(make_pair(x,y));
found = true;
four = true;
}
}
if (!found) {
cout << "No point in any quadrant" << endl;
return 0;
}
int leasty, mostx, mosty, leastx;
if (one) {
leastx = 10000000, mostx = 0, mosty = 0, leasty= 10000000;
for (auto a : q1) {
if (a.first > mostx) {
mostx = a.first;
}
if (a.first < leastx) {
leastx = a.first;
}
if (a.second > mosty) {
mosty = a.second;
}
if (a.second < leasty) {
leasty = a.second;
}
}
int area = (mostx-leastx) * (mosty-leasty);
cout<< "Q1: (" << leastx <<", " <<leasty<<") ("<<mostx<<", "<<mosty<<") "<< area << endl;
}
if (two) {
leastx = 10000000, mostx = -10000000, mosty = -10000000, leasty= 10000000;
for (auto a : q2) {
if (a.first > mostx) {
mostx = a.first;
}
if (a.first < leastx) {
leastx = a.first;
}
if (a.second > mosty) {
mosty = a.second;
}
if (a.second < leasty) {
leasty = a.second;
}
}
int area = (mostx-leastx) * (mosty-leasty);
cout<< "Q2: (" << leastx <<", " <<leasty<<") ("<<mostx<<", "<<mosty<<") "<< area << endl;
}
if (three) {
leastx = 10000000, mostx = -10000000, mosty = -10000000, leasty= 10000000;
for (auto a : q3) {
if (a.first > mostx) {
mostx = a.first;
}
if (a.first < leastx) {
leastx = a.first;
}
if (a.second > mosty) {
mosty = a.second;
}
if (a.second < leasty) {
leasty = a.second;
}
}
int area = (mostx-leastx) * (mosty-leasty);
cout<< "Q3: (" << leastx <<", " <<leasty<<") ("<<mostx<<", "<<mosty<<") "<< area << endl;
}
if (four) {
leastx = 10000000, mostx = -10000000, mosty = -10000000, leasty= 10000000;
for (auto a : q4) {
if (a.first > mostx) {
mostx = a.first;
}
if (a.first < leastx) {
leastx = a.first;
}
if (a.second > mosty) {
mosty = a.second;
}
if (a.second < leasty) {
leasty = a.second;
}
}
int area = (mostx-leastx) * (mosty-leasty);
cout<< "Q4: (" << leastx <<", " <<leasty<<") ("<<mostx<<", "<<mosty<<") "<< area << endl;
}
} |
# 2069999, 2024-11-02 11:43:54, P----P---- (20%)
#include<bits/stdc++.h>
using namespace std;
int main() {
int n,x,y;
vector<pair<int,int>> Q1;
vector<pair<int,int>> Q2;
vector<pair<int,int>> Q3;
vector<pair<int,int>> Q4;
vector<pair<int,int>> ans;
bool b = true;
cin >> n;
while(n--) {
cin >> x >> y;
if(x>0 && y>0) {
Q1.push_back(make_pair(x,y));
b= false;
}else if(x<0 && y>0) {
Q2.push_back(make_pair(x,y));
b= false;
}else if(x<0 && y<0) {
Q3.push_back(make_pair(x,y));
b= false;
}else if(x>0 && y<0) {
Q4.push_back(make_pair(x,y));
b=false;
}
}
if(b) {
cout << "No point in any quadrant";
return 0;
}
int min_x = 100,max_x=0,min_y = 100,max_y=0;
for(auto i : Q1) {
if(i.first < min_x) {
min_x = i.first;
}
if(i.first > max_x) {
max_x = i.first;
}
if(i.second < min_y) {
min_y = i.second;
}
if(i.second > max_y) {
max_y = i.second;
}
}
ans.push_back(make_pair(min_x,min_y));
ans.push_back(make_pair(max_x,max_y));
int area = (max_x - min_x) * (max_y - min_y);
cout << "Q1: ";
for(auto i : ans) {
cout << "(" << i.first << ", " << i.second << ") ";
}
cout << area;
} | # 2070306, 2024-11-02 12:02:53, ----PPPP-P (50%)
#include<bits/stdc++.h>
using namespace std;
int main() {
int n,x,y;
vector<pair<int,int>> Q1;
vector<pair<int,int>> Q2;
vector<pair<int,int>> Q3;
vector<pair<int,int>> Q4;
vector<pair<int,int>> ans;
vector<map<string,vector<int>>> m;
bool b = true;
cin >> n;
while(n--) {
cin >> x >> y;
if(x>0 && y>0) {
Q1.push_back(make_pair(x,y));
b= false;
}else if(x<0 && y>0) {
Q2.push_back(make_pair(x,y));
b= false;
}else if(x<0 && y<0) {
Q3.push_back(make_pair(x,y));
b= false;
}else if(x>0 && y<0) {
Q4.push_back(make_pair(x,y));
b=false;
}
}
if(b) {
cout << "No point in any quadrant";
return 0;
}
int min_x = 100,max_x=-100,min_y = 100,max_y=-100;
for(auto i : Q1) {
if(i.first < min_x) {
min_x = i.first;
}
if(i.first > max_x) {
max_x = i.first;
}
if(i.second < min_y) {
min_y = i.second;
}
if(i.second > max_y) {
max_y = i.second;
}
}
ans.push_back(make_pair(min_x,min_y));
ans.push_back(make_pair(max_x,max_y));
int area = (max_x - min_x) * (max_y - min_y);
cout << "Q1: ";
for(auto i : ans) {
cout << "(" << i.first << ", " << i.second << ") ";
}
cout << area << endl;
ans.clear();
int min_x2 = 100,max_x2=-100,min_y2 = 100,max_y2=-100;
for(auto i : Q2) {
if(i.first < min_x2) {
min_x2 = i.first;
}
if(i.first > max_x2) {
max_x2 = i.first;
}
if(i.second < min_y2) {
min_y2 = i.second;
}
if(i.second > max_y2) {
max_y2 = i.second;
}
}
ans.push_back(make_pair(min_x2,min_y2));
ans.push_back(make_pair(max_x2,max_y2));
int area2 = (max_x2 - min_x2) * (max_y2 - min_y2);
cout << "Q2: ";
for(auto i : ans) {
cout << "(" << i.first << ", " << i.second << ") ";
}
cout << area2 << endl;
ans.clear();
int min_x3 = 100,max_x3=-100,min_y3 = 100,max_y3=-100;
for(auto i : Q3) {
if(i.first < min_x3) {
min_x3 = i.first;
}
if(i.first > max_x3) {
max_x3 = i.first;
}
if(i.second < min_y3) {
min_y3 = i.second;
}
if(i.second > max_y3) {
max_y3 = i.second;
}
}
ans.push_back(make_pair(min_x3,min_y3));
ans.push_back(make_pair(max_x3,max_y3));
int area3 = (max_x3 - min_x3) * (max_y3 - min_y3);
cout << "Q3: ";
for(auto i : ans) {
cout << "(" << i.first << ", " << i.second << ") ";
}
cout << area3 << endl;
ans.clear();
int min_x4 = 100,max_x4=-100,min_y4 = 100,max_y4=-100;
for(auto i : Q4) {
if(i.first < min_x4) {
min_x4 = i.first;
}
if(i.first > max_x4) {
max_x4 = i.first;
}
if(i.second < min_y4) {
min_y4 = i.second;
}
if(i.second > max_y4) {
max_y4 = i.second;
}
}
ans.push_back(make_pair(min_x4,min_y4));
ans.push_back(make_pair(max_x4,max_y4));
int area4 = (max_x4 - min_x4) * (max_y4 - min_y4);
cout << "Q4: ";
for(auto i : ans) {
cout << "(" << i.first << ", " << i.second << ") ";
}
cout << area4 << endl;
ans.clear();
} | # 2070365, 2024-11-02 12:05:45, PPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
int main() {
int n,x,y;
vector<pair<int,int>> Q1;
vector<pair<int,int>> Q2;
vector<pair<int,int>> Q3;
vector<pair<int,int>> Q4;
vector<pair<int,int>> ans;
vector<map<string,vector<int>>> m;
bool b = true;
cin >> n;
while(n--) {
cin >> x >> y;
if(x>0 && y>0) {
Q1.push_back(make_pair(x,y));
b= false;
}else if(x<0 && y>0) {
Q2.push_back(make_pair(x,y));
b= false;
}else if(x<0 && y<0) {
Q3.push_back(make_pair(x,y));
b= false;
}else if(x>0 && y<0) {
Q4.push_back(make_pair(x,y));
b=false;
}
}
if(b) {
cout << "No point in any quadrant";
return 0;
}
if(Q1.size()>0) {
int min_x = 100,max_x=-100,min_y = 100,max_y=-100;
for(auto i : Q1) {
if(i.first < min_x) {
min_x = i.first;
}
if(i.first > max_x) {
max_x = i.first;
}
if(i.second < min_y) {
min_y = i.second;
}
if(i.second > max_y) {
max_y = i.second;
}
}
ans.push_back(make_pair(min_x,min_y));
ans.push_back(make_pair(max_x,max_y));
int area = (max_x - min_x) * (max_y - min_y);
cout << "Q1: ";
for(auto i : ans) {
cout << "(" << i.first << ", " << i.second << ") ";
}
cout << area << endl;
ans.clear();
}
if(Q2.size()>0) {
int min_x2 = 100,max_x2=-100,min_y2 = 100,max_y2=-100;
for(auto i : Q2) {
if(i.first < min_x2) {
min_x2 = i.first;
}
if(i.first > max_x2) {
max_x2 = i.first;
}
if(i.second < min_y2) {
min_y2 = i.second;
}
if(i.second > max_y2) {
max_y2 = i.second;
}
}
ans.push_back(make_pair(min_x2,min_y2));
ans.push_back(make_pair(max_x2,max_y2));
int area2 = (max_x2 - min_x2) * (max_y2 - min_y2);
cout << "Q2: ";
for(auto i : ans) {
cout << "(" << i.first << ", " << i.second << ") ";
}
cout << area2 << endl;
ans.clear();
}
if(Q3.size()>0) {
int min_x3 = 100,max_x3=-100,min_y3 = 100,max_y3=-100;
for(auto i : Q3) {
if(i.first < min_x3) {
min_x3 = i.first;
}
if(i.first > max_x3) {
max_x3 = i.first;
}
if(i.second < min_y3) {
min_y3 = i.second;
}
if(i.second > max_y3) {
max_y3 = i.second;
}
}
ans.push_back(make_pair(min_x3,min_y3));
ans.push_back(make_pair(max_x3,max_y3));
int area3 = (max_x3 - min_x3) * (max_y3 - min_y3);
cout << "Q3: ";
for(auto i : ans) {
cout << "(" << i.first << ", " << i.second << ") ";
}
cout << area3 << endl;
ans.clear();
}
if(Q4.size()>0) {
int min_x4 = 100,max_x4=-100,min_y4 = 100,max_y4=-100;
for(auto i : Q4) {
if(i.first < min_x4) {
min_x4 = i.first;
}
if(i.first > max_x4) {
max_x4 = i.first;
}
if(i.second < min_y4) {
min_y4 = i.second;
}
if(i.second > max_y4) {
max_y4 = i.second;
}
}
ans.push_back(make_pair(min_x4,min_y4));
ans.push_back(make_pair(max_x4,max_y4));
int area4 = (max_x4 - min_x4) * (max_y4 - min_y4);
cout << "Q4: ";
for(auto i : ans) {
cout << "(" << i.first << ", " << i.second << ") ";
}
cout << area4 << endl;
ans.clear();
}
} |
# 2069300, 2024-11-02 10:35:03, -----P---- (10%)
#include <bits/stdc++.h>
using namespace std;
int main(){
vector<pair<int,int>> Q1 ;
vector<pair<int,int>> Q2 ;
vector<pair<int,int>> Q3 ;
vector<pair<int,int>> Q4 ;
int n , x , y ;
cin >> n ;
for(int i=0 ; i<n ; i++){
cin >> x >> y ;
if(x == 0 || y == 0){
continue;
}
if(x > 0 && y > 0){
Q1.push_back(make_pair(x,y)) ;
}
else if(x < 0 && y > 0){
Q2.push_back(make_pair(x,y)) ;
}
else if(x < 0 && y < 0){
Q3.push_back(make_pair(x,y)) ;
}
else if(x > 0 && y < 0){
Q4.push_back(make_pair(x,y)) ;
}
}
if(Q1.size() > 0){
cout << "Q1: " ;
if(Q1.size() == 1){
for(auto kv : Q1){
cout << "(" << kv.first << ", " << kv.second <<")" << " " << "(" << kv.first << ", " << kv.second <<")" << " 0" ;
}
}
else{ for(auto kv : Q1){
cout << "(" << kv.first << ", " << kv.second <<")" ;
}
}
cout << endl;
}
if(Q2.size() > 0){
cout << "Q2: " ;
if(Q2.size() == 1){
for(auto kv : Q2){
cout << "(" << kv.first << ", " << kv.second <<")" << " " << "(" << kv.first << ", " << kv.second <<")" << " 0" ;
}
}
else{ for(auto kv : Q2){
cout << "(" << kv.first << ", " << kv.second <<")" ;
}
}
cout << endl;
}
if(Q3.size() > 0){
cout << "Q1: " ;
if(Q3.size() == 1){
for(auto kv : Q3){
cout << "(" << kv.first << ", " << kv.second <<")" << " " << "(" << kv.first << ", " << kv.second <<")" << " 0" ;
}
}
else{ for(auto kv : Q3){
cout << "(" << kv.first << ", " << kv.second <<")" ;
}
}
cout << endl;
}
if(Q4.size() > 0){
cout << "Q4: " ;
if(Q4.size() == 1){
for(auto kv : Q4){
cout << "(" << kv.first << ", " << kv.second <<")" << " " << "(" << kv.first << ", " << kv.second <<")" << " 0" ;
}
}
else{ for(auto kv : Q4){
cout << "(" << kv.first << ", " << kv.second <<")" ;
}
}
cout << endl;
}
if(Q1.size() == 0 && Q2.size() == 0 && Q3.size() == 0 && Q4.size() == 0 ){
cout << "No point in any quadrant";
}
} | # 2069326, 2024-11-02 10:36:35, ---------- (0%)
#include <bits/stdc++.h>
using namespace std;
int main(){
vector<pair<int,int>> Q1 ;
vector<pair<int,int>> Q2 ;
vector<pair<int,int>> Q3 ;
vector<pair<int,int>> Q4 ;
int n , x , y ;
cin >> n ;
for(int i=0 ; i<n ; i++){
cin >> x >> y ;
if(x == 0 || y == 0){
continue;
}
if(x > 0 && y > 0){
Q1.push_back(make_pair(x,y)) ;
}
else if(x < 0 && y > 0){
Q2.push_back(make_pair(x,y)) ;
}
else if(x < 0 && y < 0){
Q3.push_back(make_pair(x,y)) ;
}
else if(x > 0 && y < 0){
Q4.push_back(make_pair(x,y)) ;
}
}
if(Q1.size() > 0){
cout << "Q1: " ;
if(Q1.size() == 1){
for(auto kv : Q1){
cout << "(" << kv.first << ", " << kv.second <<")" << " " << "(" << kv.first << ", " << kv.second <<")" << " 0" ;
}
}
else{ for(auto kv : Q1){
cout << "(" << kv.first << ", " << kv.second <<")" ;
}
}
cout << endl;
}
if(Q2.size() > 0){
cout << "Q2: " ;
if(Q2.size() == 1){
for(auto kv : Q2){
cout << "(" << kv.first << ", " << kv.second <<")" << " " << "(" << kv.first << ", " << kv.second <<")" << " 0" ;
}
}
else{ for(auto kv : Q2){
cout << "(" << kv.first << ", " << kv.second <<")" ;
}
}
cout << endl;
}
if(Q3.size() > 0){
cout << "Q1: " ;
if(Q3.size() == 1){
for(auto kv : Q3){
cout << "(" << kv.first << ", " << kv.second <<")" << " " << "(" << kv.first << ", " << kv.second <<")" << " 0" ;
}
}
else{ for(auto kv : Q3){
cout << "(" << kv.first << ", " << kv.second <<")" ;
}
}
cout << endl;
}
if(Q4.size() > 0){
cout << "Q4: " ;
if(Q4.size() == 1){
for(auto kv : Q4){
cout << "(" << kv.first << ", " << kv.second <<")" << " " << "(" << kv.first << ", " << kv.second <<")" << " 0" ;
}
}
else{ for(auto kv : Q4){
cout << "(" << kv.first << ", " << kv.second <<")" ;
}
}
cout << endl;
}
// if(Q1.size() == 0 && Q2.size() == 0 && Q3.size() == 0 && Q4.size() == 0 ){
// cout << "No point in any quadrant";
// }
} | # 2069804, 2024-11-02 11:25:56, PPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std;
int main(){
vector<pair<int,int>> Q1 ;
vector<pair<int,int>> Q2 ;
vector<pair<int,int>> Q3 ;
vector<pair<int,int>> Q4 ;
int n , x , y , range = 0 ;
int minx =0 , miny =0 , maxx =0 , maxy =0 ;
cin >> n ;
for(int i=0 ; i<n ; i++){
cin >> x >> y ;
if(x == 0 || y == 0){
continue;
}
if(x > 0 && y > 0){
Q1.push_back(make_pair(x,y)) ;
}
else if(x < 0 && y > 0){
Q2.push_back(make_pair(x,y)) ;
}
else if(x < 0 && y < 0){
Q3.push_back(make_pair(x,y)) ;
}
else if(x > 0 && y < 0){
Q4.push_back(make_pair(x,y)) ;
}
}
if(Q1.size() > 0){
cout << "Q1: " ;
for(auto kv : Q1){
if (minx == 0 && maxx == 0 && minx ==0 && miny == 0 ){
maxx = kv.first ;
minx = kv.first ;
maxy = kv.second ;
miny = kv.second ;
}
if (kv.first > maxx) maxx = kv.first;
if (kv.first < minx) minx = kv.first ;
if (kv.second > maxy) maxy = kv.second ;
if (kv.second < miny) miny = kv.second ;
}
range = (maxx - minx) * (maxy - miny ) ;
if(range < 0) range = -range ;
cout << "(" << minx << ", " << miny <<")" << " " << "(" << maxx << ", " << maxy <<") " << range << endl;
range = 0 ;
maxx = 0 ;
minx = 0 ;
maxy = 0 ;
miny = 0 ;
}
if(Q2.size() > 0){
cout << "Q2: " ;
for(auto kv : Q2){
if (minx == 0 && maxx == 0 && minx ==0 && miny == 0 ){
maxx = kv.first ;
minx = kv.first ;
maxy = kv.second ;
miny = kv.second ;
}
if (kv.first > maxx) maxx = kv.first;
if (kv.first < minx) minx = kv.first ;
if (kv.second > maxy) maxy = kv.second ;
if (kv.second < miny) miny = kv.second ;
}
range = (maxx - minx) * (maxy - miny ) ;
if(range < 0) range = -range ;
cout << "(" << minx << ", " << miny <<")" << " " << "(" << maxx << ", " << maxy <<") " << range << endl;
range = 0 ;
maxx = 0 ;
minx = 0 ;
maxy = 0 ;
miny = 0 ;
}
if(Q3.size() > 0){
cout << "Q3: " ;
for(auto kv : Q3){
if (minx == 0 && maxx == 0 && minx ==0 && miny == 0 ){
maxx = kv.first ;
minx = kv.first ;
maxy = kv.second ;
miny = kv.second ;
}
if (kv.first > maxx) maxx = kv.first;
if (kv.first < minx) minx = kv.first ;
if (kv.second > maxy) maxy = kv.second ;
if (kv.second < miny) miny = kv.second ;
}
range = (maxx - minx) * (maxy - miny ) ;
if(range < 0) range = -range ;
cout << "(" << minx << ", " << miny <<")" << " " << "(" << maxx << ", " << maxy <<") " << range << endl;
range = 0 ;
maxx = 0 ;
minx = 0 ;
maxy = 0 ;
miny = 0 ;
}
if(Q4.size() > 0){
cout << "Q4: " ;
for(auto kv : Q4){
if (minx == 0 && maxx == 0 && minx ==0 && miny == 0 ){
maxx = kv.first ;
minx = kv.first ;
maxy = kv.second ;
miny = kv.second ;
}
if (kv.first > maxx) maxx = kv.first;
if (kv.first < minx) minx = kv.first ;
if (kv.second > maxy) maxy = kv.second ;
if (kv.second < miny) miny = kv.second ;
}
range = (maxx - minx) * (maxy - miny ) ;
if(range < 0) range = -range ;
cout << "(" << minx << ", " << miny <<")" << " " << "(" << maxx << ", " << maxy <<") " << range << endl;
range = 0 ;
maxx = 0 ;
minx = 0 ;
maxy = 0 ;
miny = 0 ;
}
if(Q1.size() == 0 && Q2.size() == 0 && Q3.size() == 0 && Q4.size() == 0 ){
cout << "No point in any quadrant";
}
} |
# 2069115, 2024-11-02 10:13:46, -----P---- (10%)
#include <iostream>
#include <cmath>
int main(){
int N,a,b;
std::cin >> N;
struct Coord{
int x1;
int y1;
int x2;
int y2;
bool empty = 1;
};
Coord Q1, Q2, Q3, Q4;
for(int i = 0; i < N; i++){
std::cin >> a >> b;
if((a > 0) && (b > 0)){
if(Q1.empty){
Q1.x1 = Q1.x2 = a;
Q1.y1 = Q1.y2 = b;
Q1.empty = 0;
}else{
Q1.x1 = std::min(Q1.x1, a);
Q1.x2 = std::max(Q1.x2, a);
Q1.y1 = std::min(Q1.y1, b);
Q1.y2 = std::max(Q1.y2, b);
}
}else if((a < 0) && (b > 0)){
if(Q2.empty){
Q2.x1 = Q2.x2 = a;
Q2.y1 = Q2.y2 = b;
Q2.empty = 0;
}else{
Q2.x1 = std::min(Q2.x1, a);
Q2.x2 = std::max(Q2.x2, a);
Q2.y1 = std::min(Q2.y1, b);
Q2.y2 = std::max(Q2.y2, b);
}
}else if((a < 0) && (b < 0)){
if(Q3.empty){
Q3.x1 = Q3.x2 = a;
Q3.y1 = Q3.y2 = b;
Q3.empty = 0;
}else{
Q3.x1 = std::min(Q3.x1, a);
Q3.x2 = std::max(Q3.x2, a);
Q3.y1 = std::min(Q3.y1, b);
Q3.y2 = std::max(Q3.y2, b);
}
}else if((a > 0) && (b < 0)){
if(Q4.empty){
Q4.x1 = Q4.x2 = a;
Q4.y1 = Q4.y2 = b;
Q4.empty = 0;
}else{
Q4.x1 = std::min(Q4.x1, a);
Q4.x2 = std::max(Q4.x2, a);
Q4.y1 = std::min(Q4.y1, b);
Q4.y2 = std::max(Q4.y2, b);
}
}
}
if(Q1.empty && Q2.empty && Q3.empty && Q4.empty){
std::cout << "No point in any quadrant";
}else{
if(!Q1.empty){
std::cout << "Q1 : (" << Q1.x1 << ", " << Q1.y1 << ") (" << Q1.x2 << ", " << Q1.y2 << ") " << ((Q1.x2 - Q1.x1)*(Q1.y2 - Q1.y1)) << std::endl;
}
if(!Q2.empty){
std::cout << "Q2 : (" << Q2.x1 << ", " << Q2.y1 << ") (" << Q2.x2 << ", " << Q2.y2 << ") " << ((Q2.x2 - Q2.x1)*(Q2.y2 - Q2.y1)) << std::endl;
}
if(!Q3.empty){
std::cout << "Q3 : (" << Q3.x1 << ", " << Q3.y1 << ") (" << Q3.x2 << ", " << Q3.y2 << ") " << ((Q3.x2 - Q3.x1)*(Q3.y2 - Q3.y1)) << std::endl;
}
if(!Q1.empty){
std::cout << "Q4 : (" << Q4.x1 << ", " << Q4.y1 << ") (" << Q4.x2 << ", " << Q4.y2 << ") " << ((Q4.x2 - Q4.x1)*(Q4.y2 - Q4.y1)) << std::endl;
}
}
return 0;
} | # 2069126, 2024-11-02 10:14:53, -P-PPPPP-P (70%)
#include <iostream>
#include <cmath>
int main(){
int N,a,b;
std::cin >> N;
struct Coord{
int x1;
int y1;
int x2;
int y2;
bool empty = 1;
};
Coord Q1, Q2, Q3, Q4;
for(int i = 0; i < N; i++){
std::cin >> a >> b;
if((a > 0) && (b > 0)){
if(Q1.empty){
Q1.x1 = Q1.x2 = a;
Q1.y1 = Q1.y2 = b;
Q1.empty = 0;
}else{
Q1.x1 = std::min(Q1.x1, a);
Q1.x2 = std::max(Q1.x2, a);
Q1.y1 = std::min(Q1.y1, b);
Q1.y2 = std::max(Q1.y2, b);
}
}else if((a < 0) && (b > 0)){
if(Q2.empty){
Q2.x1 = Q2.x2 = a;
Q2.y1 = Q2.y2 = b;
Q2.empty = 0;
}else{
Q2.x1 = std::min(Q2.x1, a);
Q2.x2 = std::max(Q2.x2, a);
Q2.y1 = std::min(Q2.y1, b);
Q2.y2 = std::max(Q2.y2, b);
}
}else if((a < 0) && (b < 0)){
if(Q3.empty){
Q3.x1 = Q3.x2 = a;
Q3.y1 = Q3.y2 = b;
Q3.empty = 0;
}else{
Q3.x1 = std::min(Q3.x1, a);
Q3.x2 = std::max(Q3.x2, a);
Q3.y1 = std::min(Q3.y1, b);
Q3.y2 = std::max(Q3.y2, b);
}
}else if((a > 0) && (b < 0)){
if(Q4.empty){
Q4.x1 = Q4.x2 = a;
Q4.y1 = Q4.y2 = b;
Q4.empty = 0;
}else{
Q4.x1 = std::min(Q4.x1, a);
Q4.x2 = std::max(Q4.x2, a);
Q4.y1 = std::min(Q4.y1, b);
Q4.y2 = std::max(Q4.y2, b);
}
}
}
if(Q1.empty && Q2.empty && Q3.empty && Q4.empty){
std::cout << "No point in any quadrant";
}else{
if(!Q1.empty){
std::cout << "Q1: (" << Q1.x1 << ", " << Q1.y1 << ") (" << Q1.x2 << ", " << Q1.y2 << ") " << ((Q1.x2 - Q1.x1)*(Q1.y2 - Q1.y1)) << std::endl;
}
if(!Q2.empty){
std::cout << "Q2: (" << Q2.x1 << ", " << Q2.y1 << ") (" << Q2.x2 << ", " << Q2.y2 << ") " << ((Q2.x2 - Q2.x1)*(Q2.y2 - Q2.y1)) << std::endl;
}
if(!Q3.empty){
std::cout << "Q3: (" << Q3.x1 << ", " << Q3.y1 << ") (" << Q3.x2 << ", " << Q3.y2 << ") " << ((Q3.x2 - Q3.x1)*(Q3.y2 - Q3.y1)) << std::endl;
}
if(!Q1.empty){
std::cout << "Q4: (" << Q4.x1 << ", " << Q4.y1 << ") (" << Q4.x2 << ", " << Q4.y2 << ") " << ((Q4.x2 - Q4.x1)*(Q4.y2 - Q4.y1)) << std::endl;
}
}
return 0;
} | # 2069139, 2024-11-02 10:17:00, PPPPPPPPPP (100%)
#include <iostream>
#include <cmath>
int main(){
int N,a,b;
std::cin >> N;
struct Coord{
int x1;
int y1;
int x2;
int y2;
bool empty = 1;
};
Coord Q1, Q2, Q3, Q4;
for(int i = 0; i < N; i++){
std::cin >> a >> b;
if((a > 0) && (b > 0)){
if(Q1.empty){
Q1.x1 = Q1.x2 = a;
Q1.y1 = Q1.y2 = b;
Q1.empty = 0;
}else{
Q1.x1 = std::min(Q1.x1, a);
Q1.x2 = std::max(Q1.x2, a);
Q1.y1 = std::min(Q1.y1, b);
Q1.y2 = std::max(Q1.y2, b);
}
}else if((a < 0) && (b > 0)){
if(Q2.empty){
Q2.x1 = Q2.x2 = a;
Q2.y1 = Q2.y2 = b;
Q2.empty = 0;
}else{
Q2.x1 = std::min(Q2.x1, a);
Q2.x2 = std::max(Q2.x2, a);
Q2.y1 = std::min(Q2.y1, b);
Q2.y2 = std::max(Q2.y2, b);
}
}else if((a < 0) && (b < 0)){
if(Q3.empty){
Q3.x1 = Q3.x2 = a;
Q3.y1 = Q3.y2 = b;
Q3.empty = 0;
}else{
Q3.x1 = std::min(Q3.x1, a);
Q3.x2 = std::max(Q3.x2, a);
Q3.y1 = std::min(Q3.y1, b);
Q3.y2 = std::max(Q3.y2, b);
}
}else if((a > 0) && (b < 0)){
if(Q4.empty){
Q4.x1 = Q4.x2 = a;
Q4.y1 = Q4.y2 = b;
Q4.empty = 0;
}else{
Q4.x1 = std::min(Q4.x1, a);
Q4.x2 = std::max(Q4.x2, a);
Q4.y1 = std::min(Q4.y1, b);
Q4.y2 = std::max(Q4.y2, b);
}
}
}
if(Q1.empty && Q2.empty && Q3.empty && Q4.empty){
std::cout << "No point in any quadrant";
}else{
if(!Q1.empty){
std::cout << "Q1: (" << Q1.x1 << ", " << Q1.y1 << ") (" << Q1.x2 << ", " << Q1.y2 << ") " << ((Q1.x2 - Q1.x1)*(Q1.y2 - Q1.y1)) << std::endl;
}
if(!Q2.empty){
std::cout << "Q2: (" << Q2.x1 << ", " << Q2.y1 << ") (" << Q2.x2 << ", " << Q2.y2 << ") " << ((Q2.x2 - Q2.x1)*(Q2.y2 - Q2.y1)) << std::endl;
}
if(!Q3.empty){
std::cout << "Q3: (" << Q3.x1 << ", " << Q3.y1 << ") (" << Q3.x2 << ", " << Q3.y2 << ") " << ((Q3.x2 - Q3.x1)*(Q3.y2 - Q3.y1)) << std::endl;
}
if(!Q4.empty){
std::cout << "Q4: (" << Q4.x1 << ", " << Q4.y1 << ") (" << Q4.x2 << ", " << Q4.y2 << ") " << ((Q4.x2 - Q4.x1)*(Q4.y2 - Q4.y1)) << std::endl;
}
}
return 0;
} |
# 2069169, 2024-11-02 10:21:22, -x-xPxPPxP (40%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
int x1,y1;
cin >> n;
vector<vector<int>> Q1;
vector<vector<int>> Q2;
vector<vector<int>> Q3;
vector<vector<int>> Q4;
for(int i = 0; i < n; i++){
cin >> x1 >> y1;
if(x1 == 0 || y1 == 0){
if(i == n - 1){
break;
}else{
continue;
}
}else{
if(x1 > 0 && y1 > 0){
Q1.push_back({x1, y1});
}else if(x1 < 0 && y1 > 0){
Q2.push_back({x1,y1});
}else if(x1 < 0 && y1 < 0){
Q3.push_back({x1, y1});
}else if(x1 > 0 && y1 < 0){
Q4.push_back({x1,y1});
}
}
}
vector<int> spx1;
vector<int> spy1;
int minx;
int miny;
int maxx;
int maxy;
for(int i = 0; i < Q1.size(); i++){
spx1.push_back(Q1[i][0]);
spy1.push_back(Q1[i][1]);
}
minx = *min_element(spx1.begin(), spx1.end());
miny = *min_element(spy1.begin(), spy1.end());
maxx = *max_element(spx1.begin(), spx1.end());
maxy = *max_element(spy1.begin(), spy1.end());
int sum = (maxx - minx) * (maxy - miny);
cout << "Q1: (" << minx << ", " << miny << ") (" << maxx << ", " << maxy << ") " << sum << endl;
spx1.clear();
spy1.clear();
for(int i = 0; i < Q2.size(); i++){
spx1.push_back(Q2[i][0]);
spy1.push_back(Q2[i][1]);
}
minx = *min_element(spx1.begin(), spx1.end());
miny = *min_element(spy1.begin(), spy1.end());
maxx = *max_element(spx1.begin(), spx1.end());
maxy = *max_element(spy1.begin(), spy1.end());
sum = (maxx - minx) * (maxy - miny);
cout << "Q2: (" << minx << ", " << miny << ") (" << maxx << ", " << maxy << ") " << sum << endl;
spx1.clear();
spy1.clear();
for(int i = 0; i < Q3.size(); i++){
spx1.push_back(Q3[i][0]);
spy1.push_back(Q3[i][1]);
}
minx = *min_element(spx1.begin(), spx1.end());
miny = *min_element(spy1.begin(), spy1.end());
maxx = *max_element(spx1.begin(), spx1.end());
maxy = *max_element(spy1.begin(), spy1.end());
sum = (maxx - minx) * (maxy - miny);
cout << "Q3: (" << minx << ", " << miny << ") (" << maxx << ", " << maxy << ") " << sum << endl;
spx1.clear();
spy1.clear();
for(int i = 0; i < Q4.size(); i++){
spx1.push_back(Q4[i][0]);
spy1.push_back(Q4[i][1]);
}
minx = *min_element(spx1.begin(), spx1.end());
miny = *min_element(spy1.begin(), spy1.end());
maxx = *max_element(spx1.begin(), spx1.end());
maxy = *max_element(spy1.begin(), spy1.end());
sum = (maxx - minx) * (maxy - miny);
cout << "Q4: (" << minx << ", " << miny << ") (" << maxx << ", " << maxy << ") " << sum << endl;
} | # 2069200, 2024-11-02 10:25:22, -x-xPPPPxP (50%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
int x1,y1;
cin >> n;
vector<vector<int>> Q1;
vector<vector<int>> Q2;
vector<vector<int>> Q3;
vector<vector<int>> Q4;
for(int i = 0; i < n; i++){
cin >> x1 >> y1;
if(x1 == 0 || y1 == 0){
if(i == n - 1){
break;
}else{
continue;
}
}else{
if(x1 > 0 && y1 > 0){
Q1.push_back({x1, y1});
}else if(x1 < 0 && y1 > 0){
Q2.push_back({x1,y1});
}else if(x1 < 0 && y1 < 0){
Q3.push_back({x1, y1});
}else if(x1 > 0 && y1 < 0){
Q4.push_back({x1,y1});
}
}
}
if(Q1.empty() && Q2.empty() && Q3.empty() && Q4.empty()){
cout << "No point in any quadrant";
return 0;
}
vector<int> spx1;
vector<int> spy1;
int minx;
int miny;
int maxx;
int maxy;
for(int i = 0; i < Q1.size(); i++){
spx1.push_back(Q1[i][0]);
spy1.push_back(Q1[i][1]);
}
minx = *min_element(spx1.begin(), spx1.end());
miny = *min_element(spy1.begin(), spy1.end());
maxx = *max_element(spx1.begin(), spx1.end());
maxy = *max_element(spy1.begin(), spy1.end());
int sum = (maxx - minx) * (maxy - miny);
cout << "Q1: (" << minx << ", " << miny << ") (" << maxx << ", " << maxy << ") " << sum << endl;
spx1.clear();
spy1.clear();
for(int i = 0; i < Q2.size(); i++){
spx1.push_back(Q2[i][0]);
spy1.push_back(Q2[i][1]);
}
minx = *min_element(spx1.begin(), spx1.end());
miny = *min_element(spy1.begin(), spy1.end());
maxx = *max_element(spx1.begin(), spx1.end());
maxy = *max_element(spy1.begin(), spy1.end());
sum = (maxx - minx) * (maxy - miny);
cout << "Q2: (" << minx << ", " << miny << ") (" << maxx << ", " << maxy << ") " << sum << endl;
spx1.clear();
spy1.clear();
for(int i = 0; i < Q3.size(); i++){
spx1.push_back(Q3[i][0]);
spy1.push_back(Q3[i][1]);
}
minx = *min_element(spx1.begin(), spx1.end());
miny = *min_element(spy1.begin(), spy1.end());
maxx = *max_element(spx1.begin(), spx1.end());
maxy = *max_element(spy1.begin(), spy1.end());
sum = (maxx - minx) * (maxy - miny);
cout << "Q3: (" << minx << ", " << miny << ") (" << maxx << ", " << maxy << ") " << sum << endl;
spx1.clear();
spy1.clear();
for(int i = 0; i < Q4.size(); i++){
spx1.push_back(Q4[i][0]);
spy1.push_back(Q4[i][1]);
}
minx = *min_element(spx1.begin(), spx1.end());
miny = *min_element(spy1.begin(), spy1.end());
maxx = *max_element(spx1.begin(), spx1.end());
maxy = *max_element(spy1.begin(), spy1.end());
sum = (maxx - minx) * (maxy - miny);
cout << "Q4: (" << minx << ", " << miny << ") (" << maxx << ", " << maxy << ") " << sum << endl;
} | # 2069380, 2024-11-02 10:42:04, PPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
int x1,y1;
cin >> n;
vector<vector<int>> Q1;
vector<vector<int>> Q2;
vector<vector<int>> Q3;
vector<vector<int>> Q4;
for(int i = 0; i < n; i++){
cin >> x1 >> y1;
if(x1 == 0 || y1 == 0){
if(i == n - 1){
break;
}else{
continue;
}
}else{
if(x1 > 0 && y1 > 0){
Q1.push_back({x1, y1});
}else if(x1 < 0 && y1 > 0){
Q2.push_back({x1,y1});
}else if(x1 < 0 && y1 < 0){
Q3.push_back({x1, y1});
}else if(x1 > 0 && y1 < 0){
Q4.push_back({x1,y1});
}
}
}
if(Q1.empty() && Q2.empty() && Q3.empty() && Q4.empty()){
cout << "No point in any quadrant";
return 0;
}
vector<int> spx1;
vector<int> spy1;
int minx;
int miny;
int maxx;
int maxy;
int sum;
if(Q1.size() != 0){
for(int i = 0; i < Q1.size(); i++){
spx1.push_back(Q1[i][0]);
spy1.push_back(Q1[i][1]);
}
minx = *min_element(spx1.begin(), spx1.end());
miny = *min_element(spy1.begin(), spy1.end());
maxx = *max_element(spx1.begin(), spx1.end());
maxy = *max_element(spy1.begin(), spy1.end());
sum = (maxx - minx) * (maxy - miny);
cout << "Q1: (" << minx << ", " << miny << ") (" << maxx << ", " << maxy << ") " << sum << endl;
}
spx1 = {};
spy1 = {};
if(Q2.size() != 0){
for(int i = 0; i < Q2.size(); i++){
spx1.push_back(Q2[i][0]);
spy1.push_back(Q2[i][1]);
}
minx = *min_element(spx1.begin(), spx1.end());
miny = *min_element(spy1.begin(), spy1.end());
maxx = *max_element(spx1.begin(), spx1.end());
maxy = *max_element(spy1.begin(), spy1.end());
sum = (maxx - minx) * (maxy - miny);
cout << "Q2: (" << minx << ", " << miny << ") (" << maxx << ", " << maxy << ") " << sum << endl;
}
spx1 = {};
spy1 = {};
if(Q3.size() != 0){
for(int i = 0; i < Q3.size(); i++){
spx1.push_back(Q3[i][0]);
spy1.push_back(Q3[i][1]);
}
minx = *min_element(spx1.begin(), spx1.end());
miny = *min_element(spy1.begin(), spy1.end());
maxx = *max_element(spx1.begin(), spx1.end());
maxy = *max_element(spy1.begin(), spy1.end());
sum = (maxx - minx) * (maxy - miny);
cout << "Q3: (" << minx << ", " << miny << ") (" << maxx << ", " << maxy << ") " << sum << endl;
}
spx1 = {};
spy1 = {};
if(!(spx1.empty())){
spx1.clear();
}
if(!(spy1.empty())){
spy1.clear();
}
if(Q4.size() != 0){
for(int i = 0; i < Q4.size(); i++){
spx1.push_back(Q4[i][0]);
spy1.push_back(Q4[i][1]);
}
minx = *min_element(spx1.begin(), spx1.end());
miny = *min_element(spy1.begin(), spy1.end());
maxx = *max_element(spx1.begin(), spx1.end());
maxy = *max_element(spy1.begin(), spy1.end());
sum = (maxx - minx) * (maxy - miny);
cout << "Q4: (" << minx << ", " << miny << ") (" << maxx << ", " << maxy << ") " << sum << endl;
}
} |
# 2069807, 2024-11-02 11:26:35, xxxxPxPPxP (40%)
#include <bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(0);cin.tie(0);
set<int> s;
set<int> s1,s11,s2,s22,s3,s33,s4,s44;
int n,a1,a2;
cin>>n;
for(int i=0; i<n; i++){
cin>>a1>>a2;
if(a1>0 && a2>0){
s1.insert(a1);
s11.insert(a2);
}
if(a1<0 && a2>0) {
s2.insert(a1);
s22.insert(a2);
}
if(a1<0 && a2<0) {
s3.insert(a1);
s33.insert(a2);
}
if(a1>0 && a2<0) {
s4.insert(a1);
s44.insert(a2);
}
}
int x1min=*s1.begin()
,x1max=*(--s1.end())
,y1min=*s11.begin()
,y1max=*(--s11.end())
,x2min=*s2.begin()
,x2max=*(--s2.end())
,y2min=*s22.begin()
,y2max=*(--s22.end())
,x3min=*s3.begin()
,x3max=*(--s3.end())
,y3min=*s33.begin()
,y3max=*(--s33.end())
,x4min=*s4.begin()
,x4max=*(--s4.end())
,y4min=*s44.begin()
,y4max=*(--s44.end())
,area1,area2,area3,area4;
area1 = (x1max-x1min) * (y1max-y1min);
area2 = (x2max-x2min) * (y2max-y2min);
area3 = (x3max-x3min) * (y3max-y3min);
area4 = (x4max-x4min) * (y4max-y4min);
if(s1.empty() && s2.empty() && s3.empty() && s4.empty()){
cout<<"No point in any quadrant";
}
if(!s1.empty()){
cout<<"Q1: ("<<x1min<<", "<<y1min<<") ("<<x1max<<", "<<y1max<<") "<<area1<<'\n';
}
if(!s2.empty()){
cout<<"Q2: ("<<x2min<<", "<<y2min<<") ("<<x2max<<", "<<y2max<<") "<<area2<<'\n';
}
if(!s3.empty()){
cout<<"Q3: ("<<x3min<<", "<<y3min<<") ("<<x3max<<", "<<y3max<<") "<<area3<<'\n';
}
if(!s4.empty()){
cout<<"Q4: ("<<x4min<<", "<<y4min<<") ("<<x4max<<", "<<y4max<<") "<<area4<<'\n';
}
// for(auto i=s1.begin(),i!=s1.end();i++){
// x1min = (*s1.begin()).first
// }
} | # 2069830, 2024-11-02 11:28:40, xxxxPPPPxP (50%)
#include <bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(0);cin.tie(0);
set<int> s;
set<int> s1,s11,s2,s22,s3,s33,s4,s44;
int n,a1,a2;
cin>>n;
for(int i=0; i<n; i++){
cin>>a1>>a2;
if(a1>0 && a2>0){
s1.insert(a1);
s11.insert(a2);
}
if(a1<0 && a2>0) {
s2.insert(a1);
s22.insert(a2);
}
if(a1<0 && a2<0) {
s3.insert(a1);
s33.insert(a2);
}
if(a1>0 && a2<0) {
s4.insert(a1);
s44.insert(a2);
}
}
if(s1.empty() && s2.empty() && s3.empty() && s4.empty()){
cout<<"No point in any quadrant";
return 0;
}
int x1min=*s1.begin()
,x1max=*(--s1.end())
,y1min=*s11.begin()
,y1max=*(--s11.end())
,x2min=*s2.begin()
,x2max=*(--s2.end())
,y2min=*s22.begin()
,y2max=*(--s22.end())
,x3min=*s3.begin()
,x3max=*(--s3.end())
,y3min=*s33.begin()
,y3max=*(--s33.end())
,x4min=*s4.begin()
,x4max=*(--s4.end())
,y4min=*s44.begin()
,y4max=*(--s44.end())
,area1,area2,area3,area4;
area1 = (x1max-x1min) * (y1max-y1min);
area2 = (x2max-x2min) * (y2max-y2min);
area3 = (x3max-x3min) * (y3max-y3min);
area4 = (x4max-x4min) * (y4max-y4min);
if(!s1.empty()){
cout<<"Q1: ("<<x1min<<", "<<y1min<<") ("<<x1max<<", "<<y1max<<") "<<area1<<'\n';
}
if(!s2.empty()){
cout<<"Q2: ("<<x2min<<", "<<y2min<<") ("<<x2max<<", "<<y2max<<") "<<area2<<'\n';
}
if(!s3.empty()){
cout<<"Q3: ("<<x3min<<", "<<y3min<<") ("<<x3max<<", "<<y3max<<") "<<area3<<'\n';
}
if(!s4.empty()){
cout<<"Q4: ("<<x4min<<", "<<y4min<<") ("<<x4max<<", "<<y4max<<") "<<area4<<'\n';
}
// for(auto i=s1.begin(),i!=s1.end();i++){
// x1min = (*s1.begin()).first
// }
} | # 2069933, 2024-11-02 11:37:51, PPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(0);cin.tie(0);
set<int> s;
set<int> s1,s11,s2,s22,s3,s33,s4,s44;
int n,a1,a2;
cin>>n;
for(int i=0; i<n; i++){
cin>>a1>>a2;
if(a1>0 && a2>0){
s1.insert(a1);
s11.insert(a2);
}
if(a1<0 && a2>0) {
s2.insert(a1);
s22.insert(a2);
}
if(a1<0 && a2<0) {
s3.insert(a1);
s33.insert(a2);
}
if(a1>0 && a2<0) {
s4.insert(a1);
s44.insert(a2);
}
}
if(s1.empty() && s2.empty() && s3.empty() && s4.empty()){
cout<<"No point in any quadrant";
return 0;
}
// int x1min=*s1.begin()//
// ,x1max=*(--s1.end())//
// ,y1min=*s11.begin()//
// ,y1max=*(--s11.end())//
// ,x2min=*s2.begin()//
// ,x2max=*(--s2.end())//
// ,y2min=*s22.begin()//
// ,y2max=*(--s22.end())//
// ,x3min=*s3.begin()//
// ,x3max=*(--s3.end())//
// ,y3min=*s33.begin()//
// ,y3max=*(--s33.end())//
// ,x4min=*s4.begin()//
// ,x4max=*(--s4.end())//
// ,y4min=*s44.begin()//
// ,y4max=*(--s44.end())//
// ,area1,area2,area3,area4;
// area1 = (*(--s1.end())-*s1.begin()) * (*(--s11.end())-*s11.begin());
// area2 = (*(--s2.end())-*s2.begin()) * (*(--s22.end())-*s22.begin());
// area3 = (*(--s3.end())-*s3.begin()) * (*(--s33.end())-*s33.begin());
// area4 = (*(--s4.end())-*s4.begin()) * (*(--s44.end())-*s44.begin());
if(!s1.empty()){
cout<<"Q1: ("<<*s1.begin()<<", "<<*s11.begin()<<") ("<<*(--s1.end())<<", "<<*(--s11.end())<<") "<<(*(--s1.end())-*s1.begin()) * (*(--s11.end())-*s11.begin())<<'\n';
}
if(!s2.empty()){
cout<<"Q2: ("<<*s2.begin()<<", "<<*s22.begin()<<") ("<<*(--s2.end())<<", "<<*(--s22.end())<<") "<<(*(--s2.end())-*s2.begin()) * (*(--s22.end())-*s22.begin())<<'\n';
}
if(!s3.empty()){
cout<<"Q3: ("<<*s3.begin()<<", "<<*s33.begin()<<") ("<<*(--s3.end())<<", "<<*(--s33.end())<<") "<<(*(--s3.end())-*s3.begin()) * (*(--s33.end())-*s33.begin())<<'\n';
}
if(!s4.empty()){
cout<<"Q4: ("<<*s4.begin()<<", "<<*s44.begin()<<") ("<<*(--s4.end())<<", "<<*(--s44.end())<<") "<<(*(--s4.end())-*s4.begin()) * (*(--s44.end())-*s44.begin())<<'\n';
}
// for(auto i=s1.begin(),i!=s1.end();i++){
// x1min = (*s1.begin()).first
// }
} |
# 2071090, 2024-11-02 13:54:32, -----P---- (10%)
#include "bits/stdc++.h"
using namespace std;
int main(){
int n;cin >> n;
vector <pair<int,int>> q1,q2,q3,q4;
for(int i = 0 ; i < n ; i++){
int x,y; cin >> x >> y;
if(x>0&&y>0) q1.push_back({x,y});
if(x>0&&y<0) q4.push_back({x,y});
if(x<0&&y>0) q2.push_back({x,y});
if(x<0&&y<0) q3.push_back({x,y});
}
bool check = true;
if(q1.size() > 1){
check = false;
int mx = 0,my = 0 ,lx = INT_MAX , ly = INT_MAX;
for(auto q:q1){
mx = max(mx,q.first);
my = max(my,q.second);
lx = min(lx,q.first);
ly = min(ly,q.second);
}
cout << "Q1: (" << lx << ',' << ly << ") (" << mx << ',' << my << ") " << (mx-lx)*(my-ly) << endl;
}
if(q2.size() > 1){
check = false;
int mx = -INT_MAX,my = -INT_MAX ,lx = INT_MAX , ly = INT_MAX;
for(auto q:q2){
mx = max(mx,q.first);
my = max(my,q.second);
lx = min(lx,q.first);
ly = min(ly,q.second);
}
cout << "Q2: (" << lx << ',' << ly << ") (" << mx << ',' << my << ") " << (mx-lx)*(my-ly) << endl;
}
if(q3.size() > 1){
check = false;
int mx = -INT_MAX,my = -INT_MAX ,lx = INT_MAX , ly = INT_MAX;
for(auto q:q3){
mx = max(mx,q.first);
my = max(my,q.second);
lx = min(lx,q.first);
ly = min(ly,q.second);
}
cout << "Q3: (" << lx << ',' << ly << ") (" << mx << ',' << my << ") " << (mx-lx)*(my-ly) << endl;
}
if(q4.size() > 1){
check = false;
int mx = -INT_MAX,my = -INT_MAX ,lx = INT_MAX , ly = INT_MAX;
for(auto q:q4){
mx = max(mx,q.first);
my = max(my,q.second);
lx = min(lx,q.first);
ly = min(ly,q.second);
}
cout << "Q4: (" << lx << ',' << ly << ") (" << mx << ',' << my << ") " << (mx-lx)*(my-ly) << endl;
}
if(check){
cout << "No point in any quadrant" << endl;
}
} | # 2071100, 2024-11-02 13:55:30, -----P---- (10%)
#include "bits/stdc++.h"
using namespace std;
int main(){
int n;cin >> n;
vector <pair<int,int>> q1,q2,q3,q4;
for(int i = 0 ; i < n ; i++){
int x,y; cin >> x >> y;
if(x>0&&y>0) q1.push_back({x,y});
if(x>0&&y<0) q4.push_back({x,y});
if(x<0&&y>0) q2.push_back({x,y});
if(x<0&&y<0) q3.push_back({x,y});
}
bool check = true;
if(q1.size() > 0){
check = false;
int mx = 0,my = 0 ,lx = INT_MAX , ly = INT_MAX;
for(auto q:q1){
mx = max(mx,q.first);
my = max(my,q.second);
lx = min(lx,q.first);
ly = min(ly,q.second);
}
cout << "Q1: (" << lx << ',' << ly << ") (" << mx << ',' << my << ") " << (mx-lx)*(my-ly) << endl;
}
if(q2.size() > 0){
check = false;
int mx = -INT_MAX,my = -INT_MAX ,lx = INT_MAX , ly = INT_MAX;
for(auto q:q2){
mx = max(mx,q.first);
my = max(my,q.second);
lx = min(lx,q.first);
ly = min(ly,q.second);
}
cout << "Q2: (" << lx << ',' << ly << ") (" << mx << ',' << my << ") " << (mx-lx)*(my-ly) << endl;
}
if(q3.size() > 0){
check = false;
int mx = -INT_MAX,my = -INT_MAX ,lx = INT_MAX , ly = INT_MAX;
for(auto q:q3){
mx = max(mx,q.first);
my = max(my,q.second);
lx = min(lx,q.first);
ly = min(ly,q.second);
}
cout << "Q3: (" << lx << ',' << ly << ") (" << mx << ',' << my << ") " << (mx-lx)*(my-ly) << endl;
}
if(q4.size() > 0){
check = false;
int mx = -INT_MAX,my = -INT_MAX ,lx = INT_MAX , ly = INT_MAX;
for(auto q:q4){
mx = max(mx,q.first);
my = max(my,q.second);
lx = min(lx,q.first);
ly = min(ly,q.second);
}
cout << "Q4: (" << lx << ',' << ly << ") (" << mx << ',' << my << ") " << (mx-lx)*(my-ly) << endl;
}
if(check){
cout << "No point in any quadrant" << endl;
}
} | # 2071255, 2024-11-02 14:13:44, PPPPPPPPPP (100%)
#include "bits/stdc++.h"
using namespace std;
int main(){
int n;cin >> n;
vector <pair<int,int>> q1,q2,q3,q4;
for(int i = 0 ; i < n ; i++){
int x,y; cin >> x >> y;
if(x>0&&y>0) q1.push_back({x,y});
else if(x>0&&y<0) q4.push_back({x,y});
else if(x<0&&y>0) q2.push_back({x,y});
else if(x<0&&y<0) q3.push_back({x,y});
}
bool check = true;
if(q1.size() > 0){
check = false;
int mx = -INT_MAX,my = -INT_MAX ,lx = INT_MAX , ly = INT_MAX;
for(auto q:q1){
mx = max(mx,q.first);
my = max(my,q.second);
lx = min(lx,q.first);
ly = min(ly,q.second);
}
cout << "Q1: (" << lx << ", " << ly << ") (" << mx << ", " << my << ") " << (mx-lx)*(my-ly) << endl;
}
if(q2.size() > 0){
check = false;
int mx = -INT_MAX,my = -INT_MAX ,lx = INT_MAX , ly = INT_MAX;
for(auto q:q2){
mx = max(mx,q.first);
my = max(my,q.second);
lx = min(lx,q.first);
ly = min(ly,q.second);
}
cout << "Q2: (" << lx << ", " << ly << ") (" << mx << ", " << my << ") " << (mx-lx)*(my-ly) << endl;
}
if(q3.size() > 0){
check = false;
int mx = -INT_MAX,my = -INT_MAX ,lx = INT_MAX , ly = INT_MAX;
for(auto q:q3){
mx = max(mx,q.first);
my = max(my,q.second);
lx = min(lx,q.first);
ly = min(ly,q.second);
}
cout << "Q3: (" << lx << ", " << ly << ") (" << mx << ", " << my << ") " << (mx-lx)*(my-ly) << endl;
}
if(q4.size() > 0){
check = false;
int mx = -INT_MAX,my = -INT_MAX ,lx = INT_MAX , ly = INT_MAX;
for(auto q:q4){
mx = max(mx,q.first);
my = max(my,q.second);
lx = min(lx,q.first);
ly = min(ly,q.second);
}
cout << "Q4: (" << lx << ", " << ly << ") (" << mx << ", " << my << ") " << (mx-lx)*(my-ly) << endl;
}
if(check){
cout << "No point in any quadrant" << endl;
}
} |
# 2068841, 2024-11-02 09:45:01, xxxx-x--x- (0%)
#include <bits/stdc++.h>
using namespace std;
int main(){
vector<pair<int,int>> Q1;
vector<int> Q1x;
vector<int> Q1y;
vector<pair<int,int>> Q2;
vector<int> Q2x;
vector<int> Q2y;
vector<pair<int,int>> Q3;
vector<int> Q3x;
vector<int> Q3y;
vector<pair<int,int>> Q4;
vector<int> Q4x;
vector<int> Q4y;
int N;
cin >> N;
for (int i = 0; i < N; i++)
{
int x,y;
cin >> x >> y;
if(x < 0 && y < 0){
Q3.push_back(make_pair(x,y));
Q3x.push_back(x);
Q3y.push_back(y);
} else if (x < 0 && y > 0){
Q2.push_back(make_pair(x,y));
Q2x.push_back(x);
Q2y.push_back(y);
} else if (x > 0 && y < 0) {
Q4.push_back(make_pair(x,y));
Q4x.push_back(x);
Q4y.push_back(y);
} else if (x > 0 && y > 0){
Q1.push_back(make_pair(x,y));
Q1x.push_back(x);
Q1y.push_back(y);
} else {
continue;
}
}
// Q1 x max - x min * y max - y min
// Q2 x max - x min * y max - y min
sort(Q1x.begin(), Q1x.end());
sort(Q1y.begin(), Q1y.end());
sort(Q2x.begin(), Q2x.end());
sort(Q2y.begin(), Q2y.end());
sort(Q3x.begin(), Q3x.end());
sort(Q3y.begin(), Q3y.end());
sort(Q4x.begin(), Q4x.end());
sort(Q4y.begin(), Q4y.end());
cout << "Q1: ";
cout << "(" << Q1x[0] << ", " << Q1y[0] << ")" << " " << "(" << Q1x[Q1x.size() - 1] << ", " << Q1y[Q1y.size() - 1]<< ")" << " ";
cout << (Q1x[Q1x.size() - 1] - Q1x[0]) * (Q1y[Q1y.size() - 1] - Q1y[0]);
cout << "Q2: ";
cout << "(" << Q2x[0] << ", " << Q2y[0] << ")" << " " << "(" << Q2x[Q2x.size() - 1] << ", " << Q2y[Q2y.size() - 1]<< ")" << " ";
cout << (Q2x[Q2x.size() - 1] - Q2x[0]) * (Q2y[Q2y.size() - 1] - Q2y[0]);
cout << "Q3: ";
cout << "(" << Q3x[0] << ", " << Q3y[0] << ")" << " " << "(" << Q3x[Q3x.size() - 1] << ", " << Q3y[Q3y.size() - 1]<< ")" << " ";
cout << (Q3x[Q3x.size() - 1] - Q3x[0]) * (Q3y[Q3y.size() - 1] - Q3y[0]);
cout << "Q4: ";
cout << "(" << Q4x[0] << ", " << Q4y[0] << ")" << " " << "(" << Q4x[Q4x.size() - 1] << ", " << Q4y[Q4y.size() - 1]<< ")" << " ";
cout << (Q4x[Q4x.size() - 1] - Q4x[0]) * (Q4y[Q4y.size() - 1] - Q4y[0]);
} | # 2068870, 2024-11-02 09:49:23, PPPPP-PPPP (90%)
#include <bits/stdc++.h>
using namespace std;
int main(){
vector<pair<int,int>> Q1;
vector<int> Q1x;
vector<int> Q1y;
vector<pair<int,int>> Q2;
vector<int> Q2x;
vector<int> Q2y;
vector<pair<int,int>> Q3;
vector<int> Q3x;
vector<int> Q3y;
vector<pair<int,int>> Q4;
vector<int> Q4x;
vector<int> Q4y;
int N;
cin >> N;
for (int i = 0; i < N; i++)
{
int x,y;
cin >> x >> y;
if(x < 0 && y < 0){
Q3.push_back(make_pair(x,y));
Q3x.push_back(x);
Q3y.push_back(y);
} else if (x < 0 && y > 0){
Q2.push_back(make_pair(x,y));
Q2x.push_back(x);
Q2y.push_back(y);
} else if (x > 0 && y < 0) {
Q4.push_back(make_pair(x,y));
Q4x.push_back(x);
Q4y.push_back(y);
} else if (x > 0 && y > 0){
Q1.push_back(make_pair(x,y));
Q1x.push_back(x);
Q1y.push_back(y);
} else {
continue;
}
}
// Q1 x max - x min * y max - y min
// Q2 x max - x min * y max - y min
sort(Q1x.begin(), Q1x.end());
sort(Q1y.begin(), Q1y.end());
sort(Q2x.begin(), Q2x.end());
sort(Q2y.begin(), Q2y.end());
sort(Q3x.begin(), Q3x.end());
sort(Q3y.begin(), Q3y.end());
sort(Q4x.begin(), Q4x.end());
sort(Q4y.begin(), Q4y.end());
if(!Q1.empty()){
cout << "Q1: ";
cout << "(" << Q1x[0] << ", " << Q1y[0] << ")" << " " << "(" << Q1x[Q1x.size() - 1] << ", " << Q1y[Q1y.size() - 1]<< ")" << " " ;
cout << (Q1x[Q1x.size() - 1] - Q1x[0]) * (Q1y[Q1y.size() - 1] - Q1y[0]) << endl;
}
if(!Q2.empty()){
cout << "Q2: ";
cout << "(" << Q2x[0] << ", " << Q2y[0] << ")" << " " << "(" << Q2x[Q2x.size() - 1] << ", " << Q2y[Q2y.size() - 1]<< ")" << " ";
cout << (Q2x[Q2x.size() - 1] - Q2x[0]) * (Q2y[Q2y.size() - 1] - Q2y[0]) << endl;
}
if(!Q3.empty()){
cout << "Q3: ";
cout << "(" << Q3x[0] << ", " << Q3y[0] << ")" << " " << "(" << Q3x[Q3x.size() - 1] << ", " << Q3y[Q3y.size() - 1]<< ")" << " ";
cout << (Q3x[Q3x.size() - 1] - Q3x[0]) * (Q3y[Q3y.size() - 1] - Q3y[0]) << endl;
}
if(!Q4.empty()){
cout << "Q4: ";
cout << "(" << Q4x[0] << ", " << Q4y[0] << ")" << " " << "(" << Q4x[Q4x.size() - 1] << ", " << Q4y[Q4y.size() - 1]<< ")" << " ";
cout << (Q4x[Q4x.size() - 1] - Q4x[0]) * (Q4y[Q4y.size() - 1] - Q4y[0]) << endl;
}
} | # 2068888, 2024-11-02 09:51:03, PPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std;
int main(){
vector<pair<int,int>> Q1;
vector<int> Q1x;
vector<int> Q1y;
vector<pair<int,int>> Q2;
vector<int> Q2x;
vector<int> Q2y;
vector<pair<int,int>> Q3;
vector<int> Q3x;
vector<int> Q3y;
vector<pair<int,int>> Q4;
vector<int> Q4x;
vector<int> Q4y;
int N;
cin >> N;
for (int i = 0; i < N; i++)
{
int x,y;
cin >> x >> y;
if(x < 0 && y < 0){
Q3.push_back(make_pair(x,y));
Q3x.push_back(x);
Q3y.push_back(y);
} else if (x < 0 && y > 0){
Q2.push_back(make_pair(x,y));
Q2x.push_back(x);
Q2y.push_back(y);
} else if (x > 0 && y < 0) {
Q4.push_back(make_pair(x,y));
Q4x.push_back(x);
Q4y.push_back(y);
} else if (x > 0 && y > 0){
Q1.push_back(make_pair(x,y));
Q1x.push_back(x);
Q1y.push_back(y);
} else {
continue;
}
}
// Q1 x max - x min * y max - y min
// Q2 x max - x min * y max - y min
sort(Q1x.begin(), Q1x.end());
sort(Q1y.begin(), Q1y.end());
sort(Q2x.begin(), Q2x.end());
sort(Q2y.begin(), Q2y.end());
sort(Q3x.begin(), Q3x.end());
sort(Q3y.begin(), Q3y.end());
sort(Q4x.begin(), Q4x.end());
sort(Q4y.begin(), Q4y.end());
if(!Q1.empty()){
cout << "Q1: ";
cout << "(" << Q1x[0] << ", " << Q1y[0] << ")" << " " << "(" << Q1x[Q1x.size() - 1] << ", " << Q1y[Q1y.size() - 1]<< ")" << " " ;
cout << (Q1x[Q1x.size() - 1] - Q1x[0]) * (Q1y[Q1y.size() - 1] - Q1y[0]) << endl;
}
if(!Q2.empty()){
cout << "Q2: ";
cout << "(" << Q2x[0] << ", " << Q2y[0] << ")" << " " << "(" << Q2x[Q2x.size() - 1] << ", " << Q2y[Q2y.size() - 1]<< ")" << " ";
cout << (Q2x[Q2x.size() - 1] - Q2x[0]) * (Q2y[Q2y.size() - 1] - Q2y[0]) << endl;
}
if(!Q3.empty()){
cout << "Q3: ";
cout << "(" << Q3x[0] << ", " << Q3y[0] << ")" << " " << "(" << Q3x[Q3x.size() - 1] << ", " << Q3y[Q3y.size() - 1]<< ")" << " ";
cout << (Q3x[Q3x.size() - 1] - Q3x[0]) * (Q3y[Q3y.size() - 1] - Q3y[0]) << endl;
}
if(!Q4.empty()){
cout << "Q4: ";
cout << "(" << Q4x[0] << ", " << Q4y[0] << ")" << " " << "(" << Q4x[Q4x.size() - 1] << ", " << Q4y[Q4y.size() - 1]<< ")" << " ";
cout << (Q4x[Q4x.size() - 1] - Q4x[0]) * (Q4y[Q4y.size() - 1] - Q4y[0]) << endl;
}
if(Q1.empty() && Q2.empty() && Q3.empty() && Q4.empty()){ cout << "No point in any quadrant";}
} |
# 2069282, 2024-11-02 10:34:03, -----P---- (10%)
#include<bits/stdc++.h>
using namespace std;
vector<pair<int,int>> v[6];
void solve(int n){
int x1,y1,x2,y2;
x1 = INT_MAX;
y1 = INT_MAX;
x2 = INT_MIN;
y2 = INT_MIN;
for(auto x : v[n]){
x1 = min(x.first,x1);
y1 = min(x.second,y1);
x2 = max(x.first,x2);
y2 = max(x.second,y2);
}
int d = (x2-x1) * (y2-y1);
printf("Q%d: (%d,%d) (%d,%d) %d\n",n,x1,x2,y1,y2,d);
}
int main(){
int n;
cin >> n;
for(int i=0;i<n;i++){
int x,y;
cin >> x >> y;
if(x > 0 && y > 0)v[1].push_back({x,y});
else if(x < 0 && y > 0)v[2].push_back({x,y});
else if(x < 0 && y < 0)v[3].push_back({x,y});
else if(x > 0 && y < 0)v[4].push_back({x,y});
}
int chk = 0;
for(int i = 1;i<=4;i++){
if(v[i].empty()){
chk++;
}else{
solve(i);
}
}
if(chk >= 4) cout << "No point in any quadrant";
return 0;
} | # 2069293, 2024-11-02 10:34:36, -----P---- (10%)
#include<bits/stdc++.h>
using namespace std;
vector<pair<int,int>> v[6];
void solve(int n){
int x1,y1,x2,y2;
x1 = INT_MAX;
y1 = INT_MAX;
x2 = INT_MIN;
y2 = INT_MIN;
for(auto x : v[n]){
x1 = min(x.first,x1);
y1 = min(x.second,y1);
x2 = max(x.first,x2);
y2 = max(x.second,y2);
}
int d = (x2-x1) * (y2-y1);
printf("Q%d: (%d,%d) (%d,%d) %d\n",n,x1,y1,x2,y2,d);
}
int main(){
int n;
cin >> n;
for(int i=0;i<n;i++){
int x,y;
cin >> x >> y;
if(x > 0 && y > 0)v[1].push_back({x,y});
else if(x < 0 && y > 0)v[2].push_back({x,y});
else if(x < 0 && y < 0)v[3].push_back({x,y});
else if(x > 0 && y < 0)v[4].push_back({x,y});
}
int chk = 0;
for(int i = 1;i<=4;i++){
if(v[i].empty()){
chk++;
}else{
solve(i);
}
}
if(chk >= 4) cout << "No point in any quadrant";
return 0;
} | # 2069315, 2024-11-02 10:35:59, PPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
vector<pair<int,int>> v[6];
void solve(int n){
int x1,y1,x2,y2;
x1 = INT_MAX;
y1 = INT_MAX;
x2 = INT_MIN;
y2 = INT_MIN;
for(auto x : v[n]){
x1 = min(x.first,x1);
y1 = min(x.second,y1);
x2 = max(x.first,x2);
y2 = max(x.second,y2);
}
int d = (x2-x1) * (y2-y1);
printf("Q%d: (%d, %d) (%d, %d) %d\n",n,x1,y1,x2,y2,d);
}
int main(){
int n;
cin >> n;
for(int i=0;i<n;i++){
int x,y;
cin >> x >> y;
if(x > 0 && y > 0)v[1].push_back({x,y});
else if(x < 0 && y > 0)v[2].push_back({x,y});
else if(x < 0 && y < 0)v[3].push_back({x,y});
else if(x > 0 && y < 0)v[4].push_back({x,y});
}
int chk = 0;
for(int i = 1;i<=4;i++){
if(v[i].empty()){
chk++;
}else{
solve(i);
}
}
if(chk >= 4) cout << "No point in any quadrant";
return 0;
} |
# 2069429, 2024-11-02 10:45:57, -P-P----P- (30%)
#include<bits/stdc++.h>
#include<cmath>
using namespace std;
int main() {
int n;
cin >> n;
vector<pair<int,int>> point;
int x;
int y;
for(int i=0 ; i<n ; i++) {
cin >> x >> y;
point.push_back(make_pair(x,y));
}
vector<pair<int,int>> q1;
vector<pair<int,int>> q2;
vector<pair<int,int>> q3;
vector<pair<int,int>> q4;
for(auto e : point) {
if(e.first>0 && e.second!=0) {
if(e.second>0) {
q1.push_back(make_pair(e.first,e.second));
}else {
q4.push_back(make_pair(e.first,e.second));
}
}else {
if(e.first<0 && e.second!=0) {
if(e.second>0) {
q2.push_back(make_pair(e.first,e.second));
} else {
q3.push_back(make_pair(e.first,e.second));
}
}
}
}
// for(auto e : q1) {
// cout << e.first << " " << e.second << endl;
// }
int area_q1 = 0;
int area_q2 = 0;
int area_q3 = 0;
int area_q4 = 0;
vector<pair<int,int>> ans_q1;
vector<pair<int,int>> ans_q2;
vector<pair<int,int>> ans_q3;
vector<pair<int,int>> ans_q4;
int min_x1 = 10000000;
int min_y1 = 10000000;
int max_x1 = -10000000;
int max_y1 = -10000000;
for(auto e: q1) {
min_x1 = min(min_x1,e.first);
min_y1 = min(min_y1,e.second);
max_x1 = max(max_x1,e.first);
max_y1 = max(max_y1,e.second);
}
if((min_x1!=10000000) && (min_y1!=10000000) && (max_x1!=-10000000) && (max_y1!=-10000000)) {
ans_q1.push_back(make_pair(min_x1,min_y1));
ans_q1.push_back(make_pair(max_x1,max_y1));
area_q1 = (max_x1-min_x1)*(max_y1-min_y1);
}
for(auto e: ans_q1){
cout<< e.first << " " << e.second << endl;
}
int min_x2 = 10000000;
int min_y2 = 10000000;
int max_x2 = -10000000;
int max_y2 = -10000000;
for(auto e: q2) {
min_x2 = min(min_x2,e.first);
min_y2 = min(min_y2,e.second);
max_x2 = max(max_x2,e.first);
max_y2 = max(max_y2,e.second);
}
if((min_x2!=10000000) && (min_y2!=10000000) && (max_x2!=-10000000) && (max_y2!=-10000000)) {
ans_q2.push_back(make_pair(min_x2,min_y2));
ans_q2.push_back(make_pair(max_x2,max_y2));
area_q2 = (max_x2-min_x2)*(max_y2-min_y2);
}
// for(auto e: ans_q2){
// cout<< e.first << " " << e.second << endl;
// }
int min_x3 = 10000000;
int min_y3 = 10000000;
int max_x3 = -10000000;
int max_y3 = -10000000;
for(auto e: q3) {
min_x3 = min(min_x3,e.first);
min_y3 = min(min_y3,e.second);
max_x3 = max(max_x3,e.first);
max_y3 = max(max_y3,e.second);
}
if((min_x3!=10000000) && (min_y3!=10000000) && (max_x3!=-10000000) && (max_y3!=-10000000)) {
ans_q3.push_back(make_pair(min_x3,min_y3));
ans_q3.push_back(make_pair(max_x3,max_y3));
area_q3 = (max_x3-min_x3)*(max_y3-min_y3);
}
// for(auto e: ans_q3){
// cout<< e.first << " " << e.second << endl;
// }
int min_x4 = 10000000;
int min_y4 = 10000000;
int max_x4 = -10000000;
int max_y4 = -10000000;
for(auto e: q4) {
min_x4 = min(min_x4,e.first);
min_y4 = min(min_y4,e.second);
max_x4 = max(max_x4,e.first);
max_y4 = max(max_y4,e.second);
}
if((min_x4!=10000000) && (min_y4!=10000000) && (max_x4!=-10000000) && (max_y4!=-10000000)) {
ans_q4.push_back(make_pair(min_x4,min_y4));
ans_q4.push_back(make_pair(max_x4,max_y4));
area_q4 = (max_x4-min_x4)*(max_y4-min_y4);
}
// for(auto e: ans_q4){
// cout<< e.first << " " << e.second << endl;
// }
if(ans_q1.size() && ans_q2.size() && ans_q3.size() && ans_q4.size() == 0) {
cout << "No point in any quadrant" << endl;
} else {
if(ans_q1.size()!=0) {
cout << "Q1: ";
for(auto e : ans_q1) {
cout << "(" << e.first << ", " << e.second << ")" << " ";
}
cout << area_q1 << endl;
}
if(ans_q2.size()!=0) {
cout << "Q2: ";
for(auto e : ans_q2) {
cout << "(" << e.first << ", " << e.second << ")" << " ";
}
cout << area_q2 << endl;
}
if(ans_q3.size()!=0) {
cout << "Q3: ";
for(auto e : ans_q3) {
cout << "(" << e.first << ", " << e.second << ")" << " ";
}
cout << area_q3 << endl;
}
if(ans_q4.size()!=0) {
cout << "Q4: ";
for(auto e : ans_q4) {
cout << "(" << e.first << ", " << e.second << ")" << " ";
}
cout << area_q4 << endl;
}
}
} | # 2069465, 2024-11-02 10:49:26, -P-P-P--P- (40%)
#include<bits/stdc++.h>
#include<cmath>
using namespace std;
int main() {
int n;
cin >> n;
vector<pair<int,int>> point;
int x;
int y;
for(int i=0 ; i<n ; i++) {
cin >> x >> y;
point.push_back(make_pair(x,y));
}
vector<pair<int,int>> q1;
vector<pair<int,int>> q2;
vector<pair<int,int>> q3;
vector<pair<int,int>> q4;
for(auto e : point) {
if(e.first>0 && e.second!=0) {
if(e.second>0) {
q1.push_back(make_pair(e.first,e.second));
}else {
q4.push_back(make_pair(e.first,e.second));
}
}else {
if(e.first<0 && e.second!=0) {
if(e.second>0) {
q2.push_back(make_pair(e.first,e.second));
} else {
q3.push_back(make_pair(e.first,e.second));
}
}
}
}
// for(auto e : q1) {
// cout << e.first << " " << e.second << endl;
// }
int area_q1 = 0;
int area_q2 = 0;
int area_q3 = 0;
int area_q4 = 0;
vector<pair<int,int>> ans_q1;
vector<pair<int,int>> ans_q2;
vector<pair<int,int>> ans_q3;
vector<pair<int,int>> ans_q4;
int min_x1 = 10000000;
int min_y1 = 10000000;
int max_x1 = -10000000;
int max_y1 = -10000000;
for(auto e: q1) {
min_x1 = min(min_x1,e.first);
min_y1 = min(min_y1,e.second);
max_x1 = max(max_x1,e.first);
max_y1 = max(max_y1,e.second);
}
if((min_x1!=10000000) && (min_y1!=10000000) && (max_x1!=-10000000) && (max_y1!=-10000000)) {
ans_q1.push_back(make_pair(min_x1,min_y1));
ans_q1.push_back(make_pair(max_x1,max_y1));
area_q1 = (max_x1-min_x1)*(max_y1-min_y1);
}
for(auto e: ans_q1){
cout<< e.first << " " << e.second << endl;
}
int min_x2 = 10000000;
int min_y2 = 10000000;
int max_x2 = -10000000;
int max_y2 = -10000000;
for(auto e: q2) {
min_x2 = min(min_x2,e.first);
min_y2 = min(min_y2,e.second);
max_x2 = max(max_x2,e.first);
max_y2 = max(max_y2,e.second);
}
if((min_x2!=10000000) && (min_y2!=10000000) && (max_x2!=-10000000) && (max_y2!=-10000000)) {
ans_q2.push_back(make_pair(min_x2,min_y2));
ans_q2.push_back(make_pair(max_x2,max_y2));
area_q2 = (max_x2-min_x2)*(max_y2-min_y2);
}
// for(auto e: ans_q2){
// cout<< e.first << " " << e.second << endl;
// }
int min_x3 = 10000000;
int min_y3 = 10000000;
int max_x3 = -10000000;
int max_y3 = -10000000;
for(auto e: q3) {
min_x3 = min(min_x3,e.first);
min_y3 = min(min_y3,e.second);
max_x3 = max(max_x3,e.first);
max_y3 = max(max_y3,e.second);
}
if((min_x3!=10000000) && (min_y3!=10000000) && (max_x3!=-10000000) && (max_y3!=-10000000)) {
ans_q3.push_back(make_pair(min_x3,min_y3));
ans_q3.push_back(make_pair(max_x3,max_y3));
area_q3 = (max_x3-min_x3)*(max_y3-min_y3);
}
// for(auto e: ans_q3){
// cout<< e.first << " " << e.second << endl;
// }
int min_x4 = 10000000;
int min_y4 = 10000000;
int max_x4 = -10000000;
int max_y4 = -10000000;
for(auto e: q4) {
min_x4 = min(min_x4,e.first);
min_y4 = min(min_y4,e.second);
max_x4 = max(max_x4,e.first);
max_y4 = max(max_y4,e.second);
}
if((min_x4!=10000000) && (min_y4!=10000000) && (max_x4!=-10000000) && (max_y4!=-10000000)) {
ans_q4.push_back(make_pair(min_x4,min_y4));
ans_q4.push_back(make_pair(max_x4,max_y4));
area_q4 = (max_x4-min_x4)*(max_y4-min_y4);
}
// for(auto e: ans_q4){
// cout<< e.first << " " << e.second << endl;
// }
if((ans_q1.size()==0) && (ans_q2.size()==0) && (ans_q3.size()==0) && (ans_q4.size()==0)) {
cout << "No point in any quadrant" << endl;
} else {
if(ans_q1.size()!=0) {
cout << "Q1: ";
for(auto e : ans_q1) {
cout << "(" << e.first << ", " << e.second << ")" << " ";
}
cout << area_q1 << endl;
}
if(ans_q2.size()!=0) {
cout << "Q2: ";
for(auto e : ans_q2) {
cout << "(" << e.first << ", " << e.second << ")" << " ";
}
cout << area_q2 << endl;
}
if(ans_q3.size()!=0) {
cout << "Q3: ";
for(auto e : ans_q3) {
cout << "(" << e.first << ", " << e.second << ")" << " ";
}
cout << area_q3 << endl;
}
if(ans_q4.size()!=0) {
cout << "Q4: ";
for(auto e : ans_q4) {
cout << "(" << e.first << ", " << e.second << ")" << " ";
}
cout << area_q4 << endl;
}
}
} | # 2069499, 2024-11-02 10:52:50, PPPPPPPPPP (100%)
#include<bits/stdc++.h>
#include<cmath>
using namespace std;
int main() {
int n;
cin >> n;
vector<pair<int,int>> point;
int x;
int y;
for(int i=0 ; i<n ; i++) {
cin >> x >> y;
point.push_back(make_pair(x,y));
}
vector<pair<int,int>> q1;
vector<pair<int,int>> q2;
vector<pair<int,int>> q3;
vector<pair<int,int>> q4;
for(auto e : point) {
if(e.first>0 && e.second!=0) {
if(e.second>0) {
q1.push_back(make_pair(e.first,e.second));
}else {
q4.push_back(make_pair(e.first,e.second));
}
}else {
if(e.first<0 && e.second!=0) {
if(e.second>0) {
q2.push_back(make_pair(e.first,e.second));
} else {
q3.push_back(make_pair(e.first,e.second));
}
}
}
}
// for(auto e : q1) {
// cout << e.first << " " << e.second << endl;
// }
int area_q1 = 0;
int area_q2 = 0;
int area_q3 = 0;
int area_q4 = 0;
vector<pair<int,int>> ans_q1;
vector<pair<int,int>> ans_q2;
vector<pair<int,int>> ans_q3;
vector<pair<int,int>> ans_q4;
int min_x1 = 10000000;
int min_y1 = 10000000;
int max_x1 = -10000000;
int max_y1 = -10000000;
for(auto e: q1) {
min_x1 = min(min_x1,e.first);
min_y1 = min(min_y1,e.second);
max_x1 = max(max_x1,e.first);
max_y1 = max(max_y1,e.second);
}
if((min_x1!=10000000) && (min_y1!=10000000) && (max_x1!=-10000000) && (max_y1!=-10000000)) {
ans_q1.push_back(make_pair(min_x1,min_y1));
ans_q1.push_back(make_pair(max_x1,max_y1));
area_q1 = (max_x1-min_x1)*(max_y1-min_y1);
}
// for(auto e: ans_q1){
// cout<< e.first << " " << e.second << endl;
// }
int min_x2 = 10000000;
int min_y2 = 10000000;
int max_x2 = -10000000;
int max_y2 = -10000000;
for(auto e: q2) {
min_x2 = min(min_x2,e.first);
min_y2 = min(min_y2,e.second);
max_x2 = max(max_x2,e.first);
max_y2 = max(max_y2,e.second);
}
if((min_x2!=10000000) && (min_y2!=10000000) && (max_x2!=-10000000) && (max_y2!=-10000000)) {
ans_q2.push_back(make_pair(min_x2,min_y2));
ans_q2.push_back(make_pair(max_x2,max_y2));
area_q2 = (max_x2-min_x2)*(max_y2-min_y2);
}
// for(auto e: ans_q2){
// cout<< e.first << " " << e.second << endl;
// }
int min_x3 = 10000000;
int min_y3 = 10000000;
int max_x3 = -10000000;
int max_y3 = -10000000;
for(auto e: q3) {
min_x3 = min(min_x3,e.first);
min_y3 = min(min_y3,e.second);
max_x3 = max(max_x3,e.first);
max_y3 = max(max_y3,e.second);
}
if((min_x3!=10000000) && (min_y3!=10000000) && (max_x3!=-10000000) && (max_y3!=-10000000)) {
ans_q3.push_back(make_pair(min_x3,min_y3));
ans_q3.push_back(make_pair(max_x3,max_y3));
area_q3 = (max_x3-min_x3)*(max_y3-min_y3);
}
// for(auto e: ans_q3){
// cout<< e.first << " " << e.second << endl;
// }
int min_x4 = 10000000;
int min_y4 = 10000000;
int max_x4 = -10000000;
int max_y4 = -10000000;
for(auto e: q4) {
min_x4 = min(min_x4,e.first);
min_y4 = min(min_y4,e.second);
max_x4 = max(max_x4,e.first);
max_y4 = max(max_y4,e.second);
}
if((min_x4!=10000000) && (min_y4!=10000000) && (max_x4!=-10000000) && (max_y4!=-10000000)) {
ans_q4.push_back(make_pair(min_x4,min_y4));
ans_q4.push_back(make_pair(max_x4,max_y4));
area_q4 = (max_x4-min_x4)*(max_y4-min_y4);
}
// for(auto e: ans_q4){
// cout<< e.first << " " << e.second << endl;
// }
if((ans_q1.size()==0) && (ans_q2.size()==0) && (ans_q3.size()==0) && (ans_q4.size()==0)) {
cout << "No point in any quadrant" << endl;
} else {
if(ans_q1.size()!=0) {
cout << "Q1: ";
for(auto e : ans_q1) {
cout << "(" << e.first << ", " << e.second << ")" << " ";
}
cout << area_q1 << endl;
}
if(ans_q2.size()!=0) {
cout << "Q2: ";
for(auto e : ans_q2) {
cout << "(" << e.first << ", " << e.second << ")" << " ";
}
cout << area_q2 << endl;
}
if(ans_q3.size()!=0) {
cout << "Q3: ";
for(auto e : ans_q3) {
cout << "(" << e.first << ", " << e.second << ")" << " ";
}
cout << area_q3 << endl;
}
if(ans_q4.size()!=0) {
cout << "Q4: ";
for(auto e : ans_q4) {
cout << "(" << e.first << ", " << e.second << ")" << " ";
}
cout << area_q4 << endl;
}
return 0;
}
} |
# 2071368, 2024-11-02 14:27:58, -----P---- (10%)
#include <iostream>
#include <vector>
#include <math.h>
#include <cmath>
using namespace std;
int main(){
int n,a,b;
cin>>n;
vector<pair<int,int>> q1;
vector<pair<int,int>> q2;
vector<pair<int,int>> q3;
vector<pair<int,int>> q4;
while(n--){
cin>>a>>b;
if(a==0||b==0){
continue;
} else if(a>0){
if(b>0){
q1.push_back(make_pair(a,b));
} else {
q4.push_back(make_pair(a,b));
}
} else {
if(b>0){
q2.push_back(make_pair(a,b));
} else {
q3.push_back(make_pair(a,b));
}
}
}
if(q1.size()==0&&q2.size()==0&&q3.size()==0&&q4.size()==0){
cout <<"No point in any quadrant";
}
if(q1.size()!=0){
int firstq1,secondq1,maxfirstq1,maxseseq1;
maxfirstq1 = -2000000000;
maxseseq1 = -2000000000;
firstq1 = 2000000000;
secondq1 = 2000000000;
for(auto &e:q1){
if(e.first>maxfirstq1){
maxfirstq1=e.first;
}
if(e.second>maxseseq1){
maxseseq1=e.second;
}
if(e.first<firstq1){
firstq1=e.first;
}
if(e.second<secondq1){
secondq1=e.second;
}
}
int area =abs(maxseseq1-secondq1) * abs(maxfirstq1-firstq1);
cout <<"Q1 : (" <<firstq1<<", " << secondq1 << ") (" << maxfirstq1 << ", " << maxseseq1 << ") " << area<< endl;
}
if(q2.size()!=0){
int firstq1,secondq1,maxfirstq1,maxseseq1;
maxfirstq1 = -2000000000;
maxseseq1 = -2000000000;
firstq1 = 2000000000;
secondq1 = 2000000000;
for(auto &e:q2){
if(e.first>maxfirstq1){
maxfirstq1=e.first;
}
if(e.second>maxseseq1){
maxseseq1=e.second;
}
if(e.first<firstq1){
firstq1=e.first;
}
if(e.second<secondq1){
secondq1=e.second;
}
}
int area =abs(maxseseq1-secondq1) * abs(maxfirstq1-firstq1);
cout <<"Q2 : (" <<firstq1<<", " << secondq1 << ") (" << maxfirstq1 << ", " << maxseseq1 << ") " << area<< endl;
}
if(q3.size()!=0){
int firstq1,secondq1,maxfirstq1,maxseseq1;
maxfirstq1 = -2000000000;
maxseseq1 = -2000000000;
firstq1 = 2000000000;
secondq1 = 2000000000;
for(auto &e:q3){
if(e.first>maxfirstq1){
maxfirstq1=e.first;
}
if(e.second>maxseseq1){
maxseseq1=e.second;
}
if(e.first<firstq1){
firstq1=e.first;
}
if(e.second<secondq1){
secondq1=e.second;
}
}
int area =abs(maxseseq1-secondq1) * abs(maxfirstq1-firstq1);
cout <<"Q3 : (" <<firstq1<<", " << secondq1 << ") (" << maxfirstq1 << ", " << maxseseq1 << ") " << area<< endl;
}
if(q4.size()!=0){
int firstq1,secondq1,maxfirstq1,maxseseq1;
maxfirstq1 = -2000000000;
maxseseq1 = -2000000000;
firstq1 = 2000000000;
secondq1 = 2000000000;
for(auto &e:q4){
if(e.first>maxfirstq1){
maxfirstq1=e.first;
}
if(e.second>maxseseq1){
maxseseq1=e.second;
}
if(e.first<firstq1){
firstq1=e.first;
}
if(e.second<secondq1){
secondq1=e.second;
}
}
int area =abs(maxseseq1-secondq1) * abs(maxfirstq1-firstq1);
cout <<"Q4 : (" <<firstq1<<", " << secondq1 << ") (" << maxfirstq1 << ", " << maxseseq1 << ") " << area<< endl;
}
} | # 2071377, 2024-11-02 14:29:01, P----P---- (20%)
#include <iostream>
#include <vector>
#include <math.h>
#include <cmath>
using namespace std;
int main(){
int n,a,b;
cin>>n;
vector<pair<int,int>> q1;
vector<pair<int,int>> q2;
vector<pair<int,int>> q3;
vector<pair<int,int>> q4;
while(n--){
cin>>a>>b;
if(a==0||b==0){
continue;
} else if(a>0){
if(b>0){
q1.push_back(make_pair(a,b));
} else {
q4.push_back(make_pair(a,b));
}
} else {
if(b>0){
q2.push_back(make_pair(a,b));
} else {
q3.push_back(make_pair(a,b));
}
}
}
if(q1.size()==0&&q2.size()==0&&q3.size()==0&&q4.size()==0){
cout <<"No point in any quadrant";
}
if(q1.size()!=0){
int firstq1,secondq1,maxfirstq1,maxseseq1;
maxfirstq1 = -2000000000;
maxseseq1 = -2000000000;
firstq1 = 2000000000;
secondq1 = 2000000000;
for(auto &e:q1){
if(e.first>maxfirstq1){
maxfirstq1=e.first;
}
if(e.second>maxseseq1){
maxseseq1=e.second;
}
if(e.first<firstq1){
firstq1=e.first;
}
if(e.second<secondq1){
secondq1=e.second;
}
}
int area =abs(maxseseq1-secondq1) * abs(maxfirstq1-firstq1);
cout <<"Q1: (" <<firstq1<<", " << secondq1 << ") (" << maxfirstq1 << ", " << maxseseq1 << ") " << area<< endl;
}
if(q2.size()!=0){
int firstq1,secondq1,maxfirstq1,maxseseq1;
maxfirstq1 = -2000000000;
maxseseq1 = -2000000000;
firstq1 = 2000000000;
secondq1 = 2000000000;
for(auto &e:q2){
if(e.first>maxfirstq1){
maxfirstq1=e.first;
}
if(e.second>maxseseq1){
maxseseq1=e.second;
}
if(e.first<firstq1){
firstq1=e.first;
}
if(e.second<secondq1){
secondq1=e.second;
}
}
int area =abs(maxseseq1-secondq1) * abs(maxfirstq1-firstq1);
cout <<"Q2 : (" <<firstq1<<", " << secondq1 << ") (" << maxfirstq1 << ", " << maxseseq1 << ") " << area<< endl;
}
if(q3.size()!=0){
int firstq1,secondq1,maxfirstq1,maxseseq1;
maxfirstq1 = -2000000000;
maxseseq1 = -2000000000;
firstq1 = 2000000000;
secondq1 = 2000000000;
for(auto &e:q3){
if(e.first>maxfirstq1){
maxfirstq1=e.first;
}
if(e.second>maxseseq1){
maxseseq1=e.second;
}
if(e.first<firstq1){
firstq1=e.first;
}
if(e.second<secondq1){
secondq1=e.second;
}
}
int area =abs(maxseseq1-secondq1) * abs(maxfirstq1-firstq1);
cout <<"Q3: (" <<firstq1<<", " << secondq1 << ") (" << maxfirstq1 << ", " << maxseseq1 << ") " << area<< endl;
}
if(q4.size()!=0){
int firstq1,secondq1,maxfirstq1,maxseseq1;
maxfirstq1 = -2000000000;
maxseseq1 = -2000000000;
firstq1 = 2000000000;
secondq1 = 2000000000;
for(auto &e:q4){
if(e.first>maxfirstq1){
maxfirstq1=e.first;
}
if(e.second>maxseseq1){
maxseseq1=e.second;
}
if(e.first<firstq1){
firstq1=e.first;
}
if(e.second<secondq1){
secondq1=e.second;
}
}
int area =abs(maxseseq1-secondq1) * abs(maxfirstq1-firstq1);
cout <<"Q4: (" <<firstq1<<", " << secondq1 << ") (" << maxfirstq1 << ", " << maxseseq1 << ") " << area<< endl;
}
} | # 2071406, 2024-11-02 14:32:14, PPPPPPPPPP (100%)
#include <iostream>
#include <vector>
#include <math.h>
#include <cmath>
using namespace std;
int main(){
int n,a,b;
cin>>n;
vector<pair<int,int>> q1;
vector<pair<int,int>> q2;
vector<pair<int,int>> q3;
vector<pair<int,int>> q4;
while(n--){
cin>>a>>b;
if(a==0||b==0){
continue;
} else if(a>0){
if(b>0){
q1.push_back(make_pair(a,b));
} else {
q4.push_back(make_pair(a,b));
}
} else {
if(b>0){
q2.push_back(make_pair(a,b));
} else {
q3.push_back(make_pair(a,b));
}
}
}
if(q1.size()==0&&q2.size()==0&&q3.size()==0&&q4.size()==0){
cout <<"No point in any quadrant";
}
if(q1.size()!=0){
int firstq1,secondq1,maxfirstq1,maxseseq1;
maxfirstq1 = -2000000000;
maxseseq1 = -2000000000;
firstq1 = 2000000000;
secondq1 = 2000000000;
for(auto &e:q1){
if(e.first>maxfirstq1){
maxfirstq1=e.first;
}
if(e.second>maxseseq1){
maxseseq1=e.second;
}
if(e.first<firstq1){
firstq1=e.first;
}
if(e.second<secondq1){
secondq1=e.second;
}
}
int area =abs(maxseseq1-secondq1) * abs(maxfirstq1-firstq1);
cout <<"Q1: (" <<firstq1<<", " << secondq1 << ") (" << maxfirstq1 << ", " << maxseseq1 << ") " << area<< endl;
}
if(q2.size()!=0){
int firstq1,secondq1,maxfirstq1,maxseseq1;
maxfirstq1 = -2000000000;
maxseseq1 = -2000000000;
firstq1 = 2000000000;
secondq1 = 2000000000;
for(auto &e:q2){
if(e.first>maxfirstq1){
maxfirstq1=e.first;
}
if(e.second>maxseseq1){
maxseseq1=e.second;
}
if(e.first<firstq1){
firstq1=e.first;
}
if(e.second<secondq1){
secondq1=e.second;
}
}
int area =abs(maxseseq1-secondq1) * abs(maxfirstq1-firstq1);
cout <<"Q2: (" <<firstq1<<", " << secondq1 << ") (" << maxfirstq1 << ", " << maxseseq1 << ") " << area<< endl;
}
if(q3.size()!=0){
int firstq1,secondq1,maxfirstq1,maxseseq1;
maxfirstq1 = -2000000000;
maxseseq1 = -2000000000;
firstq1 = 2000000000;
secondq1 = 2000000000;
for(auto &e:q3){
if(e.first>maxfirstq1){
maxfirstq1=e.first;
}
if(e.second>maxseseq1){
maxseseq1=e.second;
}
if(e.first<firstq1){
firstq1=e.first;
}
if(e.second<secondq1){
secondq1=e.second;
}
}
int area =abs(maxseseq1-secondq1) * abs(maxfirstq1-firstq1);
cout <<"Q3: (" <<firstq1<<", " << secondq1 << ") (" << maxfirstq1 << ", " << maxseseq1 << ") " << area<< endl;
}
if(q4.size()!=0){
int firstq1,secondq1,maxfirstq1,maxseseq1;
maxfirstq1 = -2000000000;
maxseseq1 = -2000000000;
firstq1 = 2000000000;
secondq1 = 2000000000;
for(auto &e:q4){
if(e.first>maxfirstq1){
maxfirstq1=e.first;
}
if(e.second>maxseseq1){
maxseseq1=e.second;
}
if(e.first<firstq1){
firstq1=e.first;
}
if(e.second<secondq1){
secondq1=e.second;
}
}
int area =abs(maxseseq1-secondq1) * abs(maxfirstq1-firstq1);
cout <<"Q4: (" <<firstq1<<", " << secondq1 << ") (" << maxfirstq1 << ", " << maxseseq1 << ") " << area<< endl;
}
} |
# 2071380, 2024-11-02 14:29:26, xxxxPxPPxP (40%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;cin >> n;
int x;
int y;
vector<int> q1x;
vector<int> q1y;
vector<int> q2x;
vector<int> q2y;
vector<int> q3x;
vector<int> q3y;
vector<int> q4x;
vector<int> q4y;
for(int i = 0;i< n;i++){
cin >> x;
cin >> y;
if( x==0 || y==0){
continue;
}
else if(x > 0 && y > 0){
q1x.push_back(x);
q1y.push_back(y);
}
else if(x < 0 && y > 0){
q2x.push_back(x);
q2y.push_back(y);
}
else if(x > 0 && y < 0){
q4x.push_back(x);
q4y.push_back(y);
}
else if(x < 0 && y < 0){
q3x.push_back(x);
q3y.push_back(y);
}
}
sort(q1x.begin(),q1x.end());
sort(q1y.begin(),q1y.end());
sort(q2x.begin(),q2x.end());
sort(q2y.begin(),q2y.end());
sort(q3x.begin(),q3x.end());
sort(q3y.begin(),q3y.end());
sort(q4x.begin(),q4x.end());
sort(q4y.begin(),q4y.end());
int m1;
int m2;
int m3;
int m4;
int mx1 = q1x.size()-1;
int my1 = q1y.size()-1;
m1 = (q1x[mx1]-q1x[0])*(q1y[my1]-q1y[0]);
int mx2 = q2x.size()-1;
int my2 = q2y.size()-1;
m2 = (q2x[mx2]-q2x[0])*(q2y[my2]-q2y[0]);
int mx3 = q3x.size()-1;
int my3 = q3y.size()-1;
m3 = (q3x[mx3]-q3x[0])*(q3y[my3]-q3y[0]);
int mx4 = q4x.size()-1;
int my4 = q4y.size()-1;
m4 = (q4x[mx4]-q4x[0])*(q4y[my4]-q4y[0]);
cout << "Q1: ";
cout << "(" << q1x[0] <<", " << q1y[0] << ") ";
cout << "(" << q1x[mx1] <<", " << q1y[my1] << ") ";
cout << m1 <<endl;
cout << "Q2: ";
cout << "(" << q2x[0] <<", " << q2y[0] << ") ";
cout << "(" << q2x[mx2] <<", " << q2y[my2] << ") ";
cout << m2 <<endl;
cout << "Q3: ";
cout << "(" << q3x[0] <<", " << q3y[0] << ") ";
cout << "(" << q3x[mx3] <<", " << q3y[my3] << ") ";
cout << m3 <<endl;
cout << "Q4: ";
cout << "(" << q4x[0] <<", " << q4y[0] << ") ";
cout << "(" << q4x[mx4] <<", " << q4y[my4]<< ") ";
cout << m4 <<endl;
} | # 2071452, 2024-11-02 14:36:50, Compilation error (0%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;cin >> n;
int x;
int y;
vector<int> q1x;
vector<int> q1y;
vector<int> q2x;
vector<int> q2y;
vector<int> q3x;
vector<int> q3y;
vector<int> q4x;
vector<int> q4y;
bool me1 = false;
bool me2 = false;
bool me3 = false;
bool me4 = false;
for(int i = 0;i< n;i++){
cin >> x;
cin >> y;
if( x==0 || y==0){
continue;
}
else if(x > 0 && y > 0){
q1x.push_back(x);
q1y.push_back(y);
me1 = true;
}
else if(x < 0 && y > 0){
q2x.push_back(x);
q2y.push_back(y);
me2 = true;
}
else if(x > 0 && y < 0){
q4x.push_back(x);
q4y.push_back(y);
me4 = true;
}
else if(x < 0 && y < 0){
q3x.push_back(x);
q3y.push_back(y);
me3 = true;
}
}
sort(q1x.begin(),q1x.end());
sort(q1y.begin(),q1y.end());
sort(q2x.begin(),q2x.end());
sort(q2y.begin(),q2y.end());
sort(q3x.begin(),q3x.end());
sort(q3y.begin(),q3y.end());
sort(q4x.begin(),q4x.end());
sort(q4y.begin(),q4y.end());
int m1;
int m2;
int m3;
int m4;
if(me1){
int mx1 = q1x.size()-1;
int my1 = q1y.size()-1;
m1 = (q1x[mx1]-q1x[0])*(q1y[my1]-q1y[0]);
}
if(me2){
int mx2 = q2x.size()-1;
int my2 = q2y.size()-1;
m2 = (q2x[mx2]-q2x[0])*(q2y[my2]-q2y[0]);
}
if(me3){
int mx3 = q3x.size()-1;
int my3 = q3y.size()-1;
m3 = (q3x[mx3]-q3x[0])*(q3y[my3]-q3y[0]);
}
if(me4){
int mx4 = q4x.size()-1;
int my4 = q4y.size()-1;
m4 = (q4x[mx4]-q4x[0])*(q4y[my4]-q4y[0]);
}
if(me1){
cout << "Q1: ";
cout << "(" << q1x[0] <<", " << q1y[0] << ") ";
cout << "(" << q1x[mx1] <<", " << q1y[my1] << ") ";
cout << m1 <<endl;
}
if(me2){
cout << "Q2: ";
cout << "(" << q2x[0] <<", " << q2y[0] << ") ";
cout << "(" << q2x[mx2] <<", " << q2y[my2] << ") ";
cout << m2 <<endl;
}
if(me3){
cout << "Q3: ";
cout << "(" << q3x[0] <<", " << q3y[0] << ") ";
cout << "(" << q3x[mx3] <<", " << q3y[my3] << ") ";
cout << m3 <<endl;
}
if(me4){
cout << "Q4: ";
cout << "(" << q4x[0] <<", " << q4y[0] << ") ";
cout << "(" << q4x[mx4] <<", " << q4y[my4]<< ") ";
cout << m4 <<endl;
}
if(!(me1||me2||me3||me4)){
cout << "No point in any quadrant" ;
}
} | # 2071471, 2024-11-02 14:38:35, PPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;cin >> n;
int x;
int y;
vector<int> q1x;
vector<int> q1y;
vector<int> q2x;
vector<int> q2y;
vector<int> q3x;
vector<int> q3y;
vector<int> q4x;
vector<int> q4y;
bool me1 = false;
bool me2 = false;
bool me3 = false;
bool me4 = false;
for(int i = 0;i< n;i++){
cin >> x;
cin >> y;
if( x==0 || y==0){
continue;
}
else if(x > 0 && y > 0){
q1x.push_back(x);
q1y.push_back(y);
me1 = true;
}
else if(x < 0 && y > 0){
q2x.push_back(x);
q2y.push_back(y);
me2 = true;
}
else if(x > 0 && y < 0){
q4x.push_back(x);
q4y.push_back(y);
me4 = true;
}
else if(x < 0 && y < 0){
q3x.push_back(x);
q3y.push_back(y);
me3 = true;
}
}
sort(q1x.begin(),q1x.end());
sort(q1y.begin(),q1y.end());
sort(q2x.begin(),q2x.end());
sort(q2y.begin(),q2y.end());
sort(q3x.begin(),q3x.end());
sort(q3y.begin(),q3y.end());
sort(q4x.begin(),q4x.end());
sort(q4y.begin(),q4y.end());
int m1;
int m2;
int m3;
int m4;
int mx1;
int my1;
int mx2;
int my2;
int mx3;
int my3;
int mx4;
int my4;
if(me1){
mx1 = q1x.size()-1;
my1 = q1y.size()-1;
m1 = (q1x[mx1]-q1x[0])*(q1y[my1]-q1y[0]);
}
if(me2){
mx2 = q2x.size()-1;
my2 = q2y.size()-1;
m2 = (q2x[mx2]-q2x[0])*(q2y[my2]-q2y[0]);
}
if(me3){
mx3 = q3x.size()-1;
my3 = q3y.size()-1;
m3 = (q3x[mx3]-q3x[0])*(q3y[my3]-q3y[0]);
}
if(me4){
mx4 = q4x.size()-1;
my4 = q4y.size()-1;
m4 = (q4x[mx4]-q4x[0])*(q4y[my4]-q4y[0]);
}
if(me1){
cout << "Q1: ";
cout << "(" << q1x[0] <<", " << q1y[0] << ") ";
cout << "(" << q1x[mx1] <<", " << q1y[my1] << ") ";
cout << m1 <<endl;
}
if(me2){
cout << "Q2: ";
cout << "(" << q2x[0] <<", " << q2y[0] << ") ";
cout << "(" << q2x[mx2] <<", " << q2y[my2] << ") ";
cout << m2 <<endl;
}
if(me3){
cout << "Q3: ";
cout << "(" << q3x[0] <<", " << q3y[0] << ") ";
cout << "(" << q3x[mx3] <<", " << q3y[my3] << ") ";
cout << m3 <<endl;
}
if(me4){
cout << "Q4: ";
cout << "(" << q4x[0] <<", " << q4y[0] << ") ";
cout << "(" << q4x[mx4] <<", " << q4y[my4]<< ") ";
cout << m4 <<endl;
}
if(!(me1||me2||me3||me4)){
cout << "No point in any quadrant" ;
}
} |
# 2068911, 2024-11-02 09:53:04, -----P---- (10%)
#include<iostream>
#include<vector>
using namespace std;
int main(){
int n; cin >> n;
vector<int> mx_x(5,-1e9),mn_x(5,1e9);
vector<int> mx_y(5,-1e9),mn_y(5,1e9);
vector<int> cnt(5,0);
for(int i=0;i<n;i++){
int x,y; cin >> x >> y;
if(x > 0 && y > 0){ // q1
mx_x[1] = max(mx_x[1],x);
mn_x[1] = min(mn_x[1],x);
mx_y[1] = max(mx_y[1],y);
mn_y[1] = min(mn_y[1],y);
cnt[1] ++;
}else if(x < 0 && y > 0){ // q2
mx_x[2] = max(mx_x[2],x);
mn_x[2] = min(mn_x[2],x);
mx_y[2] = max(mx_y[2],y);
mn_y[2] = min(mn_y[2],y);
cnt[2] ++;
}else if(x < 0 && y < 0){ // q3
mx_x[3] = max(mx_x[3],x);
mn_x[3] = min(mn_x[3],x);
mx_y[3] = max(mx_y[3],y);
mn_y[3] = min(mn_y[3],y);
cnt[3] ++;
}else if(x > 0 && y < 0){ // q4
mx_x[4] = max(mx_x[4],x);
mn_x[4] = min(mn_x[4],x);
mx_y[4] = max(mx_y[4],y);
mn_y[4] = min(mn_y[4],y);
cnt[4] ++;
}
}
if(cnt[1] >= 2){
cout << "Q1: ";
cout << "(" << mn_x[1]<< "," << mn_y[1] << ") ";
cout << "(" << mx_x[1] << "," << mx_y[1] << ") ";
cout << (mx_y[1]-mn_y[1])*(mx_x[1]-mn_x[1]) << "\n";
}
if(cnt[2] >= 2){
cout << "Q2: ";
cout << "(" << mn_x[2]<< "," << mn_y[2] << ") ";
cout << "(" << mx_x[2] << "," << mx_y[2] << ") ";
cout << (mx_y[2]-mn_y[2])*(mx_x[2]-mn_x[2]) << "\n";
}
if(cnt[3] >= 2){
cout << "Q3: ";
cout << "(" << mn_x[3]<< "," << mn_y[3] << ") ";
cout << "(" << mx_x[3] << "," << mx_y[3] << ") ";
cout << (mx_y[3]-mn_y[3])*(mx_x[3]-mn_x[3]) << "\n";
}
if(cnt[4] >= 2){
cout << "Q4: ";
cout << "(" << mn_x[4]<< "," << mn_y[4] << ") ";
cout << "(" << mx_x[4] << "," << mx_y[4] << ") ";
cout << (mx_y[4]-mn_y[4])*(mx_x[4]-mn_x[4]) << "\n";
}
if(cnt[1] <= 1 && cnt[2] <= 1 && cnt[3] <= 1 && cnt[4] <= 1) cout << "No point in any quadrant";
return 0;
}
/*
19
2 2
4 6
5 5
1 0
-1 2
-3 4
-2 6
0 -3
-5 7
-4 5
-6 3
0 4
-2 -2
-5 -6
-7 0
6 -4
4 -6
3 -2
2 -5
*/ | # 2068924, 2024-11-02 09:53:58, PPPP-PP-PP (80%)
#include<iostream>
#include<vector>
using namespace std;
int main(){
int n; cin >> n;
vector<int> mx_x(5,-1e9),mn_x(5,1e9);
vector<int> mx_y(5,-1e9),mn_y(5,1e9);
vector<int> cnt(5,0);
for(int i=0;i<n;i++){
int x,y; cin >> x >> y;
if(x > 0 && y > 0){ // q1
mx_x[1] = max(mx_x[1],x);
mn_x[1] = min(mn_x[1],x);
mx_y[1] = max(mx_y[1],y);
mn_y[1] = min(mn_y[1],y);
cnt[1] ++;
}else if(x < 0 && y > 0){ // q2
mx_x[2] = max(mx_x[2],x);
mn_x[2] = min(mn_x[2],x);
mx_y[2] = max(mx_y[2],y);
mn_y[2] = min(mn_y[2],y);
cnt[2] ++;
}else if(x < 0 && y < 0){ // q3
mx_x[3] = max(mx_x[3],x);
mn_x[3] = min(mn_x[3],x);
mx_y[3] = max(mx_y[3],y);
mn_y[3] = min(mn_y[3],y);
cnt[3] ++;
}else if(x > 0 && y < 0){ // q4
mx_x[4] = max(mx_x[4],x);
mn_x[4] = min(mn_x[4],x);
mx_y[4] = max(mx_y[4],y);
mn_y[4] = min(mn_y[4],y);
cnt[4] ++;
}
}
if(cnt[1] >= 2){
cout << "Q1: ";
cout << "(" << mn_x[1]<< ", " << mn_y[1] << ") ";
cout << "(" << mx_x[1] << ", " << mx_y[1] << ") ";
cout << (mx_y[1]-mn_y[1])*(mx_x[1]-mn_x[1]) << "\n";
}
if(cnt[2] >= 2){
cout << "Q2: ";
cout << "(" << mn_x[2]<< ", " << mn_y[2] << ") ";
cout << "(" << mx_x[2] << ", " << mx_y[2] << ") ";
cout << (mx_y[2]-mn_y[2])*(mx_x[2]-mn_x[2]) << "\n";
}
if(cnt[3] >= 2){
cout << "Q3: ";
cout << "(" << mn_x[3]<< ", " << mn_y[3] << ") ";
cout << "(" << mx_x[3] << ", " << mx_y[3] << ") ";
cout << (mx_y[3]-mn_y[3])*(mx_x[3]-mn_x[3]) << "\n";
}
if(cnt[4] >= 2){
cout << "Q4: ";
cout << "(" << mn_x[4]<< ", " << mn_y[4] << ") ";
cout << "(" << mx_x[4] << ", " << mx_y[4] << ") ";
cout << (mx_y[4]-mn_y[4])*(mx_x[4]-mn_x[4]) << "\n";
}
if(cnt[1] <= 1 && cnt[2] <= 1 && cnt[3] <= 1 && cnt[4] <= 1) cout << "No point in any quadrant";
return 0;
}
/*
19
2 2
4 6
5 5
1 0
-1 2
-3 4
-2 6
0 -3
-5 7
-4 5
-6 3
0 4
-2 -2
-5 -6
-7 0
6 -4
4 -6
3 -2
2 -5
*/ | # 2068932, 2024-11-02 09:55:14, PPPPPPPPPP (100%)
#include<iostream>
#include<vector>
using namespace std;
int main(){
int n; cin >> n;
vector<int> mx_x(5,-1e9),mn_x(5,1e9);
vector<int> mx_y(5,-1e9),mn_y(5,1e9);
vector<int> cnt(5,0);
for(int i=0;i<n;i++){
int x,y; cin >> x >> y;
if(x > 0 && y > 0){ // q1
mx_x[1] = max(mx_x[1],x);
mn_x[1] = min(mn_x[1],x);
mx_y[1] = max(mx_y[1],y);
mn_y[1] = min(mn_y[1],y);
cnt[1] ++;
}else if(x < 0 && y > 0){ // q2
mx_x[2] = max(mx_x[2],x);
mn_x[2] = min(mn_x[2],x);
mx_y[2] = max(mx_y[2],y);
mn_y[2] = min(mn_y[2],y);
cnt[2] ++;
}else if(x < 0 && y < 0){ // q3
mx_x[3] = max(mx_x[3],x);
mn_x[3] = min(mn_x[3],x);
mx_y[3] = max(mx_y[3],y);
mn_y[3] = min(mn_y[3],y);
cnt[3] ++;
}else if(x > 0 && y < 0){ // q4
mx_x[4] = max(mx_x[4],x);
mn_x[4] = min(mn_x[4],x);
mx_y[4] = max(mx_y[4],y);
mn_y[4] = min(mn_y[4],y);
cnt[4] ++;
}
}
if(cnt[1] >= 1){
cout << "Q1: ";
cout << "(" << mn_x[1]<< ", " << mn_y[1] << ") ";
cout << "(" << mx_x[1] << ", " << mx_y[1] << ") ";
cout << (mx_y[1]-mn_y[1])*(mx_x[1]-mn_x[1]) << "\n";
}
if(cnt[2] >= 1){
cout << "Q2: ";
cout << "(" << mn_x[2]<< ", " << mn_y[2] << ") ";
cout << "(" << mx_x[2] << ", " << mx_y[2] << ") ";
cout << (mx_y[2]-mn_y[2])*(mx_x[2]-mn_x[2]) << "\n";
}
if(cnt[3] >= 1){
cout << "Q3: ";
cout << "(" << mn_x[3]<< ", " << mn_y[3] << ") ";
cout << "(" << mx_x[3] << ", " << mx_y[3] << ") ";
cout << (mx_y[3]-mn_y[3])*(mx_x[3]-mn_x[3]) << "\n";
}
if(cnt[4] >= 1){
cout << "Q4: ";
cout << "(" << mn_x[4]<< ", " << mn_y[4] << ") ";
cout << "(" << mx_x[4] << ", " << mx_y[4] << ") ";
cout << (mx_y[4]-mn_y[4])*(mx_x[4]-mn_x[4]) << "\n";
}
if(cnt[1] == 0 && cnt[2] == 0 && cnt[3] == 0 && cnt[4] == 0) cout << "No point in any quadrant";
return 0;
}
/*
19
2 2
4 6
5 5
1 0
-1 2
-3 4
-2 6
0 -3
-5 7
-4 5
-6 3
0 4
-2 -2
-5 -6
-7 0
6 -4
4 -6
3 -2
2 -5
*/ |
# 2069611, 2024-11-02 11:03:31, PPP--P---- (40%)
#include <bits/stdc++.h>
using namespace std;
struct sq
{
int x1;
int x2;
int y1;
int y2;
};
bool q1[10000][10000];
bool q2[10000][10000];
bool q3[10000][10000];
bool q4[10000][10000];
unordered_map<string, sq> ump;
void setup()
{
string q = "";
for (int i = 1; i <= 4; i++)
{
q += "q";
q += to_string(i);
ump[q].x1 = INT_MAX;
ump[q].x2 = INT_MIN;
ump[q].y1 = INT_MAX;
ump[q].y2 = INT_MIN;
q = "";
}
}
int main()
{
setup();
int n;
cin >> n;
for (int i = 0; i < n; i++)
{
int x, y;
cin >> x >> y;
if (x > 0 && y > 0)
{
// q1[x][y] = true;
ump["q1"].x1 = min(ump["q1"].x1, x);
ump["q1"].x2 = max(ump["q1"].x2, x);
ump["q1"].y1 = min(ump["q1"].y1, y);
ump["q1"].y2 = max(ump["q1"].y2, y);
}
else if (x < 0 && y > 0)
{
ump["q2"].x1 = min(ump["q2"].x1, x);
ump["q2"].x2 = max(ump["q2"].x2, x);
ump["q2"].y1 = min(ump["q2"].y1, y);
ump["q2"].y2 = max(ump["q2"].y2, y);
// cout <<"THIS: " << ump["q1"].x2 <<" " << x << endl;
}
else if (x < 0 && y < 0)
{
ump["q3"].x1 = min(ump["q3"].x1, x);
ump["q3"].x2 = max(ump["q3"].x2, x);
ump["q3"].y1 = min(ump["q3"].y1, y);
ump["q3"].y2 = max(ump["q3"].y2, y);
// cout <<"THIS: " << ump["q1"].x2 <<" " << x << endl;
}
else if (x > 0 && y < 0)
{
ump["q4"].x1 = min(ump["q4"].x1, x);
ump["q4"].x2 = max(ump["q4"].x2, x);
ump["q4"].y1 = min(ump["q4"].y1, y);
ump["q4"].y2 = max(ump["q4"].y2, y);
// cout <<"THIS: " << ump["q1"].x2 <<" " << x << endl;
}
}
int area;
bool flag = false;
if (ump["q1"].x1 != INT_MAX && ump["q1"].x2 != INT_MIN && ump["q1"].y1 != INT_MAX && ump["q1"].y2 != INT_MIN)
{
flag = true;
area = (ump["q1"].y2 - ump["q1"].y1) * (ump["q1"].x2 - ump["q1"].x1);
printf("Q1: (%d, %d) (%d, %d) %d\n", ump["q1"].x1, ump["q1"].y1, ump["q1"].x2, ump["q1"].y2, area);
}
if (ump["q2"].x1 != INT_MAX && ump["q2"].x2 != INT_MIN && ump["q2"].y1 != INT_MAX && ump["q2"].y2 != INT_MIN)
{
flag = true;
area = abs(ump["q2"].y2 - ump["q2"].y1) * abs(ump["q2"].x2 - ump["q2"].x1);
printf("Q2: (%d, %d) (%d, %d) %d\n", ump["q2"].x1, ump["q2"].y1, ump["q2"].x2, ump["q2"].y2, area);
}
if(!flag){
cout << "No point in any quadrant";
}
return 0;
} | # 2069622, 2024-11-02 11:04:37, PPPP-P---- (50%)
#include <bits/stdc++.h>
using namespace std;
struct sq
{
int x1;
int x2;
int y1;
int y2;
};
bool q1[10000][10000];
bool q2[10000][10000];
bool q3[10000][10000];
bool q4[10000][10000];
unordered_map<string, sq> ump;
void setup()
{
string q = "";
for (int i = 1; i <= 4; i++)
{
q += "q";
q += to_string(i);
ump[q].x1 = INT_MAX;
ump[q].x2 = INT_MIN;
ump[q].y1 = INT_MAX;
ump[q].y2 = INT_MIN;
q = "";
}
}
int main()
{
setup();
int n;
cin >> n;
for (int i = 0; i < n; i++)
{
int x, y;
cin >> x >> y;
if (x > 0 && y > 0)
{
// q1[x][y] = true;
ump["q1"].x1 = min(ump["q1"].x1, x);
ump["q1"].x2 = max(ump["q1"].x2, x);
ump["q1"].y1 = min(ump["q1"].y1, y);
ump["q1"].y2 = max(ump["q1"].y2, y);
}
else if (x < 0 && y > 0)
{
ump["q2"].x1 = min(ump["q2"].x1, x);
ump["q2"].x2 = max(ump["q2"].x2, x);
ump["q2"].y1 = min(ump["q2"].y1, y);
ump["q2"].y2 = max(ump["q2"].y2, y);
// cout <<"THIS: " << ump["q1"].x2 <<" " << x << endl;
}
else if (x < 0 && y < 0)
{
ump["q3"].x1 = min(ump["q3"].x1, x);
ump["q3"].x2 = max(ump["q3"].x2, x);
ump["q3"].y1 = min(ump["q3"].y1, y);
ump["q3"].y2 = max(ump["q3"].y2, y);
// cout <<"THIS: " << ump["q1"].x2 <<" " << x << endl;
}
else if (x > 0 && y < 0)
{
ump["q4"].x1 = min(ump["q4"].x1, x);
ump["q4"].x2 = max(ump["q4"].x2, x);
ump["q4"].y1 = min(ump["q4"].y1, y);
ump["q4"].y2 = max(ump["q4"].y2, y);
// cout <<"THIS: " << ump["q1"].x2 <<" " << x << endl;
}
}
int area;
bool flag = false;
if (ump["q1"].x1 != INT_MAX && ump["q1"].x2 != INT_MIN && ump["q1"].y1 != INT_MAX && ump["q1"].y2 != INT_MIN)
{
flag = true;
area = (ump["q1"].y2 - ump["q1"].y1) * (ump["q1"].x2 - ump["q1"].x1);
printf("Q1: (%d, %d) (%d, %d) %d\n", ump["q1"].x1, ump["q1"].y1, ump["q1"].x2, ump["q1"].y2, area);
}
if (ump["q2"].x1 != INT_MAX && ump["q2"].x2 != INT_MIN && ump["q2"].y1 != INT_MAX && ump["q2"].y2 != INT_MIN)
{
flag = true;
area = abs(ump["q2"].y2 - ump["q2"].y1) * abs(ump["q2"].x2 - ump["q2"].x1);
printf("Q2: (%d, %d) (%d, %d) %d\n", ump["q2"].x1, ump["q2"].y1, ump["q2"].x2, ump["q2"].y2, area);
}
if (ump["q3"].x1 != INT_MAX && ump["q3"].x2 != INT_MIN && ump["q3"].y1 != INT_MAX && ump["q3"].y2 != INT_MIN)
{
flag = true;
area = abs(ump["q3"].y2 - ump["q3"].y1) * abs(ump["q3"].x2 - ump["q3"].x1);
printf("Q3: (%d, %d) (%d, %d) %d\n", ump["q3"].x1, ump["q3"].y1, ump["q3"].x2, ump["q3"].y2, area);
}
if (!flag)
{
cout << "No point in any quadrant";
}
return 0;
} | # 2069632, 2024-11-02 11:05:36, PPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std;
struct sq
{
int x1;
int x2;
int y1;
int y2;
};
bool q1[10000][10000];
bool q2[10000][10000];
bool q3[10000][10000];
bool q4[10000][10000];
unordered_map<string, sq> ump;
void setup()
{
string q = "";
for (int i = 1; i <= 4; i++)
{
q += "q";
q += to_string(i);
ump[q].x1 = INT_MAX;
ump[q].x2 = INT_MIN;
ump[q].y1 = INT_MAX;
ump[q].y2 = INT_MIN;
q = "";
}
}
int main()
{
setup();
int n;
cin >> n;
for (int i = 0; i < n; i++)
{
int x, y;
cin >> x >> y;
if (x > 0 && y > 0)
{
// q1[x][y] = true;
ump["q1"].x1 = min(ump["q1"].x1, x);
ump["q1"].x2 = max(ump["q1"].x2, x);
ump["q1"].y1 = min(ump["q1"].y1, y);
ump["q1"].y2 = max(ump["q1"].y2, y);
}
else if (x < 0 && y > 0)
{
ump["q2"].x1 = min(ump["q2"].x1, x);
ump["q2"].x2 = max(ump["q2"].x2, x);
ump["q2"].y1 = min(ump["q2"].y1, y);
ump["q2"].y2 = max(ump["q2"].y2, y);
// cout <<"THIS: " << ump["q1"].x2 <<" " << x << endl;
}
else if (x < 0 && y < 0)
{
ump["q3"].x1 = min(ump["q3"].x1, x);
ump["q3"].x2 = max(ump["q3"].x2, x);
ump["q3"].y1 = min(ump["q3"].y1, y);
ump["q3"].y2 = max(ump["q3"].y2, y);
// cout <<"THIS: " << ump["q1"].x2 <<" " << x << endl;
}
else if (x > 0 && y < 0)
{
ump["q4"].x1 = min(ump["q4"].x1, x);
ump["q4"].x2 = max(ump["q4"].x2, x);
ump["q4"].y1 = min(ump["q4"].y1, y);
ump["q4"].y2 = max(ump["q4"].y2, y);
// cout <<"THIS: " << ump["q1"].x2 <<" " << x << endl;
}
}
int area;
bool flag = false;
if (ump["q1"].x1 != INT_MAX && ump["q1"].x2 != INT_MIN && ump["q1"].y1 != INT_MAX && ump["q1"].y2 != INT_MIN)
{
flag = true;
area = (ump["q1"].y2 - ump["q1"].y1) * (ump["q1"].x2 - ump["q1"].x1);
printf("Q1: (%d, %d) (%d, %d) %d\n", ump["q1"].x1, ump["q1"].y1, ump["q1"].x2, ump["q1"].y2, area);
}
if (ump["q2"].x1 != INT_MAX && ump["q2"].x2 != INT_MIN && ump["q2"].y1 != INT_MAX && ump["q2"].y2 != INT_MIN)
{
flag = true;
area = abs(ump["q2"].y2 - ump["q2"].y1) * abs(ump["q2"].x2 - ump["q2"].x1);
printf("Q2: (%d, %d) (%d, %d) %d\n", ump["q2"].x1, ump["q2"].y1, ump["q2"].x2, ump["q2"].y2, area);
}
if (ump["q3"].x1 != INT_MAX && ump["q3"].x2 != INT_MIN && ump["q3"].y1 != INT_MAX && ump["q3"].y2 != INT_MIN)
{
flag = true;
area = abs(ump["q3"].y2 - ump["q3"].y1) * abs(ump["q3"].x2 - ump["q3"].x1);
printf("Q3: (%d, %d) (%d, %d) %d\n", ump["q3"].x1, ump["q3"].y1, ump["q3"].x2, ump["q3"].y2, area);
}
if (ump["q4"].x1 != INT_MAX && ump["q4"].x2 != INT_MIN && ump["q4"].y1 != INT_MAX && ump["q4"].y2 != INT_MIN)
{
flag = true;
area = abs(ump["q4"].y2 - ump["q4"].y1) * abs(ump["q4"].x2 - ump["q4"].x1);
printf("Q4: (%d, %d) (%d, %d) %d\n", ump["q4"].x1, ump["q4"].y1, ump["q4"].x2, ump["q4"].y2, area);
}
if (!flag)
{
cout << "No point in any quadrant";
}
return 0;
} |
# 2069840, 2024-11-02 11:29:17, -----P---- (10%)
#include<iostream>
#include<vector>
#include<algorithm>
#include<utility>
int main ( ) {
float n = 0 , x = 0 , y = 0 ;
std::vector<std::pair<float , float>> q1 = {} , q2 = {}, q3 = {}, q4 = {};
std::cin >> n ;
for ( float i = 0 ; i < n ; i++ ){
std::cin >> x >> y ;
std::pair<float , float > xy = { x , y } ;
if ( x == 0 || y == 0 ){
continue ;
}else if ( x > 0 && y > 0 ){
q1.push_back( xy ) ;
}else if ( x < 0 && y > 0 ){
q2.push_back( xy ) ;
}else if ( x < 0 && y < 0 ){
q3.push_back( xy ) ;
}else if ( x > 0 && y < 0 ){
q4.push_back( xy ) ;
}
}
float arq1 = 0 , arq2 = 0 , arq3 = 0 , arq4 = 0 ;
std::sort( q1.begin() , q1.end() ) ;
std::sort( q2.begin() , q2.end() ) ;
std::sort( q3.begin() , q3.end() ) ;
std::sort( q4.begin() , q4.end() ) ;
bool noone = false ;
if ( q1.size( ) >= 2 ){
noone = true ;
arq1 = ( q1[( q1.size() - 1 ) ].first - q1[0].first ) * ( q1[( q1.size() - 1 ) ].second - q1[0].second ) ;
std::cout << "Q1: (" << q1[0].first << ", " << q1[0].second << ") (" << q1[( q1.size() - 1 ) ].first << ", " << q1[( q1.size() - 1 ) ].second << ") " << arq1 << std::endl;
}
if ( q2.size( ) >= 2 ){
noone = true ;
arq2 = ( q2[( q2.size() - 1 ) ].first - q2[0].first ) * ( q2[( q2.size() - 1 ) ].second - q2[0].second ) ;
if ( arq2 < 0 ){
arq3 = arq2 * -1 ;
}
std::cout << "Q2: (" << q2[0].first << ", " << q2[0].second << ") (" << q2[( q2.size() - 1 ) ].first << ", " << q2[( q2.size() - 1 ) ].second << ") " << arq2 << std::endl ;
}
if ( q3.size( ) >= 2 ){
noone = true ;
arq3 = ( q3[( q3.size() - 1 ) ].first - q3[0].first ) * ( q3[( q3.size() - 1 ) ].second - q3[0].second ) ;
if ( arq3 < 0 ){
arq3 = arq3 * -1 ;
}
std::cout << "Q3: (" << q3[0].first << ", " << q3[0].second << ") (" << q3[( q3.size() - 1 ) ].first << ", " << q3[( q3.size() - 1 ) ].second << ") " << arq3 << std::endl;
}
if ( q4.size( ) >= 2 ){
noone = true ;
arq4 = ( q4[( q4.size() - 1 ) ].first - q4[0].first ) * ( q4[( q4.size() - 1 ) ].second - q4[0].second ) ;
if ( arq4 < 0 ){
arq4 = arq4 * -1 ;
}
std::cout << "Q4: (" << q4[0].first << ", " << q4[0].second << ") (" << q4[( q4.size() - 1 ) ].first << ", " << q4[( q4.size() - 1 ) ].second << ") " << arq4 << std::endl ;
}
if ( noone == false ){
std::cout << "No point in any quadrant" ;
}
} | # 2070009, 2024-11-02 11:44:25, PPPP-PP-PP (80%)
#include<iostream>
#include<set>
#include<algorithm>
int main ( ) {
float n = 0 , x = 0 , y = 0 ;
std::set<float> q1x = {} ,q1y = {} ,q2x = {} ,q2y = {} ,q3x = {} ,q3y = {} ,q4x = {} ,q4y = {};
std::cin >> n ;
for ( float i = 0 ; i < n ; i++ ){
std::cin >> x >> y ;
if ( x == 0 || y == 0 ){
continue ;
}else if ( x > 0 && y > 0 ){
q1x.insert(x) ;
q1y.insert(y);
}else if ( x < 0 && y > 0 ){
q2x.insert(x) ;
q2y.insert(y);
}else if ( x < 0 && y < 0 ){
q3x.insert(x) ;
q3y.insert(y);
}else if ( x > 0 && y < 0 ){
q4x.insert(x) ;
q4y.insert(y);
}
}
float arq1 = 0 , arq2 = 0 , arq3 = 0 , arq4 = 0 ;
bool noone = false ;
if ( q1x.size( ) >= 2 ){
noone = true ;
arq1 = ( *(--q1x.end()) - *q1x.begin() ) * ( *(--q1y.end()) - *q1y.begin() );
std::cout << "Q1: (" << *q1x.begin() << ", " << *q1y.begin() << ") (" << *(--q1x.end())<< ", " << *(--q1y.end()) << ") " << arq1 << std::endl;
}
if ( q2x.size( ) >= 2 ){
noone = true ;
arq2 = ( *(--q2x.end()) - *q2x.begin() ) * ( *(--q2y.end()) - *q2y.begin() );
if ( arq2 < 0 ){
arq2 = arq2 * -1 ;
}
std::cout << "Q2: (" << *q2x.begin() << ", " << *q2y.begin() << ") (" << *(--q2x.end())<< ", " << *(--q2y.end()) << ") " << arq2 << std::endl;
}
if ( q3x.size( ) >= 2 ){
noone = true ;
arq3 = ( *(--q3x.end()) - *q3x.begin() ) * ( *(--q3y.end()) - *q3y.begin() );
if ( arq3 < 0 ){
arq3 = arq3 * -1 ;
}
std::cout << "Q3: (" << *q3x.begin() << ", " << *q3y.begin() << ") (" << *(--q3x.end())<< ", " << *(--q3y.end()) << ") " << arq3 << std::endl;
}
if ( q4x.size( ) >= 2 ){
noone = true ;
arq4 = ( *(--q4x.end()) - *q4x.begin() ) * ( *(--q4y.end()) - *q4y.begin() );
if ( arq4 < 0 ){
arq4 = arq4 * -1 ;
}
std::cout << "Q4: (" << *q4x.begin() << ", " << *q4y.begin() << ") (" << *(--q4x.end())<< ", " << *(--q4y.end()) << ") " << arq4 << std::endl;
}
if ( noone == false ){
std::cout << "No point in any quadrant" ;
}
} | # 2070161, 2024-11-02 11:54:52, PPPPPPPPPP (100%)
#include<iostream>
#include<set>
#include<algorithm>
int main ( ) {
float n = 0 , x = 0 , y = 0 ;
std::set<float> q1x = {} ,q1y = {} ,q2x = {} ,q2y = {} ,q3x = {} ,q3y = {} ,q4x = {} ,q4y = {};
std::cin >> n ;
for ( float i = 0 ; i < n ; i++ ){
std::cin >> x >> y ;
if ( x == 0 || y == 0 ){
continue ;
}else if ( x > 0 && y > 0 ){
q1x.insert(x) ;
q1y.insert(y);
}else if ( x < 0 && y > 0 ){
q2x.insert(x) ;
q2y.insert(y);
}else if ( x < 0 && y < 0 ){
q3x.insert(x) ;
q3y.insert(y);
}else if ( x > 0 && y < 0 ){
q4x.insert(x) ;
q4y.insert(y);
}
}
float arq1 = 0 , arq2 = 0 , arq3 = 0 , arq4 = 0 ;
bool noone = false ;
if ( q1x.size( ) >= 1 ){
noone = true ;
arq1 = ( *(--q1x.end()) - *q1x.begin() ) * ( *(--q1y.end()) - *q1y.begin() );
std::cout << "Q1: (" << *q1x.begin() << ", " << *q1y.begin() << ") (" << *(--q1x.end())<< ", " << *(--q1y.end()) << ") " << arq1 << std::endl;
}
if ( q2x.size( ) >= 1 ){
noone = true ;
arq2 = ( *(--q2x.end()) - *q2x.begin() ) * ( *(--q2y.end()) - *q2y.begin() );
if ( arq2 < 0 ){
arq2 = arq2 * -1 ;
}
std::cout << "Q2: (" << *q2x.begin() << ", " << *q2y.begin() << ") (" << *(--q2x.end())<< ", " << *(--q2y.end()) << ") " << arq2 << std::endl;
}
if ( q3x.size( ) >= 1 ){
noone = true ;
arq3 = ( *(--q3x.end()) - *q3x.begin() ) * ( *(--q3y.end()) - *q3y.begin() );
if ( arq3 < 0 ){
arq3 = arq3 * -1 ;
}
std::cout << "Q3: (" << *q3x.begin() << ", " << *q3y.begin() << ") (" << *(--q3x.end())<< ", " << *(--q3y.end()) << ") " << arq3 << std::endl;
}
if ( q4x.size( ) >= 1 ){
noone = true ;
arq4 = ( *(--q4x.end()) - *q4x.begin() ) * ( *(--q4y.end()) - *q4y.begin() );
if ( arq4 < 0 ){
arq4 = arq4 * -1 ;
}
std::cout << "Q4: (" << *q4x.begin() << ", " << *q4y.begin() << ") (" << *(--q4x.end())<< ", " << *(--q4y.end()) << ") " << arq4 << std::endl;
}
if ( noone == false ){
std::cout << "No point in any quadrant" ;
}
} |
# 2070786, 2024-11-02 13:16:28, ----P-PP-P (40%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n = 0;
cin >> n;
int maxXQ1 = 0,maxYQ1 = 0,minXQ1 = 100000,minYQ1 = 1000000;
int maxXQ2 = -100000,maxYQ2 = 0,minXQ2 = 200000,minYQ2 = 2000000;
int maxXQ3 = -100000,maxYQ3 = -100000,minXQ3 = 300000,minYQ3 = 3000000;
int maxXQ4 = 0,maxYQ4 = -100000,minXQ4 = 400000,minYQ4 = 4000000;
for (int i = 0; i < n; i++)
{
int x,y;
cin >> x >> y;
if (x > 0 && y > 0)
{
if(x > maxXQ1 && x != 0) maxXQ1 = x;
if(minXQ1 > x && x != 0)minXQ1 = x;
if(y > maxYQ1 && y != 0) maxYQ1 = y;
if(minYQ1 > y && y != 0) minYQ1 = y;
}
else if (x < 0 && y > 0)
{
if(x > maxXQ2 && x != 0) maxXQ2 = x;
if(minXQ2 > x && x != 0)minXQ2 = x;
if(y > maxYQ2 && y != 0) maxYQ2 = y;
if(minYQ2 > y && y != 0) minYQ2 = y;
}
else if (x < 0 && y < 0)
{
if(x > maxXQ3 && x != 0) maxXQ3 = x;
if(minXQ3 > x && x != 0)minXQ3 = x;
if(y > maxYQ3 && y != 0) maxYQ3 = y;
if(minYQ3 > y && y != 0) minYQ3 = y;
}
else if (x > 0 && y < 0)
{
if(x > maxXQ4 && x != 0) maxXQ4 = x;
if(minXQ4 > x && x != 0)minXQ4 = x;
if(y > maxYQ4 && y != 0) maxYQ4 = y;
if(minYQ4 > y && y != 0) minYQ4 = y;
}
}
int areaQ1 = (maxXQ1 - minXQ1) * (maxYQ1 - minYQ1);
cout << "Q1: (" << minXQ1 << ", " << minYQ1 << ") (" << maxXQ1 << ", " << maxYQ1 << ") " << areaQ1 << endl;
int areaQ2 = (maxXQ2 - minXQ2) * (maxYQ2 - minYQ2);
cout << "Q2: (" << minXQ2 << ", " << minYQ2 << ") (" << maxXQ2 << ", " << maxYQ2 << ") " << areaQ2 << endl;
int areaQ3 = (maxXQ3 - minXQ3) * (maxYQ3 - minYQ3);
cout << "Q3: (" << minXQ3 << ", " << minYQ3 << ") (" << maxXQ3 << ", " << maxYQ3 << ") " << areaQ3 << endl;
int areaQ4 = (maxXQ4 - minXQ4) * (maxYQ4 - minYQ4);
cout << "Q4: (" << minXQ4 << ", " << minYQ4 << ") (" << maxXQ4 << ", " << maxYQ4 << ") " << areaQ4 << endl;
} | # 2070809, 2024-11-02 13:19:27, ----PPPP-P (50%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n = 0;
cin >> n;
int maxXQ1 = 0,maxYQ1 = 0,minXQ1 = 100000,minYQ1 = 1000000;
int maxXQ2 = -100000,maxYQ2 = 0,minXQ2 = 200000,minYQ2 = 2000000;
int maxXQ3 = -100000,maxYQ3 = -100000,minXQ3 = 300000,minYQ3 = 3000000;
int maxXQ4 = 0,maxYQ4 = -100000,minXQ4 = 400000,minYQ4 = 4000000;
int count = 0;
for (int i = 0; i < n; i++)
{
int x,y;
cin >> x >> y;
if (x > 0 && y > 0)
{
if(x > maxXQ1 && x != 0) maxXQ1 = x;
if(minXQ1 > x && x != 0)minXQ1 = x;
if(y > maxYQ1 && y != 0) maxYQ1 = y;
if(minYQ1 > y && y != 0) minYQ1 = y;
}
else if (x < 0 && y > 0)
{
if(x > maxXQ2 && x != 0) maxXQ2 = x;
if(minXQ2 > x && x != 0)minXQ2 = x;
if(y > maxYQ2 && y != 0) maxYQ2 = y;
if(minYQ2 > y && y != 0) minYQ2 = y;
}
else if (x < 0 && y < 0)
{
if(x > maxXQ3 && x != 0) maxXQ3 = x;
if(minXQ3 > x && x != 0)minXQ3 = x;
if(y > maxYQ3 && y != 0) maxYQ3 = y;
if(minYQ3 > y && y != 0) minYQ3 = y;
}
else if (x > 0 && y < 0)
{
if(x > maxXQ4 && x != 0) maxXQ4 = x;
if(minXQ4 > x && x != 0)minXQ4 = x;
if(y > maxYQ4 && y != 0) maxYQ4 = y;
if(minYQ4 > y && y != 0) minYQ4 = y;
}
else
{
count++;
}
}
if(count == n)
{
cout << "No point in any quadrant";
}
else
{
int areaQ1 = (maxXQ1 - minXQ1) * (maxYQ1 - minYQ1);
cout << "Q1: (" << minXQ1 << ", " << minYQ1 << ") (" << maxXQ1 << ", " << maxYQ1 << ") " << areaQ1 << endl;
int areaQ2 = (maxXQ2 - minXQ2) * (maxYQ2 - minYQ2);
cout << "Q2: (" << minXQ2 << ", " << minYQ2 << ") (" << maxXQ2 << ", " << maxYQ2 << ") " << areaQ2 << endl;
int areaQ3 = (maxXQ3 - minXQ3) * (maxYQ3 - minYQ3);
cout << "Q3: (" << minXQ3 << ", " << minYQ3 << ") (" << maxXQ3 << ", " << maxYQ3 << ") " << areaQ3 << endl;
int areaQ4 = (maxXQ4 - minXQ4) * (maxYQ4 - minYQ4);
cout << "Q4: (" << minXQ4 << ", " << minYQ4 << ") (" << maxXQ4 << ", " << maxYQ4 << ") " << areaQ4 << endl;
}
} | # 2070845, 2024-11-02 13:24:31, PPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n = 0;
cin >> n;
int maxXQ1 = 0,maxYQ1 = 0,minXQ1 = 100000,minYQ1 = 1000000;
int maxXQ2 = -100000,maxYQ2 = 0,minXQ2 = 200000,minYQ2 = 2000000;
int maxXQ3 = -100000,maxYQ3 = -100000,minXQ3 = 300000,minYQ3 = 3000000;
int maxXQ4 = 0,maxYQ4 = -100000,minXQ4 = 400000,minYQ4 = 4000000;
int count = 0;
bool Q1,Q2,Q3,Q4;
Q1 = Q2 = Q3 = Q4 = false;
for (int i = 0; i < n; i++)
{
int x,y;
cin >> x >> y;
if (x > 0 && y > 0)
{
if(x > maxXQ1 && x != 0) maxXQ1 = x;
if(minXQ1 > x && x != 0)minXQ1 = x;
if(y > maxYQ1 && y != 0) maxYQ1 = y;
if(minYQ1 > y && y != 0) minYQ1 = y;
Q1 = true;
}
else if (x < 0 && y > 0)
{
if(x > maxXQ2 && x != 0) maxXQ2 = x;
if(minXQ2 > x && x != 0)minXQ2 = x;
if(y > maxYQ2 && y != 0) maxYQ2 = y;
if(minYQ2 > y && y != 0) minYQ2 = y;
Q2 = true;
}
else if (x < 0 && y < 0)
{
if(x > maxXQ3 && x != 0) maxXQ3 = x;
if(minXQ3 > x && x != 0)minXQ3 = x;
if(y > maxYQ3 && y != 0) maxYQ3 = y;
if(minYQ3 > y && y != 0) minYQ3 = y;
Q3 = true;
}
else if (x > 0 && y < 0)
{
if(x > maxXQ4 && x != 0) maxXQ4 = x;
if(minXQ4 > x && x != 0)minXQ4 = x;
if(y > maxYQ4 && y != 0) maxYQ4 = y;
if(minYQ4 > y && y != 0) minYQ4 = y;
Q4 = true;
}
else count++;
}
if(count == n)
{
cout << "No point in any quadrant";
}
if(Q1)
{
int areaQ1 = (maxXQ1 - minXQ1) * (maxYQ1 - minYQ1);
cout << "Q1: (" << minXQ1 << ", " << minYQ1 << ") (" << maxXQ1 << ", " << maxYQ1 << ") " << areaQ1 << endl;
}
if(Q2)
{
int areaQ2 = (maxXQ2 - minXQ2) * (maxYQ2 - minYQ2);
cout << "Q2: (" << minXQ2 << ", " << minYQ2 << ") (" << maxXQ2 << ", " << maxYQ2 << ") " << areaQ2 << endl;
}
if(Q3)
{
int areaQ3 = (maxXQ3 - minXQ3) * (maxYQ3 - minYQ3);
cout << "Q3: (" << minXQ3 << ", " << minYQ3 << ") (" << maxXQ3 << ", " << maxYQ3 << ") " << areaQ3 << endl;
}
if(Q4)
{
int areaQ4 = (maxXQ4 - minXQ4) * (maxYQ4 - minYQ4);
cout << "Q4: (" << minXQ4 << ", " << minYQ4 << ") (" << maxXQ4 << ", " << maxYQ4 << ") " << areaQ4 << endl;
}
} |
# 2069015, 2024-11-02 10:03:49, ---------- (0%)
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <cmath>
using namespace std;
int main(){
vector<pair<int,int>> Q[5];
int n;
cin >> n;
for(int i = 0 ; i < n ; i++){
int x , y;
cin >> x >> y;
if(x > 0 && y > 0){
Q[1].push_back(make_pair(x,y));
}
else if(x < 0 && y > 0){
Q[2].push_back(make_pair(x,y));
}
else if(x < 0 && y < 0){
Q[3].push_back(make_pair(x,y));
}
else if(x > 0 && y < 0){
Q[4].push_back(make_pair(x,y));
}
}
for(int a = 1 ; a <= 4 ; a++){
int Xmax , Ymax , Xmin , Ymin;
for(int i = 0 ; i < Q[a].size() ; i++){
if(i == 0){
Xmax = Q[a][i].first;
Xmin = Q[a][i].first;
Ymax = Q[a][i].second;
Ymin = Q[a][i].second;
}
else{
if(Q[a][i].first > Xmax){
Xmax = Q[a][i].first;
}
if(Q[a][i].first < Xmin){
Xmin = Q[a][i].first;
}
if(Q[a][i].second > Ymax){
Ymax = Q[a][i].second;
}
if(Q[a][i].second < Ymin){
Ymin = Q[a][i].second;
}
}
}
cout << "Q1: " << "(" << Xmin << ", " << Ymin << ") (" << Xmax << ", " << Ymax << ") " << (Ymax - Ymin) * (Xmax - Xmin);
cout << endl;
}
return 0;
} | # 2069026, 2024-11-02 10:04:46, ----P-PP-P (40%)
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <cmath>
using namespace std;
int main(){
vector<pair<int,int>> Q[5];
int n;
cin >> n;
for(int i = 0 ; i < n ; i++){
int x , y;
cin >> x >> y;
if(x > 0 && y > 0){
Q[1].push_back(make_pair(x,y));
}
else if(x < 0 && y > 0){
Q[2].push_back(make_pair(x,y));
}
else if(x < 0 && y < 0){
Q[3].push_back(make_pair(x,y));
}
else if(x > 0 && y < 0){
Q[4].push_back(make_pair(x,y));
}
}
for(int a = 1 ; a <= 4 ; a++){
int Xmax , Ymax , Xmin , Ymin;
for(int i = 0 ; i < Q[a].size() ; i++){
if(i == 0){
Xmax = Q[a][i].first;
Xmin = Q[a][i].first;
Ymax = Q[a][i].second;
Ymin = Q[a][i].second;
}
else{
if(Q[a][i].first > Xmax){
Xmax = Q[a][i].first;
}
if(Q[a][i].first < Xmin){
Xmin = Q[a][i].first;
}
if(Q[a][i].second > Ymax){
Ymax = Q[a][i].second;
}
if(Q[a][i].second < Ymin){
Ymin = Q[a][i].second;
}
}
}
cout << "Q" << a << ": (" << Xmin << ", " << Ymin << ") (" << Xmax << ", " << Ymax << ") " << (Ymax - Ymin) * (Xmax - Xmin);
cout << endl;
}
return 0;
} | # 2069053, 2024-11-02 10:07:27, PPPPPPPPPP (100%)
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <cmath>
using namespace std;
int main(){
vector<pair<int,int>> Q[5];
int n;
cin >> n;
for(int i = 0 ; i < n ; i++){
int x , y;
cin >> x >> y;
if(x > 0 && y > 0){
Q[1].push_back(make_pair(x,y));
}
else if(x < 0 && y > 0){
Q[2].push_back(make_pair(x,y));
}
else if(x < 0 && y < 0){
Q[3].push_back(make_pair(x,y));
}
else if(x > 0 && y < 0){
Q[4].push_back(make_pair(x,y));
}
}
if(Q[1].empty() && Q[2].empty() && Q[3].empty() && Q[4].empty()){
cout << "No point in any quadrant";
return 0;
}
for(int a = 1 ; a <= 4 ; a++){
int Xmax , Ymax , Xmin , Ymin;
if(Q[a].empty())
continue;
for(int i = 0 ; i < Q[a].size() ; i++){
if(i == 0){
Xmax = Q[a][i].first;
Xmin = Q[a][i].first;
Ymax = Q[a][i].second;
Ymin = Q[a][i].second;
}
else{
if(Q[a][i].first > Xmax){
Xmax = Q[a][i].first;
}
if(Q[a][i].first < Xmin){
Xmin = Q[a][i].first;
}
if(Q[a][i].second > Ymax){
Ymax = Q[a][i].second;
}
if(Q[a][i].second < Ymin){
Ymin = Q[a][i].second;
}
}
}
cout << "Q" << a << ": (" << Xmin << ", " << Ymin << ") (" << Xmax << ", " << Ymax << ") " << (Ymax - Ymin) * (Xmax - Xmin);
cout << endl;
}
return 0;
} |
# 2071296, 2024-11-02 14:20:01, ----P-PP-P (40%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
int x,y;
vector <pair<int,int>> v;
for(int i =0 ;i < n; i++){
cin >> x >> y;
v.push_back(make_pair(x,y));
}
vector <pair<int,int>> Q1;
vector <pair<int,int>> Q2;
vector <pair<int,int>> Q3;
vector <pair<int,int>> Q4;
for(auto c:v){
if(c.first > 0 && c.second > 0){
Q1.push_back(make_pair(c.first,c.second));
}
if(c.first < 0 && c.second > 0){
Q2.push_back(make_pair(c.first,c.second));
}
if(c.first < 0 && c.second < 0){
Q3.push_back(make_pair(c.first,c.second));
}
if(c.first > 0 && c.second < 0){
Q4.push_back(make_pair(c.first,c.second));
}
}
int mn = INT_MAX;
int mn2 = INT_MAX;
int mx = INT_MIN;
int mx2 = INT_MIN;
for(auto c:Q1){
if(c.first < mn){
mn = c.first;
}
if(c.second < mn2){
mn2 = c.second;
}
if(c.first > mx){
mx = c.first;
}
if(c.second > mx2){
mx2 = c.second;
}
}
int mn_Q2 = INT_MAX;
int mn2_Q2 = INT_MAX;
int mx_Q2 = INT_MIN;
int mx2_Q2 = INT_MIN;
for(auto c:Q2){
if(c.first < mn_Q2){
mn_Q2 = c.first;
}
if(c.second < mn2_Q2){
mn2_Q2 = c.second;
}
if(c.first > mx_Q2){
mx_Q2 = c.first;
}
if(c.second > mx2_Q2){
mx2_Q2 = c.second;
}
}
int mn_Q3 = INT_MAX;
int mn2_Q3 = INT_MAX;
int mx_Q3= INT_MIN;
int mx2_Q3 = INT_MIN;
for(auto c:Q3){
if(c.first < mn_Q3){
mn_Q3 = c.first;
}
if(c.second < mn2_Q3){
mn2_Q3 = c.second;
}
if(c.first > mx_Q3){
mx_Q3 = c.first;
}
if(c.second > mx2_Q3){
mx2_Q3 = c.second;
}
}
int mn_Q4 = INT_MAX;
int mn2_Q4 = INT_MAX;
int mx_Q4= INT_MIN;
int mx2_Q4 = INT_MIN;
for(auto c:Q4){
if(c.first < mn_Q4){
mn_Q4 = c.first;
}
if(c.second < mn2_Q4){
mn2_Q4 = c.second;
}
if(c.first > mx_Q4){
mx_Q4 = c.first;
}
if(c.second > mx2_Q4){
mx2_Q4 = c.second;
}
}
int sq1 = (mx-mn)*(mx2-mn2);
int sq2 = (mx_Q2-mn_Q2)*(mx2_Q2-mn2_Q2);
int sq3 = (mx_Q3-mn_Q3)*(mx2_Q3-mn2_Q3);
int sq4= (mx_Q4-mn_Q4)*(mx2_Q4-mn2_Q4);
cout << "Q1: " <<"(" << mn << ", " <<mn2 << ") " << "(" << mx << ", " << mx2 << ") " << sq1;
cout << endl;
cout << "Q2: " <<"(" << mn_Q2 << ", " <<mn2_Q2 << ") " << "(" << mx_Q2 << ", " << mx2_Q2 << ") " << sq2;
cout << endl;
cout << "Q3: " <<"(" << mn_Q3 << ", " <<mn2_Q3 << ") " << "(" << mx_Q3 << ", " << mx2_Q3 << ") " << sq3;
cout << endl;
cout << "Q4: " <<"(" << mn_Q4 << ", " <<mn2_Q4 << ") " << "(" << mx_Q4 << ", " << mx2_Q4 << ") " << sq4;
cout << endl;
} | # 2071339, 2024-11-02 14:24:25, PPPPP-PPPP (90%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
int x,y;
vector <pair<int,int>> v;
for(int i =0 ;i < n; i++){
cin >> x >> y;
v.push_back(make_pair(x,y));
}
vector <pair<int,int>> Q1;
vector <pair<int,int>> Q2;
vector <pair<int,int>> Q3;
vector <pair<int,int>> Q4;
int cnt1 = 0;
int cnt2 = 0;
int cnt3 = 0;
int cnt4 = 0;
for(auto c:v){
if(c.first > 0 && c.second > 0){
Q1.push_back(make_pair(c.first,c.second));
cnt1++;
}
if(c.first < 0 && c.second > 0){
Q2.push_back(make_pair(c.first,c.second));
cnt2++;
}
if(c.first < 0 && c.second < 0){
Q3.push_back(make_pair(c.first,c.second));
cnt3++;
}
if(c.first > 0 && c.second < 0){
Q4.push_back(make_pair(c.first,c.second));
cnt4++;
}
}
int mn = INT_MAX;
int mn2 = INT_MAX;
int mx = INT_MIN;
int mx2 = INT_MIN;
for(auto c:Q1){
if(c.first < mn){
mn = c.first;
}
if(c.second < mn2){
mn2 = c.second;
}
if(c.first > mx){
mx = c.first;
}
if(c.second > mx2){
mx2 = c.second;
}
}
int mn_Q2 = INT_MAX;
int mn2_Q2 = INT_MAX;
int mx_Q2 = INT_MIN;
int mx2_Q2 = INT_MIN;
for(auto c:Q2){
if(c.first < mn_Q2){
mn_Q2 = c.first;
}
if(c.second < mn2_Q2){
mn2_Q2 = c.second;
}
if(c.first > mx_Q2){
mx_Q2 = c.first;
}
if(c.second > mx2_Q2){
mx2_Q2 = c.second;
}
}
int mn_Q3 = INT_MAX;
int mn2_Q3 = INT_MAX;
int mx_Q3= INT_MIN;
int mx2_Q3 = INT_MIN;
for(auto c:Q3){
if(c.first < mn_Q3){
mn_Q3 = c.first;
}
if(c.second < mn2_Q3){
mn2_Q3 = c.second;
}
if(c.first > mx_Q3){
mx_Q3 = c.first;
}
if(c.second > mx2_Q3){
mx2_Q3 = c.second;
}
}
int mn_Q4 = INT_MAX;
int mn2_Q4 = INT_MAX;
int mx_Q4= INT_MIN;
int mx2_Q4 = INT_MIN;
for(auto c:Q4){
if(c.first < mn_Q4){
mn_Q4 = c.first;
}
if(c.second < mn2_Q4){
mn2_Q4 = c.second;
}
if(c.first > mx_Q4){
mx_Q4 = c.first;
}
if(c.second > mx2_Q4){
mx2_Q4 = c.second;
}
}
int sq1 = (mx-mn)*(mx2-mn2);
int sq2 = (mx_Q2-mn_Q2)*(mx2_Q2-mn2_Q2);
int sq3 = (mx_Q3-mn_Q3)*(mx2_Q3-mn2_Q3);
int sq4= (mx_Q4-mn_Q4)*(mx2_Q4-mn2_Q4);
if(cnt1 != 0){
cout << "Q1: " <<"(" << mn << ", " <<mn2 << ") " << "(" << mx << ", " << mx2 << ") " << sq1;
cout << endl;
}
if(cnt2 != 0){
cout << "Q2: " <<"(" << mn_Q2 << ", " <<mn2_Q2 << ") " << "(" << mx_Q2 << ", " << mx2_Q2 << ") " << sq2;
cout << endl;
}
if(cnt3 != 0){
cout << "Q3: " <<"(" << mn_Q3 << ", " <<mn2_Q3 << ") " << "(" << mx_Q3 << ", " << mx2_Q3 << ") " << sq3;
cout << endl;
}
if(cnt4 != 0){
cout << "Q4: " <<"(" << mn_Q4 << ", " <<mn2_Q4 << ") " << "(" << mx_Q4 << ", " << mx2_Q4 << ") " << sq4;
cout << endl;
}
if(cnt1 == 0 && cnt2 == 0 && cnt3 == 0&& cnt4 == 0){
cout << "No point in any quardrant";
}
} | # 2071342, 2024-11-02 14:24:53, PPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
int x,y;
vector <pair<int,int>> v;
for(int i =0 ;i < n; i++){
cin >> x >> y;
v.push_back(make_pair(x,y));
}
vector <pair<int,int>> Q1;
vector <pair<int,int>> Q2;
vector <pair<int,int>> Q3;
vector <pair<int,int>> Q4;
int cnt1 = 0;
int cnt2 = 0;
int cnt3 = 0;
int cnt4 = 0;
for(auto c:v){
if(c.first > 0 && c.second > 0){
Q1.push_back(make_pair(c.first,c.second));
cnt1++;
}
if(c.first < 0 && c.second > 0){
Q2.push_back(make_pair(c.first,c.second));
cnt2++;
}
if(c.first < 0 && c.second < 0){
Q3.push_back(make_pair(c.first,c.second));
cnt3++;
}
if(c.first > 0 && c.second < 0){
Q4.push_back(make_pair(c.first,c.second));
cnt4++;
}
}
int mn = INT_MAX;
int mn2 = INT_MAX;
int mx = INT_MIN;
int mx2 = INT_MIN;
for(auto c:Q1){
if(c.first < mn){
mn = c.first;
}
if(c.second < mn2){
mn2 = c.second;
}
if(c.first > mx){
mx = c.first;
}
if(c.second > mx2){
mx2 = c.second;
}
}
int mn_Q2 = INT_MAX;
int mn2_Q2 = INT_MAX;
int mx_Q2 = INT_MIN;
int mx2_Q2 = INT_MIN;
for(auto c:Q2){
if(c.first < mn_Q2){
mn_Q2 = c.first;
}
if(c.second < mn2_Q2){
mn2_Q2 = c.second;
}
if(c.first > mx_Q2){
mx_Q2 = c.first;
}
if(c.second > mx2_Q2){
mx2_Q2 = c.second;
}
}
int mn_Q3 = INT_MAX;
int mn2_Q3 = INT_MAX;
int mx_Q3= INT_MIN;
int mx2_Q3 = INT_MIN;
for(auto c:Q3){
if(c.first < mn_Q3){
mn_Q3 = c.first;
}
if(c.second < mn2_Q3){
mn2_Q3 = c.second;
}
if(c.first > mx_Q3){
mx_Q3 = c.first;
}
if(c.second > mx2_Q3){
mx2_Q3 = c.second;
}
}
int mn_Q4 = INT_MAX;
int mn2_Q4 = INT_MAX;
int mx_Q4= INT_MIN;
int mx2_Q4 = INT_MIN;
for(auto c:Q4){
if(c.first < mn_Q4){
mn_Q4 = c.first;
}
if(c.second < mn2_Q4){
mn2_Q4 = c.second;
}
if(c.first > mx_Q4){
mx_Q4 = c.first;
}
if(c.second > mx2_Q4){
mx2_Q4 = c.second;
}
}
int sq1 = (mx-mn)*(mx2-mn2);
int sq2 = (mx_Q2-mn_Q2)*(mx2_Q2-mn2_Q2);
int sq3 = (mx_Q3-mn_Q3)*(mx2_Q3-mn2_Q3);
int sq4= (mx_Q4-mn_Q4)*(mx2_Q4-mn2_Q4);
if(cnt1 != 0){
cout << "Q1: " <<"(" << mn << ", " <<mn2 << ") " << "(" << mx << ", " << mx2 << ") " << sq1;
cout << endl;
}
if(cnt2 != 0){
cout << "Q2: " <<"(" << mn_Q2 << ", " <<mn2_Q2 << ") " << "(" << mx_Q2 << ", " << mx2_Q2 << ") " << sq2;
cout << endl;
}
if(cnt3 != 0){
cout << "Q3: " <<"(" << mn_Q3 << ", " <<mn2_Q3 << ") " << "(" << mx_Q3 << ", " << mx2_Q3 << ") " << sq3;
cout << endl;
}
if(cnt4 != 0){
cout << "Q4: " <<"(" << mn_Q4 << ", " <<mn2_Q4 << ") " << "(" << mx_Q4 << ", " << mx2_Q4 << ") " << sq4;
cout << endl;
}
if(cnt1 == 0 && cnt2 == 0 && cnt3 == 0&& cnt4 == 0){
cout << "No point in any quadrant";
}
} |
# 2070990, 2024-11-02 13:41:47, xxxxPxPPxP (40%)
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
int main(){
int n; cin >> n;
int x,y;
vector<pair<int,int>> q1,q2,q3,q4;
while(n--){
cin >> x >> y;
if(x != 0 && y != 0){
if(x > 0 && y > 0){
q1.push_back({x,y});
}
else if(x > 0 && y < 0){
q4.push_back({x,y});
}
else if(x < 0 && y < 0){
q3.push_back({x,y});
}
else{
q2.push_back({x,y});
}
}
}
vector<vector<pair<int,int>>> vec;
vec.push_back(q1);
vec.push_back(q2);
vec.push_back(q3);
vec.push_back(q4);
// cout << "**********\n";
int c = 0;
vector<string> Q = {"Q1","Q2","Q3","Q4"};
for(auto v : vec){
int minx = v[0].first,miny = v[0].second,maxx = v[0].first,maxy = v[0].second;
for(auto [x,y] : v){
// cout << x << ' ' << y << '\n';
// cout << "maxx is " << maxx << "maxy is " << maxy << '\n';
if(x > maxx){
maxx = x;
}
if(x < minx){
minx = x;
}
if(y > maxy){
maxy = y;
}
if(y < miny){
miny = y;
}
}
int z = (maxx-minx) * (maxy-miny);
cout << Q[c] << ": ";
c++;
cout << "(" << minx << ", " << miny << ") " << "(" << maxx << ", " << maxy << ") " << z;
cout << '\n';
}
} | # 2071093, 2024-11-02 13:54:40, P-P-PPPP-P (70%)
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
int main(){
int n; cin >> n;
int x,y;
vector<pair<int,int>> q1,q2,q3,q4;
bool haveAny = false;
while(n--){
cin >> x >> y;
if(x != 0 && y != 0){
if(x > 0 && y > 0){
q1.push_back({x,y});
haveAny = true;
}
else if(x > 0 && y < 0){
q4.push_back({x,y});
haveAny = true;
}
else if(x < 0 && y < 0){
q3.push_back({x,y});
haveAny = true;
}
else{
q2.push_back({x,y});
haveAny = true;
}
}
}
if(!haveAny){
cout << "No point in any quadrant";
return 0;
}
vector<vector<pair<int,int>>> vec;
if(!q1.empty()){
vec.push_back(q1);
}
else{
vec.push_back({{}});
}
if(!q2.empty()){
vec.push_back(q2);
}
else{
vec.push_back({{}});
}
if(!q3.empty()){
vec.push_back(q3);
}
else{
vec.push_back({{}});
}
if(!q4.empty()){
vec.push_back(q4);
}
else{
vec.push_back({{}});
}
// cout << "**********\n";
int c = 0;
vector<string> ans;
vector<string> Q = {"Q1","Q2","Q3","Q4"};
for(auto v : vec){
if(v.empty()){
ans.push_back("");
c++;
}
else{
int minx = v[0].first,miny = v[0].second,maxx = v[0].first,maxy = v[0].second;
for(auto [x,y] : v){
// cout << x << ' ' << y << '\n';
// cout << "maxx is " << maxx << "maxy is " << maxy << '\n';
if(x > maxx){
maxx = x;
}
if(x < minx){
minx = x;
}
if(y > maxy){
maxy = y;
}
if(y < miny){
miny = y;
}
}
int z = (maxx-minx) * (maxy-miny);
// cout << Q[c] << ": ";
// cout << "(" << minx << ", " << miny << ") " << "(" << maxx << ", " << maxy << ") " << z;
// cout << '\n';
if(minx == 0 || miny == 0 || maxx == 0 || maxy == 0){
ans.push_back("");
}
else{
string output = Q[c] + ": " "(" + to_string(minx) + ", " + to_string(miny) + ") " + "(" + to_string(maxx) + ", " + to_string(maxy) + ") " + to_string(z);
ans.push_back(output);
c++;
}
}
}
for(int i=0;i<4;i++){
if(vec[i].empty()){
cout << "No point in any quadrant\n";
}
else{
if(ans[i].empty()){
continue;
}
cout << ans[i] << '\n';
}
}
} | # 2071104, 2024-11-02 13:55:56, PPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
int main(){
int n; cin >> n;
int x,y;
vector<pair<int,int>> q1,q2,q3,q4;
bool haveAny = false;
while(n--){
cin >> x >> y;
if(x != 0 && y != 0){
if(x > 0 && y > 0){
q1.push_back({x,y});
haveAny = true;
}
else if(x > 0 && y < 0){
q4.push_back({x,y});
haveAny = true;
}
else if(x < 0 && y < 0){
q3.push_back({x,y});
haveAny = true;
}
else{
q2.push_back({x,y});
haveAny = true;
}
}
}
if(!haveAny){
cout << "No point in any quadrant";
return 0;
}
vector<vector<pair<int,int>>> vec;
if(!q1.empty()){
vec.push_back(q1);
}
else{
vec.push_back({{}});
}
if(!q2.empty()){
vec.push_back(q2);
}
else{
vec.push_back({{}});
}
if(!q3.empty()){
vec.push_back(q3);
}
else{
vec.push_back({{}});
}
if(!q4.empty()){
vec.push_back(q4);
}
else{
vec.push_back({{}});
}
// cout << "**********\n";
int c = 0;
vector<string> ans;
vector<string> Q = {"Q1","Q2","Q3","Q4"};
for(auto v : vec){
if(v.empty()){
ans.push_back("");
c++;
}
else{
int minx = v[0].first,miny = v[0].second,maxx = v[0].first,maxy = v[0].second;
for(auto [x,y] : v){
// cout << x << ' ' << y << '\n';
// cout << "maxx is " << maxx << "maxy is " << maxy << '\n';
if(x > maxx){
maxx = x;
}
if(x < minx){
minx = x;
}
if(y > maxy){
maxy = y;
}
if(y < miny){
miny = y;
}
}
int z = (maxx-minx) * (maxy-miny);
// cout << Q[c] << ": ";
// cout << "(" << minx << ", " << miny << ") " << "(" << maxx << ", " << maxy << ") " << z;
// cout << '\n';
if(minx == 0 || miny == 0 || maxx == 0 || maxy == 0){
ans.push_back("");
c++;
}
else{
string output = Q[c] + ": " "(" + to_string(minx) + ", " + to_string(miny) + ") " + "(" + to_string(maxx) + ", " + to_string(maxy) + ") " + to_string(z);
ans.push_back(output);
c++;
}
}
}
for(int i=0;i<4;i++){
if(vec[i].empty()){
cout << "No point in any quadrant\n";
}
else{
if(ans[i].empty()){
continue;
}
cout << ans[i] << '\n';
}
}
} |
# 2070998, 2024-11-02 13:42:26, ----P-PP-- (30%)
#include <bits/stdc++.h>
using namespace std ;
int main()
{
int n , x , y ;
int numQ1=0 , numQ2=0 , numQ3=0 , numQ4=0 ;
vector<pair<int,int>> Q1 , Q2 , Q3 , Q4 ;
cin>> n ;
for(int i=0; i<n ;i++) {
cin>> x >> y ;
if(x>0 && y>0) {
numQ1++ ;
Q1.push_back(make_pair(x,y)) ;
}
else if(x<0 && y>0) {
numQ2++ ;
Q2.push_back(make_pair(x,y)) ;
}
else if(x<0 && y<0) {
numQ3++ ;
Q3.push_back(make_pair(x,y)) ;
}
else if(x>0 && y<0) {
numQ4++ ;
Q4.push_back(make_pair(x,y)) ;
}
}
int max_x , max_y , min_x , min_y ;
for(int i=0 ; i<Q1.size() ;i++) {
for(int j=0 ; j<Q1.size() ;j++) {
if (Q1[i].first >= Q1[j].first) {
max_x = Q1[i].first ;
}
else break ;
}
}
for(int i=0 ; i<Q1.size() ;i++) {
for(int j=0 ; j<Q1.size() ;j++) {
if (Q1[i].second >= Q1[j].second) {
max_y = Q1[i].second;
}
else break ;
}
}
for(int i=0 ; i<Q1.size() ;i++) {
for(int j=0 ; j<Q1.size() ;j++) {
if (Q1[i].first <= Q1[j].first) {
min_x = Q1[i].first ;
}
else break ;
}
}
for(int i=0 ; i<Q1.size() ;i++) {
for(int j=0 ; j<Q1.size() ;j++) {
if (Q1[i].second <= Q1[j].second) {
min_y = Q1[i].second ;
}
else break ;
}
}
if(numQ1!=0) {
cout << "Q1: (" << min_x << ", " << min_y << ") (" << max_x << ", " << max_y << ") " << (max_x-min_x)*(max_y-min_y) << endl ;
}
max_x=0 , max_y=0 , min_x=0 , min_y=0 ;
for(int i=0 ; i<Q2.size() ;i++) {
for(int j=0 ; j<Q2.size() ;j++) {
if (Q2[i].first >= Q2[j].first) {
max_x = Q2[i].first ;
}
else break ;
}
}
for(int i=0 ; i<Q2.size() ;i++) {
for(int j=0 ; j<Q2.size() ;j++) {
if (Q2[i].second >= Q2[j].second) {
max_y = Q2[i].second;
}
else break ;
}
}
for(int i=0 ; i<Q2.size() ;i++) {
for(int j=0 ; j<Q2.size() ;j++) {
if (Q2[i].first <= Q2[j].first) {
min_x = Q2[i].first ;
}
else break ;
}
}
for(int i=0 ; i<Q2.size() ;i++) {
for(int j=0 ; j<Q2.size() ;j++) {
if (Q2[i].second <= Q2[j].second) {
min_y = Q2[i].second ;
}
else break ;
}
}
if(numQ2!=0) {
cout << "Q2: (" << min_x << ", " << min_y << ") (" << max_x << ", " << max_y << ") " << abs(max_x-min_x)*abs(max_y-min_y) << endl ;
}
max_x=0 , max_y=0 , min_x=0 , min_y=0 ;
for(int i=0 ; i<Q3.size() ;i++) {
for(int j=0 ; j<Q3.size() ;j++) {
if (Q3[i].first >= Q3[j].first) {
max_x = Q3[i].first ;
}
else break ;
}
}
for(int i=0 ; i<Q3.size() ;i++) {
for(int j=0 ; j<Q3.size() ;j++) {
if (Q3[i].second >= Q3[j].second) {
max_y = Q3[i].second;
}
else break ;
}
}
for(int i=0 ; i<Q3.size() ;i++) {
for(int j=0 ; j<Q3.size() ;j++) {
if (Q3[i].first <= Q3[j].first) {
min_x = Q3[i].first ;
}
else break ;
}
}
for(int i=0 ; i<Q3.size() ;i++) {
for(int j=0 ; j<Q3.size() ;j++) {
if (Q3[i].second <= Q3[j].second) {
min_y = Q3[i].second ;
}
else break ;
}
}
if(numQ3!=0) {
cout << "Q3: (" << min_x << ", " << min_y << ") (" << max_x << ", " << max_y << ") " << abs(max_x-min_x)*abs(max_y-min_y) << endl ;
}
max_x=0 , max_y=0 , min_x=0 , min_y=0 ;
for(int i=0 ; i<Q4.size() ;i++) {
for(int j=0 ; j<Q4.size() ;j++) {
if (Q4[i].first >= Q4[j].first) {
max_x = Q4[i].first ;
}
else break ;
}
}
for(int i=0 ; i<Q4.size() ;i++) {
for(int j=0 ; j<Q4.size() ;j++) {
if (Q4[i].second >= Q4[j].second) {
max_y = Q4[i].second;
}
else break ;
}
}
for(int i=0 ; i<Q4.size() ;i++) {
for(int j=0 ; j<Q4.size() ;j++) {
if (Q4[i].first <= Q4[j].first) {
min_x = Q4[i].first ;
}
else break ;
}
}
for(int i=0 ; i<Q4.size() ;i++) {
for(int j=0 ; j<Q4.size() ;j++) {
if (Q4[i].second <= Q4[j].second) {
min_y = Q4[i].second ;
}
else break ;
}
}
if(numQ4!=0) {
cout << "Q4: (" << min_x << ", " << min_y << ") (" << max_x << ", " << max_y << ") " << abs(max_x-min_x)*abs(max_y-min_y) << endl ;
}
} | # 2071016, 2024-11-02 13:46:42, ----PPPP-- (40%)
#include <bits/stdc++.h>
using namespace std ;
int main()
{
int n , x , y ;
int numQ1=0 , numQ2=0 , numQ3=0 , numQ4=0 ;
vector<pair<int,int>> Q1 , Q2 , Q3 , Q4 ;
cin>> n ;
for(int i=0; i<n ;i++) {
cin>> x >> y ;
if(x>0 && y>0) {
numQ1++ ;
Q1.push_back(make_pair(x,y)) ;
}
else if(x<0 && y>0) {
numQ2++ ;
Q2.push_back(make_pair(x,y)) ;
}
else if(x<0 && y<0) {
numQ3++ ;
Q3.push_back(make_pair(x,y)) ;
}
else if(x>0 && y<0) {
numQ4++ ;
Q4.push_back(make_pair(x,y)) ;
}
}
int max_x , max_y , min_x , min_y ;
for(int i=0 ; i<Q1.size() ;i++) {
for(int j=0 ; j<Q1.size() ;j++) {
if (Q1[i].first >= Q1[j].first) {
max_x = Q1[i].first ;
}
else break ;
}
}
for(int i=0 ; i<Q1.size() ;i++) {
for(int j=0 ; j<Q1.size() ;j++) {
if (Q1[i].second >= Q1[j].second) {
max_y = Q1[i].second;
}
else break ;
}
}
for(int i=0 ; i<Q1.size() ;i++) {
for(int j=0 ; j<Q1.size() ;j++) {
if (Q1[i].first <= Q1[j].first) {
min_x = Q1[i].first ;
}
else break ;
}
}
for(int i=0 ; i<Q1.size() ;i++) {
for(int j=0 ; j<Q1.size() ;j++) {
if (Q1[i].second <= Q1[j].second) {
min_y = Q1[i].second ;
}
else break ;
}
}
if(numQ1!=0) {
cout << "Q1: (" << min_x << ", " << min_y << ") (" << max_x << ", " << max_y << ") " << (max_x-min_x)*(max_y-min_y) << endl ;
}
max_x=0 , max_y=0 , min_x=0 , min_y=0 ;
for(int i=0 ; i<Q2.size() ;i++) {
for(int j=0 ; j<Q2.size() ;j++) {
if (Q2[i].first >= Q2[j].first) {
max_x = Q2[i].first ;
}
else break ;
}
}
for(int i=0 ; i<Q2.size() ;i++) {
for(int j=0 ; j<Q2.size() ;j++) {
if (Q2[i].second >= Q2[j].second) {
max_y = Q2[i].second;
}
else break ;
}
}
for(int i=0 ; i<Q2.size() ;i++) {
for(int j=0 ; j<Q2.size() ;j++) {
if (Q2[i].first <= Q2[j].first) {
min_x = Q2[i].first ;
}
else break ;
}
}
for(int i=0 ; i<Q2.size() ;i++) {
for(int j=0 ; j<Q2.size() ;j++) {
if (Q2[i].second <= Q2[j].second) {
min_y = Q2[i].second ;
}
else break ;
}
}
if(numQ2!=0) {
cout << "Q2: (" << min_x << ", " << min_y << ") (" << max_x << ", " << max_y << ") " << abs(max_x-min_x)*abs(max_y-min_y) << endl ;
}
max_x=0 , max_y=0 , min_x=0 , min_y=0 ;
for(int i=0 ; i<Q3.size() ;i++) {
for(int j=0 ; j<Q3.size() ;j++) {
if (Q3[i].first >= Q3[j].first) {
max_x = Q3[i].first ;
}
else break ;
}
}
for(int i=0 ; i<Q3.size() ;i++) {
for(int j=0 ; j<Q3.size() ;j++) {
if (Q3[i].second >= Q3[j].second) {
max_y = Q3[i].second;
}
else break ;
}
}
for(int i=0 ; i<Q3.size() ;i++) {
for(int j=0 ; j<Q3.size() ;j++) {
if (Q3[i].first <= Q3[j].first) {
min_x = Q3[i].first ;
}
else break ;
}
}
for(int i=0 ; i<Q3.size() ;i++) {
for(int j=0 ; j<Q3.size() ;j++) {
if (Q3[i].second <= Q3[j].second) {
min_y = Q3[i].second ;
}
else break ;
}
}
if(numQ3!=0) {
cout << "Q3: (" << min_x << ", " << min_y << ") (" << max_x << ", " << max_y << ") " << abs(max_x-min_x)*abs(max_y-min_y) << endl ;
}
max_x=0 , max_y=0 , min_x=0 , min_y=0 ;
for(int i=0 ; i<Q4.size() ;i++) {
for(int j=0 ; j<Q4.size() ;j++) {
if (Q4[i].first >= Q4[j].first) {
max_x = Q4[i].first ;
}
else break ;
}
}
for(int i=0 ; i<Q4.size() ;i++) {
for(int j=0 ; j<Q4.size() ;j++) {
if (Q4[i].second >= Q4[j].second) {
max_y = Q4[i].second;
}
else break ;
}
}
for(int i=0 ; i<Q4.size() ;i++) {
for(int j=0 ; j<Q4.size() ;j++) {
if (Q4[i].first <= Q4[j].first) {
min_x = Q4[i].first ;
}
else break ;
}
}
for(int i=0 ; i<Q4.size() ;i++) {
for(int j=0 ; j<Q4.size() ;j++) {
if (Q4[i].second <= Q4[j].second) {
min_y = Q4[i].second ;
}
else break ;
}
}
if(numQ4!=0) {
cout << "Q4: (" << min_x << ", " << min_y << ") (" << max_x << ", " << max_y << ") " << abs(max_x-min_x)*abs(max_y-min_y) << endl ;
}
if(numQ1==0 && numQ2==0 && numQ3==0 && numQ4==0) {
cout<< "No point in any quadrant" ;
}
} | # 2071818, 2024-11-02 15:18:49, PPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std ;
int main()
{
int n , x , y ;
int numQ1=0 , numQ2=0 , numQ3=0 , numQ4=0 ;
//vector<pair<int,int>> Q1 , Q2 , Q3 , Q4 ;
set <int> Q1x , Q1y , Q2x , Q3x , Q4x , Q2y , Q3y , Q4y ;
cin>> n ;
for(int i=0; i<n ;i++) {
cin>> x >> y ;
if(x>0 && y>0) {
numQ1++ ;
Q1x.insert(x) ;
Q1y.insert(y) ;
}
else if(x<0 && y>0) {
numQ2++ ;
Q2x.insert(x) ;
Q2y.insert(y) ;
}
else if(x<0 && y<0) {
numQ3++ ;
Q3x.insert(x) ;
Q3y.insert(y) ;
}
else if(x>0 && y<0) {
numQ4++ ;
Q4x.insert(x) ;
Q4y.insert(y) ;
}
}
int max_x , max_y , min_x , min_y ;
for(auto i : Q1x) {
min_x = i ;
break ;
}
for(auto i : Q1y) {
min_y = i ;
break ;
}
for(auto i : Q1x) {
max_x = i ;
}
for(auto i : Q1y) {
max_y = i ;
}
if(numQ1!=0) {
cout << "Q1: (" << min_x << ", " << min_y << ") (" << max_x << ", " << max_y << ") " << (max_x-min_x)*(max_y-min_y) << endl ;
}
for(auto i : Q2x) {
min_x = i ;
break ;
}
for(auto i : Q2y) {
min_y = i ;
break ;
}
for(auto i : Q2x) {
max_x = i ;
}
for(auto i : Q2y) {
max_y = i ;
}
if(numQ2!=0) {
cout << "Q2: (" << min_x << ", " << min_y << ") (" << max_x << ", " << max_y << ") " << (max_x-min_x)*(max_y-min_y) << endl ;
}
for(auto i : Q3x) {
min_x = i ;
break ;
}
for(auto i : Q3y) {
min_y = i ;
break ;
}
for(auto i : Q3x) {
max_x = i ;
}
for(auto i : Q3y) {
max_y = i ;
}
if(numQ3!=0) {
cout << "Q3: (" << min_x << ", " << min_y << ") (" << max_x << ", " << max_y << ") " << (max_x-min_x)*(max_y-min_y) << endl ;
}
for(auto i : Q4x) {
min_x = i ;
break ;
}
for(auto i : Q4y) {
min_y = i ;
break ;
}
for(auto i : Q4x) {
max_x = i ;
}
for(auto i : Q4y) {
max_y = i ;
}
if(numQ4!=0) {
cout << "Q4: (" << min_x << ", " << min_y << ") (" << max_x << ", " << max_y << ") " << (max_x-min_x)*(max_y-min_y) << endl ;
}
if(numQ1==0 && numQ2==0 && numQ3==0 && numQ4==0) {
cout<< "No point in any quadrant" ;
}
} |
# 2069389, 2024-11-02 10:42:55, xxxx-P--x- (10%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
int i,c1=0,c2=0,c3=0,c4=0;
vector<int> x,y;
vector <pair<int,int>> q1,q2,q3,q4;
for(i=0;i<n;i++){
int a,b;
cin>>a>>b;
x.push_back(a);
y.push_back(b);
if(x[i]!=0&&y[i]!=0){
if(x[i]>0&&y[i]>0){
q1.push_back({x[i],y[i]});
c1++;
}
else if(x[i]<0&&y[i]>0){
q2.push_back({x[i],y[i]});
c2++;
}
else if(x[i]<0&&y[i]<0){
q3.push_back({x[i],y[i]});
c3++;
}
else if(x[i]>0&&y[i]<0){
q4.push_back({x[i],y[i]});
c4++;
}
}
}
int rx[5],ry[5],lx[5],ly[5];
for(i=0;i<5;i++){
rx[i]=-1e9;
ry[i]=-1e9;
lx[i]=1e9;
ry[i]=1e9;
}
for(i=0;i<c1;i++){
if(rx[1]<q1[i].first) rx[1]=q1[i].first;
if(ry[1]<q1[i].second) ry[1]=q1[i].second;
if(lx[1]>q1[i].first) lx[1]=q1[i].first;
if(ly[1]>q1[i].second) ly[1]=q1[i].second;
}
for(i=0;i<c2;i++){
if(rx[2]<q2[i].first) rx[2]=q2[i].first;
if(ry[2]<q2[i].second) ry[2]=q2[i].second;
if(lx[2]>q2[i].first) lx[2]=q2[i].first;
if(ly[2]>q2[i].second) ly[2]=q2[i].second;
}
for(i=0;i<c3;i++){
if(rx[3]<q3[i].first) rx[3]=q3[i].first;
if(ry[3]<q3[i].second) ry[3]=q3[i].second;
if(lx[3]>q3[i].first) lx[3]=q3[i].first;
if(ly[3]>q3[i].second) ly[3]=q3[i].second;
}
for(i=0;i<c4;i++){
if(rx[4]<q4[i].first) rx[4]=q4[i].first;
if(ry[4]<q4[i].second) ry[4]=q4[i].second;
if(lx[4]>q4[i].first) lx[4]=q4[i].first;
if(ly[4]>q4[i].second) ly[4]=q4[i].second;
}
if(c1!=0||c2!=0||c3!=0||c4!=0){
if(q1[0].first!=0){
int ans=(rx[1]-lx[1])*(ry[1]-ly[1]);
cout<<"Q1: ("<<lx[1]<<", "<<ly[1]<<") ("<<rx[1]<<", "<<ry[1]<<") "<<ans;
}
if(q2[0].first!=0){
int ans=(rx[2]-lx[2])*(ry[2]-ly[2]);
cout<<"Q2: ("<<lx[2]<<", "<<ly[2]<<") ("<<rx[2]<<", "<<ry[2]<<") "<<ans;
}
if(q3[0].first!=0){
int ans=(rx[3]-lx[3])*(ry[3]-ly[3]);
cout<<"Q3: ("<<lx[3]<<", "<<ly[3]<<") ("<<rx[3]<<", "<<ry[3]<<") "<<ans;
}
if(q4[0].first!=0){
int ans=(rx[4]-lx[4])*(ry[4]-ly[4]);
cout<<"Q4: ("<<lx[4]<<", "<<ly[4]<<") ("<<rx[4]<<", "<<ry[4]<<") "<<ans;
}
}else cout<<"No point in any quadrant";
} | # 2069444, 2024-11-02 10:47:37, xxxx-P--x- (10%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
int i,c1=0,c2=0,c3=0,c4=0;
vector<int> x,y;
vector <pair<int,int>> q1,q2,q3,q4;
for(i=0;i<n;i++){
int a,b;
cin>>a>>b;
x.push_back(a);
y.push_back(b);
if(x[i]!=0&&y[i]!=0){
if(x[i]>0&&y[i]>0){
q1.push_back({x[i],y[i]});
c1++;
}
else if(x[i]<0&&y[i]>0){
q2.push_back({x[i],y[i]});
c2++;
}
else if(x[i]<0&&y[i]<0){
q3.push_back({x[i],y[i]});
c3++;
}
else if(x[i]>0&&y[i]<0){
q4.push_back({x[i],y[i]});
c4++;
}
}
}
int rx[5],ry[5],lx[5],ly[5];
for(i=0;i<5;i++){
rx[i]=-1e9;
ry[i]=-1e9;
lx[i]=1e9;
ly[i]=1e9;
}
for(i=0;i<c1;i++){
if(rx[1]<q1[i].first) rx[1]=q1[i].first;
if(ry[1]<q1[i].second) ry[1]=q1[i].second;
if(lx[1]>q1[i].first) lx[1]=q1[i].first;
if(ly[1]>q1[i].second) ly[1]=q1[i].second;
}
for(i=0;i<c2;i++){
if(rx[2]<q2[i].first) rx[2]=q2[i].first;
if(ry[2]<q2[i].second) ry[2]=q2[i].second;
if(lx[2]>q2[i].first) lx[2]=q2[i].first;
if(ly[2]>q2[i].second) ly[2]=q2[i].second;
}
for(i=0;i<c3;i++){
if(rx[3]<q3[i].first) rx[3]=q3[i].first;
if(ry[3]<q3[i].second) ry[3]=q3[i].second;
if(lx[3]>q3[i].first) lx[3]=q3[i].first;
if(ly[3]>q3[i].second) ly[3]=q3[i].second;
}
for(i=0;i<c4;i++){
if(rx[4]<q4[i].first) rx[4]=q4[i].first;
if(ry[4]<q4[i].second) ry[4]=q4[i].second;
if(lx[4]>q4[i].first) lx[4]=q4[i].first;
if(ly[4]>q4[i].second) ly[4]=q4[i].second;
}
if(c1!=0||c2!=0||c3!=0||c4!=0){
if(q1[0].first!=0){
int ans=(rx[1]-lx[1])*(ry[1]-ly[1]);
cout<<"Q1: ("<<lx[1]<<", "<<ly[1]<<") ("<<rx[1]<<", "<<ry[1]<<") "<<ans;
}
if(q2[0].first!=0){
int ans=(rx[2]-lx[2])*(ry[2]-ly[2]);
cout<<"Q2: ("<<lx[2]<<", "<<ly[2]<<") ("<<rx[2]<<", "<<ry[2]<<") "<<ans;
}
if(q3[0].first!=0){
int ans=(rx[3]-lx[3])*(ry[3]-ly[3]);
cout<<"Q3: ("<<lx[3]<<", "<<ly[3]<<") ("<<rx[3]<<", "<<ry[3]<<") "<<ans;
}
if(q4[0].first!=0){
int ans=(rx[4]-lx[4])*(ry[4]-ly[4]);
cout<<"Q4: ("<<lx[4]<<", "<<ly[4]<<") ("<<rx[4]<<", "<<ry[4]<<") "<<ans;
}
}else cout<<"No point in any quadrant";
} | # 2069468, 2024-11-02 10:50:08, PPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
int i,c1=0,c2=0,c3=0,c4=0;
vector<int> x,y;
vector <pair<int,int>> q1,q2,q3,q4;
for(i=0;i<n;i++){
int a,b;
cin>>a>>b;
x.push_back(a);
y.push_back(b);
if(x[i]!=0&&y[i]!=0){
if(x[i]>0&&y[i]>0){
q1.push_back({x[i],y[i]});
c1++;
}
else if(x[i]<0&&y[i]>0){
q2.push_back({x[i],y[i]});
c2++;
}
else if(x[i]<0&&y[i]<0){
q3.push_back({x[i],y[i]});
c3++;
}
else if(x[i]>0&&y[i]<0){
q4.push_back({x[i],y[i]});
c4++;
}
}
}
int rx[5],ry[5],lx[5],ly[5];
for(i=0;i<5;i++){
rx[i]=-1e9;
ry[i]=-1e9;
lx[i]=1e9;
ly[i]=1e9;
}
for(i=0;i<c1;i++){
if(rx[1]<q1[i].first) rx[1]=q1[i].first;
if(ry[1]<q1[i].second) ry[1]=q1[i].second;
if(lx[1]>q1[i].first) lx[1]=q1[i].first;
if(ly[1]>q1[i].second) ly[1]=q1[i].second;
}
for(i=0;i<c2;i++){
if(rx[2]<q2[i].first) rx[2]=q2[i].first;
if(ry[2]<q2[i].second) ry[2]=q2[i].second;
if(lx[2]>q2[i].first) lx[2]=q2[i].first;
if(ly[2]>q2[i].second) ly[2]=q2[i].second;
}
for(i=0;i<c3;i++){
if(rx[3]<q3[i].first) rx[3]=q3[i].first;
if(ry[3]<q3[i].second) ry[3]=q3[i].second;
if(lx[3]>q3[i].first) lx[3]=q3[i].first;
if(ly[3]>q3[i].second) ly[3]=q3[i].second;
}
for(i=0;i<c4;i++){
if(rx[4]<q4[i].first) rx[4]=q4[i].first;
if(ry[4]<q4[i].second) ry[4]=q4[i].second;
if(lx[4]>q4[i].first) lx[4]=q4[i].first;
if(ly[4]>q4[i].second) ly[4]=q4[i].second;
}
if(c1!=0||c2!=0||c3!=0||c4!=0){
if(q1.size()!=0){
int ans=(rx[1]-lx[1])*(ry[1]-ly[1]);
cout<<"Q1: ("<<lx[1]<<", "<<ly[1]<<") ("<<rx[1]<<", "<<ry[1]<<") "<<ans<<endl;
}
if(q2.size()!=0){
int ans=(rx[2]-lx[2])*(ry[2]-ly[2]);
cout<<"Q2: ("<<lx[2]<<", "<<ly[2]<<") ("<<rx[2]<<", "<<ry[2]<<") "<<ans<<endl;
}
if(q3.size()!=0){
int ans=(rx[3]-lx[3])*(ry[3]-ly[3]);
cout<<"Q3: ("<<lx[3]<<", "<<ly[3]<<") ("<<rx[3]<<", "<<ry[3]<<") "<<ans<<endl;
}
if(q4.size()!=0){
int ans=(rx[4]-lx[4])*(ry[4]-ly[4]);
cout<<"Q4: ("<<lx[4]<<", "<<ly[4]<<") ("<<rx[4]<<", "<<ry[4]<<") "<<ans;
}
}else cout<<"No point in any quadrant";
} |
# 2069598, 2024-11-02 11:02:33, -----P---- (10%)
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
int x,y;
vector<int> q1, q2, q3, q4;
cin>>n;
for(int i=0; i<n; i++)
{
cin>>x>>y;
if(x>0 &&y>0)
{
q1.push_back(x);
q1.push_back(y);
}
else if(x<0 &&y>0)
{
q2.push_back(x);
q2.push_back(y);
}
else if(x<0 &&y<0)
{
q3.push_back(x);
q3.push_back(y);
}
else if(x>0 &&y<0)
{
q4.push_back(x);
q4.push_back(y);
}
}
if(q1.size() !=0)
{
cout<<"Q1: ";
for(int i=1; i<n*2; i++)
{
cout<<"("<<q1[i-1]<<", "<<q1[i]<<") ";
i++;
}
}
if(q1.size() ==0 && q2.size() ==0 && q3.size() ==0 && q4.size() ==0)
{
cout<<"No point in any quadrant";
}
} | # 2069778, 2024-11-02 11:23:59, ----PPPPPP (60%)
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
int x,y;
set<int> q1x, q2x, q3x, q4x, q1y, q2y, q3y, q4y;
set<int, greater<int>> q11x, q22x, q33x, q44x,q11y, q22y, q33y, q44y;
cin>>n;
for(int i=0; i<n; i++)
{
cin>>x>>y;
if(x>0 &&y>0)
{
q1x.insert(x);
q1y.insert(y);
q11x.insert(x);
q11y.insert(y);
}
else if(x<0 &&y>0)
{
q2x.insert(x);
q2y.insert(y);
q22x.insert(x);
q22y.insert(y);
}
else if(x<0 &&y<0)
{
q3x.insert(x);
q3y.insert(y);
q33x.insert(x);
q33y.insert(y);
}
else if(x>0 &&y<0)
{
q4x.insert(x);
q4y.insert(y);
q44x.insert(x);
q44y.insert(y);
}
}
if(q1x.size() !=0 && q1y.size() !=0)
{
cout<<"Q1: ("<<*q1x.begin()<<", "<<*q1y.begin()<<") ";
cout<<"("<<*q11x.begin()<<", "<<*q11y.begin()<<") ";
int a;
a = ((*q11x.begin()-*q1x.begin())*(*q11y.begin()-*q1y.begin()));
cout<<a<<endl;
}
if(q2x.size() !=0 && q2y.size() !=0)
{
cout<<"Q2: ("<<*q2x.begin()<<", "<<*q2y.begin()<<") ";
cout<<"("<<*q22x.begin()<<", "<<*q22y.begin()<<") ";
int a;
a = ((*q22x.begin()-*q2x.begin())*(*q22y.begin()-*q2y.begin()));
cout<<a<<endl;
}
if(q3x.size() !=0 && q3y.size() !=0)
{
cout<<"Q3: ("<<*q3x.begin()<<", "<<*q3y.begin()<<") ";
cout<<"("<<*q33x.begin()<<", "<<*q33y.begin()<<") ";
int a;
a = ((*q33x.begin()-*q3x.begin())*(*q33y.begin()-*q3y.begin()));
cout<<a<<endl;
}
if(q4x.size() !=0 && q4y.size() !=0)
{
cout<<"Q4: ("<<*q4x.begin()<<", "<<*q4y.begin()<<") ";
cout<<"("<<*q44x.begin()<<", "<<*q44y.begin()<<") ";
int a;
a = ((*q44x.begin()-*q4x.begin())*(*q44y.begin()-*q4y.begin()));
cout<<a<<endl;
}
else
{
cout<<"No point in any quadrant";
}
} | # 2069818, 2024-11-02 11:27:59, PPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
int x,y;
set<int> q1x, q2x, q3x, q4x, q1y, q2y, q3y, q4y;
set<int, greater<int>> q11x, q22x, q33x, q44x,q11y, q22y, q33y, q44y;
cin>>n;
for(int i=0; i<n; i++)
{
cin>>x>>y;
if(x>0 &&y>0)
{
q1x.insert(x);
q1y.insert(y);
q11x.insert(x);
q11y.insert(y);
}
else if(x<0 &&y>0)
{
q2x.insert(x);
q2y.insert(y);
q22x.insert(x);
q22y.insert(y);
}
else if(x<0 &&y<0)
{
q3x.insert(x);
q3y.insert(y);
q33x.insert(x);
q33y.insert(y);
}
else if(x>0 &&y<0)
{
q4x.insert(x);
q4y.insert(y);
q44x.insert(x);
q44y.insert(y);
}
}
if(q1x.size() !=0 && q1y.size() !=0)
{
cout<<"Q1: ("<<*q1x.begin()<<", "<<*q1y.begin()<<") ";
cout<<"("<<*q11x.begin()<<", "<<*q11y.begin()<<") ";
int a;
a = ((*q11x.begin()-*q1x.begin())*(*q11y.begin()-*q1y.begin()));
cout<<a<<endl;
}
if(q2x.size() !=0 && q2y.size() !=0)
{
cout<<"Q2: ("<<*q2x.begin()<<", "<<*q2y.begin()<<") ";
cout<<"("<<*q22x.begin()<<", "<<*q22y.begin()<<") ";
int a;
a = ((*q22x.begin()-*q2x.begin())*(*q22y.begin()-*q2y.begin()));
cout<<a<<endl;
}
if(q3x.size() !=0 && q3y.size() !=0)
{
cout<<"Q3: ("<<*q3x.begin()<<", "<<*q3y.begin()<<") ";
cout<<"("<<*q33x.begin()<<", "<<*q33y.begin()<<") ";
int a;
a = ((*q33x.begin()-*q3x.begin())*(*q33y.begin()-*q3y.begin()));
cout<<a<<endl;
}
if(q4x.size() !=0 && q4y.size() !=0)
{
cout<<"Q4: ("<<*q4x.begin()<<", "<<*q4y.begin()<<") ";
cout<<"("<<*q44x.begin()<<", "<<*q44y.begin()<<") ";
int a;
a = ((*q44x.begin()-*q4x.begin())*(*q44y.begin()-*q4y.begin()));
cout<<a<<endl;
}
else if((q1x.size() ==0 || q1y.size() ==0) && (q2x.size() ==0 || q2y.size() ==0) && (q3x.size() ==0 || q3y.size() ==0) && (q4x.size() ==0 || q4y.size() ==0))
{
cout<<"No point in any quadrant";
}
} |
# 2071381, 2024-11-02 14:29:31, P---PPP--- (40%)
#include<bits/stdc++.h>
using namespace std;
int main(){
vector<int> q1x,q1y,q2x,q2y,q3x,q3y,q4x,q4y;
int x,y,n;
cin>>n;
for(int i=0;i<n;i++){
cin>>x>>y;
if(x>0&&y>0){
q1x.push_back(x);
q1y.push_back(y);
}
if(x<0&&y>0){
q2x.push_back(x);
q2y.push_back(y);
}
if(x<0&&y<0){
q3x.push_back(x);
q3y.push_back(y);
}
if(x>0&&y<0){
q4x.push_back(x);
q4y.push_back(y);
}
}
sort(q1x.begin(),q1x.end());
sort(q1y.begin(),q1y.end());
sort(q2x.begin(),q2x.end());
sort(q2y.begin(),q2y.end());
sort(q3x.begin(),q3x.end());
sort(q3y.begin(),q3y.end());
sort(q4x.begin(),q4x.end());
sort(q4y.begin(),q4y.end());
if(q1x.empty()&&q1y.empty()&&q2x.empty()&&q2y.empty()&&q3x.empty()&&q3y.empty()&&q4x.empty()&&q4y.empty()){
cout<<"No point in any quadrant";
}
if(!(q1x.empty()&&q1y.empty())){
int x,y;
x=q1x[0]-q1x[q1x.size()-1];
x=abs(x);
y=q1y[0]-q1y[q1y.size()-1];
y=abs(y);
cout<<"Q1: ("<<q1x[0]<<", "<<q1y[0]<<") "<<'('<<q1x[q1x.size()-1]<<", "<<q1y[q1y.size()-1]<<") "<<x*y<<endl;
}
if(!(q2x.empty()&&q2y.empty())){
int x,y;
x=q2x[0]-q2x[q2x.size()-1];
x=abs(x);
y=q2y[0]-q2y[q2y.size()-1];
y=abs(y);
cout<<"Q2: ("<<q2x[0]<<", "<<q2y[0]<<") "<<'('<<q2x[q2x.size()-1]<<", "<<q2y[q1y.size()-1]<<") "<<x*y<<endl;
}
if(!(q3x.empty()&&q3y.empty())){
int x,y;
x=q3x[0]-q3x[q3x.size()-1];
x=abs(x);
y=q3y[0]-q3y[q3y.size()-1];
y=abs(y);
cout<<"Q3: ("<<q3x[0]<<", "<<q3y[0]<<") "<<'('<<q3x[q3x.size()-1]<<", "<<q3y[q3y.size()-1]<<") "<<x*y<<endl;
}
if(!(q4x.empty()&&q4y.empty())){
int x,y;
x=q4x[0]-q4x[q4x.size()-1];
x=abs(x);
y=q4y[0]-q4y[q4y.size()-1];
y=abs(y);
cout<<"Q4: ("<<q4x[0]<<", "<<q4y[0]<<") "<<'('<<q4x[q4x.size()-1]<<", "<<q4y[q4y.size()-1]<<") "<<x*y<<endl;
}
} | # 2071428, 2024-11-02 14:34:02, P---PPP--- (40%)
#include<bits/stdc++.h>
using namespace std;
int main(){
vector<int> q1x,q1y,q2x,q2y,q3x,q3y,q4x,q4y;
int x,y,n;
cin>>n;
for(int i=0;i<n;i++){
cin>>x>>y;
if(x>0&&y>0){
q1x.push_back(x);
q1y.push_back(y);
}
if(x<0&&y>0){
q2x.push_back(x);
q2y.push_back(y);
}
if(x<0&&y<0){
q3x.push_back(x);
q3y.push_back(y);
}
if(x>0&&y<0){
q4x.push_back(x);
q4y.push_back(y);
}
}
sort(q1x.begin(),q1x.end());
sort(q1y.begin(),q1y.end());
sort(q2x.begin(),q2x.end());
sort(q2y.begin(),q2y.end());
sort(q3x.begin(),q3x.end());
sort(q3y.begin(),q3y.end());
sort(q4x.begin(),q4x.end());
sort(q4y.begin(),q4y.end());
if(q1x.empty()&&q1y.empty()&&q2x.empty()&&q2y.empty()&&q3x.empty()&&q3y.empty()&&q4x.empty()&&q4y.empty()){
cout<<"No point in any quadrant";
}
if(!(q1x.empty()&&q1y.empty())){
int x,y;
x=q1x[0]-q1x[q1x.size()-1];
x=abs(x);
y=q1y[0]-q1y[q1y.size()-1];
y=abs(y);
cout<<"Q1: ("<<q1x[0]<<", "<<q1y[0]<<") "<<'('<<q1x[q1x.size()-1]<<", "<<q1y[q1y.size()-1]<<") "<<x*y<<endl;
}
if(!(q2x.empty()&&q2y.empty())){
int x,y;
x=q2x[0]-q2x[q2x.size()-1];
x=abs(x);
y=q2y[0]-q2y[q2y.size()-1];
y=abs(y);
cout<<"Q2: ("<<q2x[0]<<", "<<q2y[0]<<") "<<'('<<q2x[q2x.size()-1]<<", "<<q2y[q1y.size()-1]<<") "<<x*y<<endl;
}
if(!(q3x.empty()&&q3y.empty())){
int x,y;
x=q3x[0]-q3x[q3x.size()-1];
x=abs(x);
y=q3y[0]-q3y[q3y.size()-1];
y=abs(y);
cout<<"Q3: ("<<q3x[0]<<", "<<q3y[0]<<") "<<'('<<q3x[q3x.size()-1]<<", "<<q3y[q3y.size()-1]<<") "<<x*y<<endl;
}
if(!(q4x.empty()&&q4y.empty())){
int x,y;
x=q4x[0]-q4x[q4x.size()-1];
x=abs(x);
y=q4y[0]-q4y[q4y.size()-1];
y=abs(y);
cout<<"Q4: ("<<q4x[0]<<", "<<q4y[0]<<") "<<'('<<q4x[q4x.size()-1]<<", "<<q4y[q4y.size()-1]<<") "<<x*y<<endl;
}
} | # 2071448, 2024-11-02 14:36:23, PPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
int main(){
vector<int> q1x,q1y,q2x,q2y,q3x,q3y,q4x,q4y;
int x,y,n;
cin>>n;
for(int i=0;i<n;i++){
cin>>x>>y;
if(x>0&&y>0){
q1x.push_back(x);
q1y.push_back(y);
}
if(x<0&&y>0){
q2x.push_back(x);
q2y.push_back(y);
}
if(x<0&&y<0){
q3x.push_back(x);
q3y.push_back(y);
}
if(x>0&&y<0){
q4x.push_back(x);
q4y.push_back(y);
}
}
sort(q1x.begin(),q1x.end());
sort(q1y.begin(),q1y.end());
sort(q2x.begin(),q2x.end());
sort(q2y.begin(),q2y.end());
sort(q3x.begin(),q3x.end());
sort(q3y.begin(),q3y.end());
sort(q4x.begin(),q4x.end());
sort(q4y.begin(),q4y.end());
if(q1x.empty()&&q1y.empty()&&q2x.empty()&&q2y.empty()&&q3x.empty()&&q3y.empty()&&q4x.empty()&&q4y.empty()){
cout<<"No point in any quadrant";
}
if(!(q1x.empty()&&q1y.empty())){
int x,y;
x=q1x[0]-q1x[q1x.size()-1];
x=abs(x);
y=q1y[0]-q1y[q1y.size()-1];
y=abs(y);
cout<<"Q1: ("<<q1x[0]<<", "<<q1y[0]<<") "<<'('<<q1x[q1x.size()-1]<<", "<<q1y[q1y.size()-1]<<") "<<x*y<<endl;
}
if(!(q2x.empty()&&q2y.empty())){
int x,y;
x=q2x[0]-q2x[q2x.size()-1];
x=abs(x);
y=q2y[0]-q2y[q2y.size()-1];
y=abs(y);
cout<<"Q2: ("<<q2x[0]<<", "<<q2y[0]<<") "<<'('<<q2x[q2x.size()-1]<<", "<<q2y[q2y.size()-1]<<") "<<x*y<<endl;
}
if(!(q3x.empty()&&q3y.empty())){
int x,y;
x=q3x[0]-q3x[q3x.size()-1];
x=abs(x);
y=q3y[0]-q3y[q3y.size()-1];
y=abs(y);
cout<<"Q3: ("<<q3x[0]<<", "<<q3y[0]<<") "<<'('<<q3x[q3x.size()-1]<<", "<<q3y[q3y.size()-1]<<") "<<x*y<<endl;
}
if(!(q4x.empty()&&q4y.empty())){
int x,y;
x=q4x[0]-q4x[q4x.size()-1];
x=abs(x);
y=q4y[0]-q4y[q4y.size()-1];
y=abs(y);
cout<<"Q4: ("<<q4x[0]<<", "<<q4y[0]<<") "<<'('<<q4x[q4x.size()-1]<<", "<<q4y[q4y.size()-1]<<") "<<x*y<<endl;
}
} |
# 2068789, 2024-11-02 09:36:37, -----P---- (10%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n; vector <int> x; vector <int> y; int xx,yy;
cin>>n;
for(int i=0;i<n;i++){
cin>>xx>>yy;
x.push_back(xx); y.push_back(yy);
if(xx==0||yy==0){x.pop_back(); y.pop_back();}
}
// for(int i=0;i<n;i++){
// if(x[i]>0&&x[i]>0){ //Q1
// }
// else if(x[i]<0&&y[i]>0){ //Q2
// }
// else if(x[i]<0&&y[i]<0){ //Q3
// }else if(x[i]>0&&y[i]<0){ //Q4
// }
// }
if(x.empty()&&y.empty()){cout<<"No point in any quadrant";}
} | # 2070141, 2024-11-02 11:53:38, -----P---- (10%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n; vector <int> x; vector <int> y; int xx,yy;
vector <int> q1x,q1y,q2x,q2y,q3x,q3y,q4x,q4y;
cin>>n;
for(int i=0;i<n;i++){
cin>>xx>>yy;
x.push_back(xx); y.push_back(yy);
if(xx==0||yy==0){x.pop_back(); y.pop_back();}
if(xx>0&&yy>0){q1x.push_back(xx); q1y.push_back(yy);}
else if(xx<0&&yy>0) {q2x.push_back(xx); q2y.push_back(yy);}
else if(xx<0&&yy<0) {q3x.push_back(xx); q3y.push_back(yy);}
else if(xx>0&&yy<0){q4x.push_back(xx); q4y.push_back(yy);}
}
sort(q1x.begin(),q1x.end()); sort(q1y.begin(),q1y.end());
sort(q2x.begin(),q2x.end()); sort(q2y.begin(),q2y.end());
sort(q3x.begin(),q3x.end()); sort(q3y.begin(),q3y.end());
sort(q4x.begin(),q4x.end()); sort(q4y.begin(),q4y.end());
if(x.empty()&&y.empty()){cout<<"No point in any quadrant";}
if(!q1x.empty()){
int ans=(q1x[n-1]-q1x[0])*(q1y[n-1]-q1y[0]);
cout<<"Q1: ("<<q1x[0]<<", "<<q1y[0]<<") ("<<q1x[n-1]<<", "<<q1x[0]<<") "<<ans;}
} | # 2070332, 2024-11-02 12:04:01, PPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n; vector <int> x; vector <int> y; int xx,yy;
vector <int> q1x,q1y,q2x,q2y,q3x,q3y,q4x,q4y;
cin>>n;
for(int i=0;i<n;i++){
cin>>xx>>yy;
x.push_back(xx); y.push_back(yy);
if(xx==0||yy==0){x.pop_back(); y.pop_back();}
if(xx>0&&yy>0){q1x.push_back(xx); q1y.push_back(yy);}
else if(xx<0&&yy>0) {q2x.push_back(xx); q2y.push_back(yy);}
else if(xx<0&&yy<0) {q3x.push_back(xx); q3y.push_back(yy);}
else if(xx>0&&yy<0){q4x.push_back(xx); q4y.push_back(yy);}
}
sort(q1x.begin(),q1x.end()); sort(q1y.begin(),q1y.end());
sort(q2x.begin(),q2x.end()); sort(q2y.begin(),q2y.end());
sort(q3x.begin(),q3x.end()); sort(q3y.begin(),q3y.end());
sort(q4x.begin(),q4x.end()); sort(q4y.begin(),q4y.end());
if(x.empty()&&y.empty()){cout<<"No point in any quadrant";}
if(!q1x.empty()){
int ans=(q1x[q1x.size()-1]-q1x[0])*(q1y[q1y.size()-1]-q1y[0]);
cout<<"Q1: ("<<q1x[0]<<", "<<q1y[0]<<") ("<<q1x[q1x.size()-1]<<", "<<q1y[q1y.size()-1]<<") "<<ans<<endl;}
if(!q2x.empty()){
int ans=(q2x[q2x.size()-1]-q2x[0])*(q2y[q2y.size()-1]-q2y[0]);
cout<<"Q2: ("<<q2x[0]<<", "<<q2y[0]<<") ("<<q2x[q2x.size()-1]<<", "<<q2y[q2y.size()-1]<<") "<<ans<<endl;}
if(!q3x.empty()){
int ans=(q3x[q3x.size()-1]-q3x[0])*(q3y[q3y.size()-1]-q3y[0]);
cout<<"Q3: ("<<q3x[0]<<", "<<q3y[0]<<") ("<<q3x[q3x.size()-1]<<", "<<q3y[q3y.size()-1]<<") "<<ans<<endl;}
if(!q4x.empty()){
int ans=(q4x[q4x.size()-1]-q4x[0])*(q4y[q4y.size()-1]-q4y[0]);
cout<<"Q4: ("<<q4x[0]<<", "<<q4y[0]<<") ("<<q4x[q4x.size()-1]<<", "<<q4y[q4y.size()-1]<<") "<<ans<<endl;}
} |
# 2069201, 2024-11-02 10:25:30, PPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int x,y;
int n; cin >> n;
set<pair<int,int>> q1,q2,q3,q4;
set<int> q1x,q1y,q2x,q2y,q3x,q3y,q4x,q4y;bool count = false;
for(int i = 0;i<n;i++){
cin >> x;
cin >> y;
if(x==0||y==0) continue;
else if(x>0 && y>0){
q1.insert(make_pair(x,y));
q1x.insert(x);
q1y.insert(y);
}
else if(x<0 && y>0){
q2.insert(make_pair(x,y));
q2x.insert(x);
q2y.insert(y);
}
else if(x<0 && y<0){
q3.insert(make_pair(x,y));
q3x.insert(x);
q3y.insert(y);
}
else if(x>0 && y<0){
q4.insert(make_pair(x,y));
q4x.insert(x);
q4y.insert(y);
}
count = true;
}
/*
for(auto e : q1y){
cout << "debug " << e << endl;
}
*/
if(!count) cout << "No point in any quadrant" << endl;
else{if(q1.size() !=0){
cout << "Q1: ";
auto itr1 = q1x.end(); itr1--; auto itr2 = q1y.end(); itr2--;
int xmax = (*itr1),ymax= (*itr2);
int xmin = *q1x.begin(),ymin = *q1y.begin();
cout << "("<<xmin<<", " << ymin<<")" << " ";
cout << "("<<xmax<<", " << ymax<<")" << " ";
cout << (xmax-xmin)*(ymax-ymin);
cout << endl;
}
if(q2.size() !=0){
cout << "Q2: ";
auto itr1 = q2x.end(); itr1--; auto itr2 = q2y.end(); itr2--;
int xmax = (*itr1),ymax= (*itr2);
int xmin = *q2x.begin(),ymin = *q2y.begin();
cout << "("<<xmin<<", " << ymin<<")" << " ";
cout << "("<<xmax<<", " << ymax<<")" << " ";
cout << (xmax-xmin)*(ymax-ymin);
cout << endl;
}
if(q3.size() !=0){
cout << "Q3: ";
auto itr1 = q3x.end(); itr1--; auto itr2 = q3y.end(); itr2--;
int xmax = (*itr1),ymax= (*itr2);
int xmin = *q3x.begin(),ymin = *q3y.begin();
cout << "("<<xmin<<", " << ymin<<")" << " ";
cout << "("<<xmax<<", " << ymax<<")" << " ";
cout << (xmax-xmin)*(ymax-ymin);
cout << endl;
}
if(q4.size() !=0){
cout << "Q4: ";
auto itr1 = q4x.end(); itr1--; auto itr2 = q4y.end(); itr2--;
int xmax = (*itr1),ymax= (*itr2);
int xmin = *q4x.begin(),ymin = *q4y.begin();
cout << "("<<xmin<<", " << ymin<<")" << " ";
cout << "("<<xmax<<", " << ymax<<")" << " ";
cout << (xmax-xmin)*(ymax-ymin);
cout << endl;
}
}
} | # 2070110, 2024-11-02 11:51:30, ---------- (0%)
#include<iostream>
int main(){
std::cout << " " ;
} | # 2070112, 2024-11-02 11:51:43, PPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int x,y;
int n; cin >> n;
set<pair<int,int>> q1,q2,q3,q4;
set<int> q1x,q1y,q2x,q2y,q3x,q3y,q4x,q4y;bool count = false;
for(int i = 0;i<n;i++){
cin >> x;
cin >> y;
if(x==0||y==0) continue;
else if(x>0 && y>0){
q1.insert(make_pair(x,y));
q1x.insert(x);
q1y.insert(y);
}
else if(x<0 && y>0){
q2.insert(make_pair(x,y));
q2x.insert(x);
q2y.insert(y);
}
else if(x<0 && y<0){
q3.insert(make_pair(x,y));
q3x.insert(x);
q3y.insert(y);
}
else if(x>0 && y<0){
q4.insert(make_pair(x,y));
q4x.insert(x);
q4y.insert(y);
}
count = true;
}
/*
for(auto e : q1y){
cout << "debug " << e << endl;
}
*/
if(!count) cout << "No point in any quadrant" << endl;
else{if(q1.size() !=0){
cout << "Q1: ";
auto itr1 = q1x.end(); itr1--; auto itr2 = q1y.end(); itr2--;
int xmax = (*itr1),ymax= (*itr2);
int xmin = *q1x.begin(),ymin = *q1y.begin();
cout << "("<<xmin<<", " << ymin<<")" << " ";
cout << "("<<xmax<<", " << ymax<<")" << " ";
cout << (xmax-xmin)*(ymax-ymin);
cout << endl;
}
if(q2.size() !=0){
cout << "Q2: ";
auto itr1 = q2x.end(); itr1--; auto itr2 = q2y.end(); itr2--;
int xmax = (*itr1),ymax= (*itr2);
int xmin = *q2x.begin(),ymin = *q2y.begin();
cout << "("<<xmin<<", " << ymin<<")" << " ";
cout << "("<<xmax<<", " << ymax<<")" << " ";
cout << (xmax-xmin)*(ymax-ymin);
cout << endl;
}
if(q3.size() !=0){
cout << "Q3: ";
auto itr1 = q3x.end(); itr1--; auto itr2 = q3y.end(); itr2--;
int xmax = (*itr1),ymax= (*itr2);
int xmin = *q3x.begin(),ymin = *q3y.begin();
cout << "("<<xmin<<", " << ymin<<")" << " ";
cout << "("<<xmax<<", " << ymax<<")" << " ";
cout << (xmax-xmin)*(ymax-ymin);
cout << endl;
}
if(q4.size() !=0){
cout << "Q4: ";
auto itr1 = q4x.end(); itr1--; auto itr2 = q4y.end(); itr2--;
int xmax = (*itr1),ymax= (*itr2);
int xmin = *q4x.begin(),ymin = *q4y.begin();
cout << "("<<xmin<<", " << ymin<<")" << " ";
cout << "("<<xmax<<", " << ymax<<")" << " ";
cout << (xmax-xmin)*(ymax-ymin);
cout << endl;
}
}
} |
# 2070000, 2024-11-02 11:43:58, ----P-PP-P (40%)
#include <bits/stdc++.h>
using namespace std;
map<int ,int > q1x,q2x,q3x,q4x,q1y,q2y,q3y,q4y;
int main()
{
int n ,tmp,cq1=0,cq2=0,cq3=0,cq4=0;
cin >>n;
tmp = n;
int x[n],y[n];
for(int i = 0 ; i < tmp ;i++)
{
cin >>x[i]>>y[i];
if (x[i]==0||y[i]==0)
{
i--;
tmp--;
}
}
for (int i = 0 ;i<tmp;i++)
{
if(x[i]>0&&y[i]>0)
{
q1x[cq1] = x[i];
q1y[cq1] = y[i];
cq1++;
}
}
for (int i = 0 ;i<tmp;i++)
{
// cout <<cq2<<" "<<q2[cq2-1]<<" "<<x[i]<<endl;
if(x[i]<0&&y[i]>0)
{
q2x[cq2] = x[i];
q2y[cq2] = y[i];
cq2++;
}
}
for (int i = 0 ;i<tmp;i++)
{
if(x[i]<0&&y[i]<0)
{
q3x[cq3] = x[i];
q3y[cq3] = y[i];
cq3++;
}
}
for (int i = 0 ;i<tmp;i++)
{
if(x[i]>0&&y[i]<0)
{
q4x[cq4] = x[i];
q4y[cq4] = y[i];
cq4++;
}
}
int mnx = INT_MAX,mny = INT_MAX,mxx = INT_MIN,mxy=INT_MIN;
cout <<"Q1: (";
for (int i = 0;i<cq1;i++)
{
mnx = min(mnx,q1x[i]);
mny = min(mny,q1y[i]);
mxx = max(mxx,q1x[i]);
mxy = max(mxy,q1y[i]);
if(i==cq1-1)
{
cout <<mnx<<", "<<mny<<") ("<<mxx<<", "<<mxy<<") "<<(mxx-mnx)*(mxy-mny)<<endl;
}
}
mnx = INT_MAX;mny = INT_MAX;mxx = INT_MIN;mxy=INT_MIN;
cout <<"Q2: (";
for (int i = 0 ; i<cq2; i++)
{
mnx = min(mnx,q2x[i]);
mny = min(mny,q2y[i]);
mxx = max(mxx,q2x[i]);
mxy = max(mxy,q2y[i]);
if(i==cq2-1)
{
cout <<mnx<<", "<<mny<<") ("<<mxx<<", "<<mxy<<") "<<(mxx-mnx)*(mxy-mny)<<endl;
}
}
mnx = INT_MAX;mny = INT_MAX;mxx = INT_MIN;mxy=INT_MIN;
cout <<"Q3: (";
for (int i = 0 ; i<cq3; i++)
{
mnx = min(mnx,q3x[i]);
mny = min(mny,q3y[i]);
mxx = max(mxx,q3x[i]);
mxy = max(mxy,q3y[i]);
if(i==cq3-1)
{
cout <<mnx<<", "<<mny<<") ("<<mxx<<", "<<mxy<<") "<<(mxx-mnx)*(mxy-mny)<<endl;
}
}
mnx = INT_MAX;mny = INT_MAX;mxx = INT_MIN;mxy=INT_MIN;
cout <<"Q4: (";
for (int i = 0 ; i<cq4; i++)
{
mnx = min(mnx,q4x[i]);
mny = min(mny,q4y[i]);
mxx = max(mxx,q4x[i]);
mxy = max(mxy,q4y[i]);
if(i==cq4-1)
{
cout <<mnx<<", "<<mny<<") ("<<mxx<<", "<<mxy<<") "<<(mxx-mnx)*(mxy-mny)<<endl;
}
}
} | # 2070059, 2024-11-02 11:48:11, Compilation error (0%)
#include <bits/stdc++.h>
using namespace std;
map<int ,int > q1x,q2x,q3x,q4x,q1y,q2y,q3y,q4y;
int main()
{
int n ,tmp,cq1=0,cq2=0,cq3=0,cq4=0;
cin >>n;
tmp = n;
int x[n],y[n];
for(int i = 0 ; i < tmp ;i++)
{
cin >>x[i]>>y[i];
if (x[i]==0||y[i]==0)
{
i--;
tmp--;
}
}
for (int i = 0 ;i<tmp;i++)
{
if(x[i]>0&&y[i]>0)
{
q1x[cq1] = x[i];
q1y[cq1] = y[i];
cq1++;
}
}
for (int i = 0 ;i<tmp;i++)
{
// cout <<cq2<<" "<<q2[cq2-1]<<" "<<x[i]<<endl;
if(x[i]<0&&y[i]>0)
{
q2x[cq2] = x[i];
q2y[cq2] = y[i];
cq2++;
}
}
for (int i = 0 ;i<tmp;i++)
{
if(x[i]<0&&y[i]<0)
{
q3x[cq3] = x[i];
q3y[cq3] = y[i];
cq3++;
}
}
for (int i = 0 ;i<tmp;i++)
{
if(x[i]>0&&y[i]<0)
{
q4x[cq4] = x[i];
q4y[cq4] = y[i];
cq4++;
}
}
int mnx = INT_MAX,mny = INT_MAX,mxx = INT_MIN,mxy=INT_MIN;
if (cq1 >=1){cout <<"Q1: (";
for (int i = 0;i<cq1;i++)
{
mnx = min(mnx,q1x[i]);
mny = min(mny,q1y[i]);
mxx = max(mxx,q1x[i]);
mxy = max(mxy,q1y[i]);
if(i==cq1-1)
{
cout <<mnx<<", "<<mny<<") ("<<mxx<<", "<<mxy<<") "<<(mxx-mnx)*(mxy-mny)<<endl;
}
}}
if (cq2 >=1){mnx = INT_MAX;mny = INT_MAX;mxx = INT_MIN;mxy=INT_MIN;
cout <<"Q2: (";
for (int i = 0 ; i<cq2; i++)
{
mnx = min(mnx,q2x[i]);
mny = min(mny,q2y[i]);
mxx = max(mxx,q2x[i]);
mxy = max(mxy,q2y[i]);
if(i==cq2-1)
{
cout <<mnx<<", "<<mny<<") ("<<mxx<<", "<<mxy<<") "<<(mxx-mnx)*(mxy-mny)<<endl;
}
}}
if (cq3 >=1){mnx = INT_MAX;mny = INT_MAX;mxx = INT_MIN;mxy=INT_MIN;
cout <<"Q3: (";
for (int i = 0 ; i<cq3; i++)
{
mnx = min(mnx,q3x[i]);
mny = min(mny,q3y[i]);
mxx = max(mxx,q3x[i]);
mxy = max(mxy,q3y[i]);
if(i==cq3-1)
{
cout <<mnx<<", "<<mny<<") ("<<mxx<<", "<<mxy<<") "<<(mxx-mnx)*(mxy-mny)<<endl;
}
}}
if (cq4 >=1){mnx = INT_MAX;mny = INT_MAX;mxx = INT_MIN;mxy=INT_MIN;
cout <<"Q4: (";
for (int i = 0 ; i<cq4; i++)
{
mnx = min(mnx,q4x[i]);
mny = min(mny,q4y[i]);
mxx = max(mxx,q4x[i]);
mxy = max(mxy,q4y[i]);
if(i==cq4-1)
{
cout <<mnx<<", "<<mny<<") ("<<mxx<<", "<<mxy<<") "<<(mxx-mnx)*(mxy-mny)<<endl;
}
}}
if (cq1==0&&cq2==0&&cq3==0&&cq4==0&&) cout <<"No point in any quadrant";
} | # 2070061, 2024-11-02 11:48:23, PPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std;
map<int ,int > q1x,q2x,q3x,q4x,q1y,q2y,q3y,q4y;
int main()
{
int n ,tmp,cq1=0,cq2=0,cq3=0,cq4=0;
cin >>n;
tmp = n;
int x[n],y[n];
for(int i = 0 ; i < tmp ;i++)
{
cin >>x[i]>>y[i];
if (x[i]==0||y[i]==0)
{
i--;
tmp--;
}
}
for (int i = 0 ;i<tmp;i++)
{
if(x[i]>0&&y[i]>0)
{
q1x[cq1] = x[i];
q1y[cq1] = y[i];
cq1++;
}
}
for (int i = 0 ;i<tmp;i++)
{
// cout <<cq2<<" "<<q2[cq2-1]<<" "<<x[i]<<endl;
if(x[i]<0&&y[i]>0)
{
q2x[cq2] = x[i];
q2y[cq2] = y[i];
cq2++;
}
}
for (int i = 0 ;i<tmp;i++)
{
if(x[i]<0&&y[i]<0)
{
q3x[cq3] = x[i];
q3y[cq3] = y[i];
cq3++;
}
}
for (int i = 0 ;i<tmp;i++)
{
if(x[i]>0&&y[i]<0)
{
q4x[cq4] = x[i];
q4y[cq4] = y[i];
cq4++;
}
}
int mnx = INT_MAX,mny = INT_MAX,mxx = INT_MIN,mxy=INT_MIN;
if (cq1 >=1){cout <<"Q1: (";
for (int i = 0;i<cq1;i++)
{
mnx = min(mnx,q1x[i]);
mny = min(mny,q1y[i]);
mxx = max(mxx,q1x[i]);
mxy = max(mxy,q1y[i]);
if(i==cq1-1)
{
cout <<mnx<<", "<<mny<<") ("<<mxx<<", "<<mxy<<") "<<(mxx-mnx)*(mxy-mny)<<endl;
}
}}
if (cq2 >=1){mnx = INT_MAX;mny = INT_MAX;mxx = INT_MIN;mxy=INT_MIN;
cout <<"Q2: (";
for (int i = 0 ; i<cq2; i++)
{
mnx = min(mnx,q2x[i]);
mny = min(mny,q2y[i]);
mxx = max(mxx,q2x[i]);
mxy = max(mxy,q2y[i]);
if(i==cq2-1)
{
cout <<mnx<<", "<<mny<<") ("<<mxx<<", "<<mxy<<") "<<(mxx-mnx)*(mxy-mny)<<endl;
}
}}
if (cq3 >=1){mnx = INT_MAX;mny = INT_MAX;mxx = INT_MIN;mxy=INT_MIN;
cout <<"Q3: (";
for (int i = 0 ; i<cq3; i++)
{
mnx = min(mnx,q3x[i]);
mny = min(mny,q3y[i]);
mxx = max(mxx,q3x[i]);
mxy = max(mxy,q3y[i]);
if(i==cq3-1)
{
cout <<mnx<<", "<<mny<<") ("<<mxx<<", "<<mxy<<") "<<(mxx-mnx)*(mxy-mny)<<endl;
}
}}
if (cq4 >=1){mnx = INT_MAX;mny = INT_MAX;mxx = INT_MIN;mxy=INT_MIN;
cout <<"Q4: (";
for (int i = 0 ; i<cq4; i++)
{
mnx = min(mnx,q4x[i]);
mny = min(mny,q4y[i]);
mxx = max(mxx,q4x[i]);
mxy = max(mxy,q4y[i]);
if(i==cq4-1)
{
cout <<mnx<<", "<<mny<<") ("<<mxx<<", "<<mxy<<") "<<(mxx-mnx)*(mxy-mny)<<endl;
}
}}
if (cq1==0&&cq2==0&&cq3==0&&cq4==0) cout <<"No point in any quadrant";
} |
# 2070997, 2024-11-02 13:42:20, PPPP-P---- (50%)
#include <iostream>
#include <map>
#include <vector>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <cmath>
#include <algorithm>
#include <cctype>
using namespace std;
tuple<int, int, int, int> Q1, Q2, Q3, Q4; // dXmin dXmax dYmin dYmax
bool checkifEm(tuple<int, int, int, int> t)
{
if (get<1>(t) == -1)
return true;
return false;
}
int main()
{
int count;
cin >> count;
get<0>(Q1) = 100000000;
get<1>(Q1) = -1;
get<2>(Q1) = 100000000;
get<3>(Q1) = -1;
get<0>(Q2) = 100000000;
get<1>(Q2) = -1;
get<2>(Q2) = 100000000;
get<3>(Q2) = -1;
get<0>(Q3) = 100000000;
get<1>(Q3) = -1;
get<2>(Q3) = 100000000;
get<3>(Q3) = -1;
get<0>(Q4) = 100000000;
get<1>(Q4) = -1;
get<2>(Q4) = 100000000;
get<3>(Q4) = -1;
// cout << get<0>(Q1);
while (count--)
{
int x, y;
cin >> x >> y;
if (x == 0 || y == 0)
continue;
if (x > 0 && y > 0)
{
x = abs(x);
y = abs(y);
get<0>(Q1) = min(get<0>(Q1), x);
get<1>(Q1) = max(get<1>(Q1), x);
get<2>(Q1) = min(get<2>(Q1), y);
get<3>(Q1) = max(get<3>(Q1), y);
}
if (x < 0 && y > 0)
{
x = abs(x);
y = abs(y);
get<0>(Q2) = min(get<0>(Q2), x);
get<1>(Q2) = max(get<1>(Q2), x);
get<2>(Q2) = min(get<2>(Q2), y);
get<3>(Q2) = max(get<3>(Q2), y);
}
if (x < 0 && y < 0)
{
x = abs(x);
y = abs(y);
get<0>(Q3) = min(get<0>(Q3), x);
get<1>(Q3) = max(get<1>(Q3), x);
get<2>(Q3) = min(get<2>(Q3), y);
get<3>(Q3) = max(get<3>(Q3), y);
}
if (x > 0 && y < 0)
{
x = abs(x);
y = abs(y);
get<0>(Q4) = min(get<0>(Q4), x);
get<1>(Q4) = max(get<1>(Q4), x);
get<2>(Q4) = min(get<2>(Q4), y);
get<3>(Q4) = max(get<3>(Q4), y);
}
}
// dXmin dXmax dYmin dYmax
// Q1
bool Q1em = checkifEm(Q1);
bool Q2em = checkifEm(Q2), Q3em = checkifEm(Q3), Q4em = checkifEm(Q4);
if(Q1em && Q2em && Q3em && Q4em) {cout << "No point in any quadrant"; return 0;}
if (!Q1em)
{
int x1 = get<0>(Q1), y1 = get<2>(Q1), x2 = get<1>(Q1), y2 = get<3>(Q1);
cout << "Q1: (" << x1 << ", "
<< y1 << ") (" << x2 << ", "
<< y2 << ") " << (abs(x1 - x2) * abs(y1 - y2)) << endl;
}
if (!Q2em)
{
int x1 = -get<1>(Q2), y1 = get<2>(Q2), x2 = -get<0>(Q2), y2 = get<3>(Q2);
cout << "Q2: (" << x1 << ", "
<< y1 << ") (" << x2 << ", "
<< y2 << ") " << (abs(x1 - x2) * abs(y1 - y2)) << endl;
}
if (!Q3em)
{
int x1 = -get<1>(Q3), y1 = -get<3>(Q3), x2 = -get<0>(Q3), y2 = -get<2>(Q3);
cout << "Q3: (" << x1 << ", "
<< y1 << ") (" << x2 << ", "
<< y2 << ") " << (abs(x1 - x2) * abs(y1 - y2)) << endl;
}
if (!Q4em)
{
int x1 = get<0>(Q4), y1 = get<3>(Q4), x2 = get<1>(Q4), y2 = get<2>(Q4);
cout << "Q4: (" << x1 << ", "
<< y1 << ") (" << x2 << ", "
<< y2 << ") " << (abs(x1 - x2) * abs(y1 - y2)) << endl;
}
} | # 2071025, 2024-11-02 13:47:01, PPPP-P---- (50%)
#include <iostream>
#include <map>
#include <vector>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <cmath>
#include <algorithm>
#include <cctype>
using namespace std;
tuple<long long int, long long int, long long int, long long int> Q1, Q2, Q3, Q4; // dXmin dXmax dYmin dYmax
bool checkifEm(tuple<long long int, long long int, long long int, long long int> t)
{
if (get<1>(t) == -1)
return true;
return false;
}
int main()
{
long long int count;
cin >> count;
get<0>(Q1) = 100000000;
get<1>(Q1) = -1;
get<2>(Q1) = 100000000;
get<3>(Q1) = -1;
get<0>(Q2) = 100000000;
get<1>(Q2) = -1;
get<2>(Q2) = 100000000;
get<3>(Q2) = -1;
get<0>(Q3) = 100000000;
get<1>(Q3) = -1;
get<2>(Q3) = 100000000;
get<3>(Q3) = -1;
get<0>(Q4) = 100000000;
get<1>(Q4) = -1;
get<2>(Q4) = 100000000;
get<3>(Q4) = -1;
// cout << get<0>(Q1);
while (count--)
{
long long int x, y;
cin >> x >> y;
if (x == 0 || y == 0)
continue;
if (x > 0 && y > 0)
{
x = abs(x);
y = abs(y);
get<0>(Q1) = min(get<0>(Q1), x);
get<1>(Q1) = max(get<1>(Q1), x);
get<2>(Q1) = min(get<2>(Q1), y);
get<3>(Q1) = max(get<3>(Q1), y);
}
if (x < 0 && y > 0)
{
x = abs(x);
y = abs(y);
get<0>(Q2) = min(get<0>(Q2), x);
get<1>(Q2) = max(get<1>(Q2), x);
get<2>(Q2) = min(get<2>(Q2), y);
get<3>(Q2) = max(get<3>(Q2), y);
}
if (x < 0 && y < 0)
{
x = abs(x);
y = abs(y);
get<0>(Q3) = min(get<0>(Q3), x);
get<1>(Q3) = max(get<1>(Q3), x);
get<2>(Q3) = min(get<2>(Q3), y);
get<3>(Q3) = max(get<3>(Q3), y);
}
if (x > 0 && y < 0)
{
x = abs(x);
y = abs(y);
get<0>(Q4) = min(get<0>(Q4), x);
get<1>(Q4) = max(get<1>(Q4), x);
get<2>(Q4) = min(get<2>(Q4), y);
get<3>(Q4) = max(get<3>(Q4), y);
}
}
// dXmin dXmax dYmin dYmax
// Q1
bool Q1em = checkifEm(Q1);
bool Q2em = checkifEm(Q2), Q3em = checkifEm(Q3), Q4em = checkifEm(Q4);
if(Q1em && Q2em && Q3em && Q4em) {cout << "No point in any quadrant"; return 0;}
if (!Q1em)
{
long long int x1 = get<0>(Q1), y1 = get<2>(Q1), x2 = get<1>(Q1), y2 = get<3>(Q1);
cout << "Q1: (" << x1 << ", "
<< y1 << ") (" << x2 << ", "
<< y2 << ") " << (abs(x1 - x2) * abs(y1 - y2)) << endl;
}
if (!Q2em)
{
long long int x1 = -get<1>(Q2), y1 = get<2>(Q2), x2 = -get<0>(Q2), y2 = get<3>(Q2);
cout << "Q2: (" << x1 << ", "
<< y1 << ") (" << x2 << ", "
<< y2 << ") " << (abs(x1 - x2) * abs(y1 - y2)) << endl;
}
if (!Q3em)
{
long long int x1 = -get<1>(Q3), y1 = -get<3>(Q3), x2 = -get<0>(Q3), y2 = -get<2>(Q3);
cout << "Q3: (" << x1 << ", "
<< y1 << ") (" << x2 << ", "
<< y2 << ") " << (abs(x1 - x2) * abs(y1 - y2)) << endl;
}
if (!Q4em)
{
long long int x1 = get<0>(Q4), y1 = get<3>(Q4), x2 = get<1>(Q4), y2 = get<2>(Q4);
cout << "Q4: (" << x1 << ", "
<< y1 << ") (" << x2 << ", "
<< y2 << ") " << (abs(x1 - x2) * abs(y1 - y2)) << endl;
}
} | # 2071875, 2024-11-02 15:24:23, PPPPPPPPPP (100%)
#include <iostream>
#include <map>
#include <vector>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <cmath>
#include <algorithm>
#include <cctype>
using namespace std;
bool checkifEm(vector<int> v)
{
if (v[0] == 0)
return true;
return false;
}
int main()
{
int count; cin >> count;
vector<int> Q1(4, 0); // dxmin dxmax dymin dymax
vector<int> Q2(4, 0);
vector<int> Q3(4, 0);
vector<int> Q4(4, 0);
// cout << get<0>(Q1);
bool Q1fir = false, Q2fir = false, Q3fir = false, Q4fir = false;
while (count--)
{
int x, y;
cin >> x >> y;
if (x == 0 || y == 0)
continue;
if (x > 0 && y > 0)
{
x = abs(x);
y = abs(y);
if (!Q1fir)
{
Q1[0] = Q1[1] = x;
Q1[2] = Q1[3] = y;
Q1fir = true;
}
Q1[0] = min(Q1[0], x);
Q1[1] = max(Q1[1], x);
Q1[2] = min(Q1[2], y);
Q1[3] = max(Q1[3], y);
}
if (x < 0 && y > 0)
{
x = abs(x);
y = abs(y);
if (!Q2fir)
{
Q2[0] = Q2[1] = x;
Q2[2] = Q2[3] = y;
Q2fir = true;
}
Q2[0] = min(Q2[0], x);
Q2[1] = max(Q2[1], x);
Q2[2] = min(Q2[2], y);
Q2[3] = max(Q2[3], y);
}
if (x < 0 && y < 0)
{
x = abs(x);
y = abs(y);
if (!Q3fir)
{
Q3[0] = Q3[1] = x;
Q3[2] = Q3[3] = y;
Q3fir = true;
}
Q3[0] = min(Q3[0], x);
Q3[1] = max(Q3[1], x);
Q3[2] = min(Q3[2], y);
Q3[3] = max(Q3[3], y);
}
if (x > 0 && y < 0)
{
x = abs(x);
y = abs(y);
if (!Q4fir)
{
Q4[0] = Q4[1] = x;
Q4[2] = Q4[3] = y;
Q4fir = true;
}
Q4[0] = min(Q4[0], x);
Q4[1] = max(Q4[1], x);
Q4[2] = min(Q4[2], y);
Q4[3] = max(Q4[3], y);
}
}
bool Q1em = checkifEm(Q1), Q2em = checkifEm(Q2), Q3em = checkifEm(Q3), Q4em = checkifEm(Q4);
if(Q1em && Q2em && Q3em && Q4em) {cout << "No point in any quadrant"; return 0;}
if (!Q1em)
{
int x1 = Q1[0], y1 = Q1[2], x2 = Q1[1], y2 = Q1[3];
cout << "Q1: (" << x1 << ", "
<< y1 << ") (" << x2 << ", "
<< y2 << ") " << (abs(x1 - x2) * abs(y1 - y2)) << endl;
}
if (!Q2em)
{
int x1 = -Q2[1], y1 = Q2[2], x2 = -Q2[0], y2 = Q2[3];
cout << "Q2: (" << x1 << ", "
<< y1 << ") (" << x2 << ", "
<< y2 << ") " << (abs(x1 - x2) * abs(y1 - y2)) << endl;
}
if (!Q3em)
{
int x1 = -Q3[1], y1 = -Q3[3], x2 = -Q3[0], y2 = -Q3[2];
cout << "Q3: (" << x1 << ", "
<< y1 << ") (" << x2 << ", "
<< y2 << ") " << (abs(x1 - x2) * abs(y1 - y2)) << endl;
}
if (!Q4em)
{
int x1 = Q4[0], y1 = -Q4[3], x2 = Q4[1], y2 = -Q4[2];
cout << "Q4: (" << x1 << ", "
<< y1 << ") (" << x2 << ", "
<< y2 << ") " << (abs(x1 - x2) * abs(y1 - y2)) << endl;
}
} |
# 2068803, 2024-11-02 09:38:40, PPPPP-PPPP (90%)
#include<iostream>
#include<set>
#include<utility>
#include<cmath>
using namespace std;
int main(){
int n;
cin >> n;
set< int > q1x,q1y,q2x,q2y,q3x,q3y,q4x,q4y;
for(int i = 0 ; i < n ; i++){
int x,y;
cin >> x >> y;
if( x != 0 && y!=0){
int xIn = abs(x);
int yIn = abs(y);
//q1
if( x > 0 && y >0){
q1x.insert( xIn );
q1y.insert( yIn );
}
//q4
else if( x > 0 && y < 0){
q4x.insert( xIn );
q4y.insert( yIn );
}
//q2
else if( x < 0 && y > 0){
q2x.insert( xIn );
q2y.insert( yIn );
}
//q3
else if ( x < 0 && y < 0){
q3x.insert( xIn );
q3y.insert( yIn );
}
}
}
if ( q1x.size() == 0 && q2x.size() ==0 && q3x.size() == 0 && q4x.size() == 0){
cout << "No points in any quadrants.";
}else{
//size = ( xMax - xMin ) * ( yMax - yMin);
//q1 = (x,y)
if(q1x.size() != 0){
int xMin = *(q1x.begin());
int yMin = *(q1y.begin());
int xMax = *(q1x.rbegin());
int yMax = *(q1y.rbegin());
int sqSize = (xMax-xMin)*(yMax-yMin);
cout << "Q1: (" << xMin << ", " << yMin << ") (" << xMax << ", " << yMax << ") " << sqSize <<endl;
}
//q2 =(-x ,y)
if(q2x.size() != 0){
int xMin = *(q2x.begin());
int yMin = *(q2y.begin());
int xMax = *(q2x.rbegin());
int yMax = *(q2y.rbegin());
int sqSize = (xMax-xMin)*(yMax-yMin);
cout << "Q2: (" << 0-xMax << ", " << yMin << ") (" << 0-xMin << ", " << yMax << ") " << sqSize <<endl;
}
//q3 = (-x,-y)
if(q3x.size() != 0){
int xMin = *(q3x.begin());
int yMin = *(q3y.begin());
int xMax = *(q3x.rbegin());
int yMax = *(q3y.rbegin());
int sqSize = (xMax-xMin)*(yMax-yMin);
cout << "Q3: (" << 0-xMax << ", " << 0-yMax << ") (" << 0-xMin << ", " << 0-yMin << ") " << sqSize <<endl;
}
//q4 = (x , -y)
if(q4x.size() != 0){
int xMin = *(q4x.begin());
int yMin = *(q4y.begin());
int xMax = *(q4x.rbegin());
int yMax = *(q4y.rbegin());
int sqSize = (xMax-xMin)*(yMax-yMin);
cout << "Q4: (" << xMin << ", " << 0-yMax << ") (" << xMax << ", " << 0-yMin << ") " << sqSize <<endl;
}
}
} | # 2068811, 2024-11-02 09:39:29, PPPPP-PPPP (90%)
#include<iostream>
#include<set>
#include<utility>
#include<cmath>
using namespace std;
int main(){
int n;
cin >> n;
set< int > q1x,q1y,q2x,q2y,q3x,q3y,q4x,q4y;
for(int i = 0 ; i < n ; i++){
int x,y;
cin >> x >> y;
if( x != 0 && y!=0){
int xIn = abs(x);
int yIn = abs(y);
//q1
if( x > 0 && y >0){
q1x.insert( xIn );
q1y.insert( yIn );
}
//q4
else if( x > 0 && y < 0){
q4x.insert( xIn );
q4y.insert( yIn );
}
//q2
else if( x < 0 && y > 0){
q2x.insert( xIn );
q2y.insert( yIn );
}
//q3
else if ( x < 0 && y < 0){
q3x.insert( xIn );
q3y.insert( yIn );
}
}
}
if ( q1x.size() == 0 && q2x.size() ==0 && q3x.size() == 0 && q4x.size() == 0){
cout << "No points in any quadrant";
}else{
//size = ( xMax - xMin ) * ( yMax - yMin);
//q1 = (x,y)
if(q1x.size() != 0){
int xMin = *(q1x.begin());
int yMin = *(q1y.begin());
int xMax = *(q1x.rbegin());
int yMax = *(q1y.rbegin());
int sqSize = (xMax-xMin)*(yMax-yMin);
cout << "Q1: (" << xMin << ", " << yMin << ") (" << xMax << ", " << yMax << ") " << sqSize <<endl;
}
//q2 =(-x ,y)
if(q2x.size() != 0){
int xMin = *(q2x.begin());
int yMin = *(q2y.begin());
int xMax = *(q2x.rbegin());
int yMax = *(q2y.rbegin());
int sqSize = (xMax-xMin)*(yMax-yMin);
cout << "Q2: (" << 0-xMax << ", " << yMin << ") (" << 0-xMin << ", " << yMax << ") " << sqSize <<endl;
}
//q3 = (-x,-y)
if(q3x.size() != 0){
int xMin = *(q3x.begin());
int yMin = *(q3y.begin());
int xMax = *(q3x.rbegin());
int yMax = *(q3y.rbegin());
int sqSize = (xMax-xMin)*(yMax-yMin);
cout << "Q3: (" << 0-xMax << ", " << 0-yMax << ") (" << 0-xMin << ", " << 0-yMin << ") " << sqSize <<endl;
}
//q4 = (x , -y)
if(q4x.size() != 0){
int xMin = *(q4x.begin());
int yMin = *(q4y.begin());
int xMax = *(q4x.rbegin());
int yMax = *(q4y.rbegin());
int sqSize = (xMax-xMin)*(yMax-yMin);
cout << "Q4: (" << xMin << ", " << 0-yMax << ") (" << xMax << ", " << 0-yMin << ") " << sqSize <<endl;
}
}
} | # 2068814, 2024-11-02 09:39:41, PPPPPPPPPP (100%)
#include<iostream>
#include<set>
#include<utility>
#include<cmath>
using namespace std;
int main(){
int n;
cin >> n;
set< int > q1x,q1y,q2x,q2y,q3x,q3y,q4x,q4y;
for(int i = 0 ; i < n ; i++){
int x,y;
cin >> x >> y;
if( x != 0 && y!=0){
int xIn = abs(x);
int yIn = abs(y);
//q1
if( x > 0 && y >0){
q1x.insert( xIn );
q1y.insert( yIn );
}
//q4
else if( x > 0 && y < 0){
q4x.insert( xIn );
q4y.insert( yIn );
}
//q2
else if( x < 0 && y > 0){
q2x.insert( xIn );
q2y.insert( yIn );
}
//q3
else if ( x < 0 && y < 0){
q3x.insert( xIn );
q3y.insert( yIn );
}
}
}
if ( q1x.size() == 0 && q2x.size() ==0 && q3x.size() == 0 && q4x.size() == 0){
cout << "No point in any quadrant";
}else{
//size = ( xMax - xMin ) * ( yMax - yMin);
//q1 = (x,y)
if(q1x.size() != 0){
int xMin = *(q1x.begin());
int yMin = *(q1y.begin());
int xMax = *(q1x.rbegin());
int yMax = *(q1y.rbegin());
int sqSize = (xMax-xMin)*(yMax-yMin);
cout << "Q1: (" << xMin << ", " << yMin << ") (" << xMax << ", " << yMax << ") " << sqSize <<endl;
}
//q2 =(-x ,y)
if(q2x.size() != 0){
int xMin = *(q2x.begin());
int yMin = *(q2y.begin());
int xMax = *(q2x.rbegin());
int yMax = *(q2y.rbegin());
int sqSize = (xMax-xMin)*(yMax-yMin);
cout << "Q2: (" << 0-xMax << ", " << yMin << ") (" << 0-xMin << ", " << yMax << ") " << sqSize <<endl;
}
//q3 = (-x,-y)
if(q3x.size() != 0){
int xMin = *(q3x.begin());
int yMin = *(q3y.begin());
int xMax = *(q3x.rbegin());
int yMax = *(q3y.rbegin());
int sqSize = (xMax-xMin)*(yMax-yMin);
cout << "Q3: (" << 0-xMax << ", " << 0-yMax << ") (" << 0-xMin << ", " << 0-yMin << ") " << sqSize <<endl;
}
//q4 = (x , -y)
if(q4x.size() != 0){
int xMin = *(q4x.begin());
int yMin = *(q4y.begin());
int xMax = *(q4x.rbegin());
int yMax = *(q4y.rbegin());
int sqSize = (xMax-xMin)*(yMax-yMin);
cout << "Q4: (" << xMin << ", " << 0-yMax << ") (" << xMax << ", " << 0-yMin << ") " << sqSize <<endl;
}
}
} |
# 2071021, 2024-11-02 13:46:50, xxxxPxPPxP (40%)
#include<iostream>
#include<cmath>
#include<vector>
#include<utility>
#include<algorithm>
using namespace std;
int main()
{
int n;
cin >> n;
int x,y;
vector<vector<pair<int, int>>> v = { {} , {}, {}, {} };
for(int i=0; i<n; i++)
{
cin >> x;
cin >> y;
pair<int, int> input = make_pair(x,y);
// Q1 + +
if(x>0 && y>0)
{
v[0].push_back(input);
}
//Q2 - +
if(x<0 && y>0)
{
v[1].push_back(input);
}
//Q3 - -
if(x<0 && y<0)
{
v[2].push_back(input);
}
//Q4 + -
if(x>0 && y<0)
{
v[3].push_back(input);
}
}
int minx=v[0][0].first , maxx=v[0][0].first;
int miny=v[0][0].second , maxy=v[0][0].second;
// Q1
if(!v[0].empty())
{
for(int i=0; i<v[0].size(); i++)
{
if(v[0][i].first>maxx)
maxx = v[0][i].first;
if(v[0][i].first<minx)
minx = v[0][i].first;
if(v[0][i].second>maxy)
maxy = v[0][i].second;
if(v[0][i].second<miny)
miny = v[0][i].second;
}
cout << "Q1: (" << minx << ", " << miny << ") (" << maxx << ", " << maxy << ") ";
cout << abs(minx-maxx) * abs(miny-maxy) << endl;
}
minx=v[1][0].first , maxx=v[1][0].first;
miny=v[1][0].second , maxy=v[1][0].second;
// Q2
if(!v[1].empty())
{
for(int i=0; i<v[1].size(); i++)
{
if(v[1][i].first>maxx)
maxx = v[1][i].first;
if(v[1][i].first<minx)
minx = v[1][i].first;
if(v[1][i].second>maxy)
maxy = v[1][i].second;
if(v[1][i].second<miny)
miny = v[1][i].second;
}
cout << "Q2: (" << minx << ", " << miny << ") (" << maxx << ", " << maxy << ") ";
cout << abs(minx-maxx) * abs(miny-maxy) << endl;
}
minx=v[2][0].first , maxx=v[2][0].first;
miny=v[2][0].second , maxy=v[2][0].second;
// Q3
if(!v[2].empty())
{
for(int i=0; i<v[2].size(); i++)
{
if(v[2][i].first>maxx)
maxx = v[2][i].first;
if(v[2][i].first<minx)
minx = v[2][i].first;
if(v[2][i].second>maxy)
maxy = v[2][i].second;
if(v[2][i].second<miny)
miny = v[2][i].second;
}
cout << "Q3: (" << minx << ", " << miny << ") (" << maxx << ", " << maxy << ") ";
cout << abs(minx-maxx) * abs(miny-maxy) << endl;
}
minx=v[3][0].first , maxx=v[3][0].first;
miny=v[3][0].second , maxy=v[3][0].second;
// Q4
if(!v[3].empty())
{
for(int i=0; i<v[3].size(); i++)
{
if(v[3][i].first>maxx)
maxx = v[3][i].first;
if(v[3][i].first<minx)
minx = v[3][i].first;
if(v[3][i].second>maxy)
maxy = v[3][i].second;
if(v[3][i].second<miny)
miny = v[3][i].second;
}
cout << "Q4: (" << minx << ", " << miny << ") (" << maxx << ", " << maxy << ") ";
cout << abs(minx-maxx) * abs(miny-maxy) << endl;
}
if(v[0].empty() && v[1].empty() && v[2].empty() && v[3].empty())
cout << "No point in any quadrant" << endl;
} | # 2071188, 2024-11-02 14:06:00, xxxxPxPPxP (40%)
#include<iostream>
#include<cmath>
#include<vector>
#include<utility>
#include<algorithm>
using namespace std;
int main()
{
int n;
cin >> n;
int x , y ;
vector<vector<pair<int, int>>> v = { {} , {}, {}, {} };
for(int i=0; i<n; i++)
{
cin >> x;
cin >> y;
pair<int, int> input = make_pair(x,y);
// Q1 + +
if(x>0 && y>0)
v[0].push_back(input);
//Q2 - +
if(x<0 && y>0)
v[1].push_back(input);
//Q3 - -
if(x<0 && y<0)
v[2].push_back(input);
//Q4 + -
if(x>0 && y<0)
v[3].push_back(input);
}
//cout << v[0].size() << endl;
long unsigned int i,j;
for(i=0; i<4; i++)
{
auto minx=v[i][0].first , maxx=v[i][0].first;
auto miny=v[i][0].second , maxy=v[i][0].second;
if(!v[i].empty())
{
for(j=0; j<v[i].size(); j++)
{
if(v[i][j].first>maxx)
maxx = v[i][j].first;
if(v[i][j].first<minx)
minx = v[i][j].first;
if(v[i][j].second>maxy)
maxy = v[i][j].second;
if(v[i][j].second<miny)
miny = v[i][j].second;
}
cout << "Q" << i+1 << ": (" << minx << ", " << miny << ") (" << maxx << ", " << maxy << ") ";
cout << abs(minx-maxx) * abs(miny-maxy) << endl;
}
minx = maxx = miny = maxy = 0;
}
if(v[0].empty() && v[1].empty() && v[2].empty() && v[3].empty())
cout << "No point in any quadrant" << endl;
} | # 2071241, 2024-11-02 14:12:06, PPPPPPPPPP (100%)
#include<iostream>
#include<cmath>
#include<vector>
#include<utility>
#include<algorithm>
using namespace std;
int main()
{
int n;
cin >> n;
int x , y ;
vector<vector<pair<int, int>>> v = { {} , {}, {}, {} };
for(int i=0; i<n; i++)
{
cin >> x;
cin >> y;
pair<int, int> input = make_pair(x,y);
// Q1 + +
if(x>0 && y>0)
v[0].push_back(input);
//Q2 - +
if(x<0 && y>0)
v[1].push_back(input);
//Q3 - -
if(x<0 && y<0)
v[2].push_back(input);
//Q4 + -
if(x>0 && y<0)
v[3].push_back(input);
}
long unsigned int i,j;
for(i=0; i<4; i++)
{
if(!v[i].empty())
{
auto minx=v[i][0].first , maxx=v[i][0].first;
auto miny=v[i][0].second , maxy=v[i][0].second;
for(j=0; j<v[i].size(); j++)
{
if(v[i][j].first>maxx)
maxx = v[i][j].first;
if(v[i][j].first<minx)
minx = v[i][j].first;
if(v[i][j].second>maxy)
maxy = v[i][j].second;
if(v[i][j].second<miny)
miny = v[i][j].second;
}
cout << "Q" << i+1 << ": (" << minx << ", " << miny << ") (" << maxx << ", " << maxy << ") ";
cout << abs(minx-maxx) * abs(miny-maxy) << endl;
}
//minx = maxx = miny = maxy = 0;
}
if(v[0].empty() && v[1].empty() && v[2].empty() && v[3].empty())
cout << "No point in any quadrant" << endl;
} |
# 2068934, 2024-11-02 09:55:19, -----P---- (10%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n,input1,input2;
vector<pair<int,int>> q1,q2,q3,q4;
while (n--){
cin >> input1 >> input2;
if(input1 != 0 && input2 != 0){
if(input1 > 0 && input2 > 0){
q1.push_back(make_pair(input1,input2));
}
if(input1 < 0 && input2 > 0){
q2.push_back(make_pair(input1,input2));
}
if(input1 < 0 && input2 < 0){
q3.push_back(make_pair(input1,input2));
}
if(input1 > 0 && input2 < 0){
q1.push_back(make_pair(input1,input2));
}
}
}
if(q1.empty() && q2.empty() && q3.empty() && q4.empty()){
cout << "No point in any quadrant";
}
} | # 2069150, 2024-11-02 10:18:42, PPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n,input1,input2;
cin >> n;
vector<pair<int,int>> q1,q2,q3,q4;
for (int i = 0; i < n; i++)
{
cin >> input1 >> input2;
if(input1 != 0 && input2 != 0){
if(input1 > 0 && input2 > 0){
q1.push_back(make_pair(input1,input2));
}
if(input1 < 0 && input2 > 0){
q2.push_back(make_pair(input1,input2));
}
if(input1 < 0 && input2 < 0){
q3.push_back(make_pair(input1,input2));
}
if(input1 > 0 && input2 < 0){
q4.push_back(make_pair(input1,input2));
}
}
}
if(!q1.empty()){
int a=q1[0].first,b=q1[0].second,c=q1[0].first,d=q1[0].second;
for (int i = 1; i < q1.size(); i++)
{
if(q1[i].first < a){
a = q1[i].first;
}
if(q1[i].second < b){
b = q1[i].second;
}
if(q1[i].first > c){
c = q1[i].first;
}
if(q1[i].second > d){
d = q1[i].second;
}
}
int x = c-a, y = d-b;
cout << "Q1: (" << a << ", " << b << ") (" << c << ", " << d << ") " << x*y << endl;
}
if(!q2.empty()){
int a=q2[0].first,b=q2[0].second,c=q2[0].first,d=q2[0].second;
for (int i = 1; i < q2.size(); i++)
{
if(q2[i].first < a){
a = q2[i].first;
}
if(q2[i].second < b){
b = q2[i].second;
}
if(q2[i].first > c){
c = q2[i].first;
}
if(q2[i].second > d){
d = q2[i].second;
}
}
int x = c-a, y = d-b;
cout << "Q2: (" << a << ", " << b << ") (" << c << ", " << d << ") " << x*y << endl;
}
if(!q3.empty()){
int a=q3[0].first,b=q3[0].second,c=q3[0].first,d=q3[0].second;
for (int i = 1; i < q3.size(); i++)
{
if(q3[i].first < a){
a = q3[i].first;
}
if(q3[i].second < b){
b = q3[i].second;
}
if(q3[i].first > c){
c = q3[i].first;
}
if(q3[i].second > d){
d = q3[i].second;
}
}
int x = c-a, y = d-b;
cout << "Q3: (" << a << ", " << b << ") (" << c << ", " << d << ") " << x*y << endl;
}
if(!q4.empty()){
int a=q4[0].first,b=q4[0].second,c=q4[0].first,d=q4[0].second;
for (int i = 1; i < q4.size(); i++)
{
if(q4[i].first < a){
a = q4[i].first;
}
if(q4[i].second < b){
b = q4[i].second;
}
if(q4[i].first > c){
c = q4[i].first;
}
if(q4[i].second > d){
d = q4[i].second;
}
}
int x = c-a, y = d-b;
cout << "Q4: (" << a << ", " << b << ") (" << c << ", " << d << ") " << x*y << endl;
}
if(q1.empty() && q2.empty() && q3.empty() && q4.empty()){
cout << "No point in any quadrant";
}
} |
# 2070879, 2024-11-02 13:28:28, ---------- (0%)
#include <bits/stdc++.h>
using namespace std;
#define x first
#define y second
vector<int> border(vector<pair<int,int>> Q){
int Xmax,Xmin,Ymax,Ymin;
Xmax=Xmin=Q[0].x;
Ymax=Ymin=Q[0].y;
for(int i=0;i<Q.size();i++){
//x
Xmax=max(Q[i].x,Xmax);
Xmin=min(Q[i].x,Xmin);
//y
Ymax=max(Q[i].y,Ymax);
Ymin=min(Q[i].y,Ymin);
}
vector<int> result={Xmin,Ymin,Xmax,Ymax};
return result;
}
void showQ(vector<int> bd,int q){
int Xmin = bd[0],Ymin=bd[1],Xmax=bd[2],Ymax=bd[3];
cout <<"Q"<<q <<": (" << Xmin<<", "<<Ymin<<") ("<<Xmax<<", "<<Ymax<<") ";
int area = (Xmax-Xmin)*(Ymax-Ymin);
cout << area <<endl;
return;
}
int main(){
int n;
cin >> n;
vector<pair<int,int>> Q1;
vector<pair<int,int>> Q2;
vector<pair<int,int>> Q3;
vector<pair<int,int>> Q4;
for(int i=0;i<n;i++){
pair<int,int> pos;
cin >> pos.x >> pos.y;
if(pos.x>0&& pos.y>0)Q1.push_back(pos);
else if(pos.x<0&& pos.y>0)Q2.push_back(pos);
else if(pos.x<0&& pos.y<0)Q3.push_back(pos);
else if(pos.x>0&& pos.y<0)Q4.push_back(pos);
}
cout << Q2.size()<<endl;
vector<int> border1,border2,border3,border4;
if(Q1.size()){
border1= border(Q1);
showQ(border1,1);
}
if(Q2.size()){
border2= border(Q2);
showQ(border2,2);
}
if(Q3.size()){
border3= border(Q3);
showQ(border3,3);
}
if(Q4.size()){
border4= border(Q4);
showQ(border4,4);
}
if(Q1.empty()&&Q2.empty()&&Q3.empty()&&Q4.empty()){
cout << "No point in any quadrant";
}
} | # 2070892, 2024-11-02 13:29:46, PPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std;
#define x first
#define y second
vector<int> border(vector<pair<int,int>> Q){
int Xmax,Xmin,Ymax,Ymin;
Xmax=Xmin=Q[0].x;
Ymax=Ymin=Q[0].y;
for(int i=0;i<Q.size();i++){
//x
Xmax=max(Q[i].x,Xmax);
Xmin=min(Q[i].x,Xmin);
//y
Ymax=max(Q[i].y,Ymax);
Ymin=min(Q[i].y,Ymin);
}
vector<int> result={Xmin,Ymin,Xmax,Ymax};
return result;
}
void showQ(vector<int> bd,int q){
int Xmin = bd[0],Ymin=bd[1],Xmax=bd[2],Ymax=bd[3];
cout <<"Q"<<q <<": (" << Xmin<<", "<<Ymin<<") ("<<Xmax<<", "<<Ymax<<") ";
int area = (Xmax-Xmin)*(Ymax-Ymin);
cout << area <<endl;
return;
}
int main(){
int n;
cin >> n;
vector<pair<int,int>> Q1;
vector<pair<int,int>> Q2;
vector<pair<int,int>> Q3;
vector<pair<int,int>> Q4;
for(int i=0;i<n;i++){
pair<int,int> pos;
cin >> pos.x >> pos.y;
if(pos.x>0&& pos.y>0)Q1.push_back(pos);
else if(pos.x<0&& pos.y>0)Q2.push_back(pos);
else if(pos.x<0&& pos.y<0)Q3.push_back(pos);
else if(pos.x>0&& pos.y<0)Q4.push_back(pos);
}
vector<int> border1,border2,border3,border4;
if(Q1.size()){
border1= border(Q1);
showQ(border1,1);
}
if(Q2.size()){
border2= border(Q2);
showQ(border2,2);
}
if(Q3.size()){
border3= border(Q3);
showQ(border3,3);
}
if(Q4.size()){
border4= border(Q4);
showQ(border4,4);
}
if(Q1.empty()&&Q2.empty()&&Q3.empty()&&Q4.empty()){
cout << "No point in any quadrant";
}
} |
# 2068949, 2024-11-02 09:56:29, -----P---- (10%)
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
vector<pair<int,int>>v[5];
for (int i = 0 ; i <n ; i++)
{
int a,b;
cin >> a >> b;
if (a>0&&b>0)
{
v[1].push_back({a,b});
}
else if (a<0&&b>0)
{
v[2].push_back({a,b});
}
else if (a<0&&b<0)
{
v[3].push_back({a,b});
}
else if (a>0&&b<0)
{
v[4].push_back({a,b});
}
}
if (v[1].empty()&&v[2].empty()&&v[3].empty()&&v[4].empty())
{
cout << "No point in any quadrant";
return 0;
}
for (int i = 1 ; i <=4 ; i++)
{
int maxx = INT_MIN, maxy = INT_MIN, minx = INT_MAX, miny = INT_MAX;
if (!v[i].empty())
{
for (auto x : v[i])
{
if (x.first<=minx)
{
minx = x.first;
}
if (x.first>=maxx)
{
maxx = x.first;
}
if (x.second>=maxy)
{
maxy = x.second;
}
if (x.second <= miny)
{
miny = x.second;
}
}
cout << "Q" << i << ":" << " (" << minx << ", " << miny << "), (" << maxx << ", " <<
maxy << ") " << (maxy-miny)*(maxx-minx) << endl;
}
}
} | # 2068956, 2024-11-02 09:57:14, PPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
vector<pair<int,int>>v[5];
for (int i = 0 ; i <n ; i++)
{
int a,b;
cin >> a >> b;
if (a>0&&b>0)
{
v[1].push_back({a,b});
}
else if (a<0&&b>0)
{
v[2].push_back({a,b});
}
else if (a<0&&b<0)
{
v[3].push_back({a,b});
}
else if (a>0&&b<0)
{
v[4].push_back({a,b});
}
}
if (v[1].empty()&&v[2].empty()&&v[3].empty()&&v[4].empty())
{
cout << "No point in any quadrant";
return 0;
}
for (int i = 1 ; i <=4 ; i++)
{
int maxx = INT_MIN, maxy = INT_MIN, minx = INT_MAX, miny = INT_MAX;
if (!v[i].empty())
{
for (auto x : v[i])
{
if (x.first<=minx)
{
minx = x.first;
}
if (x.first>=maxx)
{
maxx = x.first;
}
if (x.second>=maxy)
{
maxy = x.second;
}
if (x.second <= miny)
{
miny = x.second;
}
}
cout << "Q" << i << ":" << " (" << minx << ", " << miny << ") (" << maxx << ", " <<
maxy << ") " << (maxy-miny)*(maxx-minx) << endl;
}
}
} |
# 2071044, 2024-11-02 13:48:29, xxxxPPPPxP (50%)
#include <iostream>
#include <vector>
#include <utility>
using namespace std;
int main() {
int n;
cin >> n;
vector<vector<pair<int,int>>> v(4);
for(int i=0 ; i<n ; i++) {
int x,y;
cin >> x >> y;
if(x != 0 && y != 0) {
if(x > 0 && y > 0) v[0].push_back(make_pair(x,y));
if(x < 0 && y > 0) v[1].push_back(make_pair(x,y));
if(x < 0 && y < 0) v[2].push_back(make_pair(x,y));
if(x > 0 && y < 0) v[3].push_back(make_pair(x,y));
}
}
int Q1sz = v[0].size();
int Q2sz = v[1].size();
int Q3sz = v[2].size();
int Q4sz = v[3].size();
if(Q1sz == 0 && Q2sz == 0 && Q3sz == 0 && Q4sz == 0) {
cout << "No point in any quadrant";
}
else {
for(int i=0 ; i<4 ; i++) {
int xmx = v[i][0].first;
int xmn = v[i][0].first;
int ymx = v[i][0].second;
int ymn = v[i][0].second;
for(auto & a : v[i]) {
if(a.first > xmx) {
xmx = a.first;
}
if(a.first < xmn) {
xmn = a.first;
}
if(a.second > ymx) {
ymx = a.second;
}
if(a.second < ymn) {
ymn = a.second;
}
}
if(v[i].size() != 0) {
cout << "Q" << i+1 << ": (" << xmn << ", " << ymn << ") (" << xmx << ", " << ymx << ") " << (ymx-ymn) * (xmx-xmn) << endl;
}
}
}
} | # 2071052, 2024-11-02 13:49:17, PPPPPPPPPP (100%)
#include <iostream>
#include <vector>
#include <utility>
using namespace std;
int main() {
int n;
cin >> n;
vector<vector<pair<int,int>>> v(4);
for(int i=0 ; i<n ; i++) {
int x,y;
cin >> x >> y;
if(x != 0 && y != 0) {
if(x > 0 && y > 0) v[0].push_back(make_pair(x,y));
if(x < 0 && y > 0) v[1].push_back(make_pair(x,y));
if(x < 0 && y < 0) v[2].push_back(make_pair(x,y));
if(x > 0 && y < 0) v[3].push_back(make_pair(x,y));
}
}
int Q1sz = v[0].size();
int Q2sz = v[1].size();
int Q3sz = v[2].size();
int Q4sz = v[3].size();
if(Q1sz == 0 && Q2sz == 0 && Q3sz == 0 && Q4sz == 0) {
cout << "No point in any quadrant";
}
else {
for(int i=0 ; i<4 ; i++) {
if(v[i].size() != 0) {
int xmx = v[i][0].first;
int xmn = v[i][0].first;
int ymx = v[i][0].second;
int ymn = v[i][0].second;
for(auto & a : v[i]) {
if(a.first > xmx) {
xmx = a.first;
}
if(a.first < xmn) {
xmn = a.first;
}
if(a.second > ymx) {
ymx = a.second;
}
if(a.second < ymn) {
ymn = a.second;
}
}
cout << "Q" << i+1 << ": (" << xmn << ", " << ymn << ") (" << xmx << ", " << ymx << ") " << (ymx-ymn) * (xmx-xmn) << endl;
}
}
}
} |
# 2071304, 2024-11-02 14:20:49, xxxxPxPPxP (40%)
#include<bits/stdc++.h>
using namespace std;
int area(int ymax, int ymin, int xmax, int xmin){
int rarea=(ymax-ymin)*(xmax-xmin);
return rarea;
}
int main(){
int n;
cin >> n;
int xi, yi;
map<string, set<int>> m1, m2, m3, m4;
set<int> x1, y1, x2, y2, x3, y3, x4, y4;
vector<int> v1(5), v2(5), v3(5), v4(5);
while(n--){
cin >> xi >> yi;
if(xi==0 || yi==0){
continue;
}
else if(xi>0 && yi>0){
x1.insert(xi);
y1.insert(yi);
}
else if(xi<0 && yi>0){
x2.insert(xi);
y2.insert(yi);
}
else if(xi<0 && yi<0){
x3.insert(xi);
y3.insert(yi);
}
else if(xi>0 && yi<0){
x4.insert(xi);
y4.insert(yi);
}
}
v1[0]=*(x1.begin());
v1[1]=*(y1.begin());
v1[2]=*(--x1.end());
v1[3]=*(--y1.end());
v1[4]=area(v1[3],v1[1],v1[2],v1[0]);
v2[0]=*(x2.begin());
v2[1]=*(y2.begin());
v2[2]=*(--x2.end());
v2[3]=*(--y2.end());
v2[4]=area(v2[3],v2[1],v2[2],v2[0]);
v3[0]=*(x3.begin());
v3[1]=*(y3.begin());
v3[2]=*(--x3.end());
v3[3]=*(--y3.end());
v3[4]=area(v3[3],v3[1],v3[2],v3[0]);
v4[0]=*(x4.begin());
v4[1]=*(y4.begin());
v4[2]=*(--x4.end());
v4[3]=*(--y4.end());
v4[4]=area(v4[3],v4[1],v4[2],v4[0]);
bool found=false;
if(!(x1.empty()) && !(y1.empty())){
found=true;
cout << "Q1: (" << v1[0] << ", " << v1[1] << ") (" << v1[2]<< ", " << v1[3] << ") " << v1[4] << endl;
}
if(!(x2.empty()) && !(y2.empty())){
found=true;
cout << "Q2: (" << v2[0] << ", " << v2[1] << ") (" << v2[2]<< ", " << v2[3] << ") " << v2[4] << endl;
}
if(!(x3.empty()) && !(y3.empty())){
found=true;
cout << "Q3: (" << v3[0] << ", " << v3[1] << ") (" << v3[2]<< ", " << v3[3] << ") " << v3[4] << endl;
}
if(!(x4.empty()) && !(y4.empty())){
found=true;
cout << "Q4: (" << v4[0] << ", " << v4[1] << ") (" << v4[2]<< ", " << v4[3] << ") " << v4[4] << endl;
}
if(!found){
cout << "No point in any quadrant" << endl;
}
} | # 2071337, 2024-11-02 14:24:17, PPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
int area(int ymax, int ymin, int xmax, int xmin){
int rarea=(ymax-ymin)*(xmax-xmin);
return rarea;
}
int main(){
int n;
cin >> n;
int xi, yi;
map<string, set<int>> m1, m2, m3, m4;
set<int> x1, y1, x2, y2, x3, y3, x4, y4;
vector<int> v1(5), v2(5), v3(5), v4(5);
while(n--){
cin >> xi >> yi;
if(xi==0 || yi==0){
continue;
}
else if(xi>0 && yi>0){
x1.insert(xi);
y1.insert(yi);
}
else if(xi<0 && yi>0){
x2.insert(xi);
y2.insert(yi);
}
else if(xi<0 && yi<0){
x3.insert(xi);
y3.insert(yi);
}
else if(xi>0 && yi<0){
x4.insert(xi);
y4.insert(yi);
}
}
if(!(x1.empty()) && !(y1.empty())){
v1[0]=*(x1.begin());
v1[1]=*(y1.begin());
v1[2]=*(--x1.end());
v1[3]=*(--y1.end());
v1[4]=area(v1[3],v1[1],v1[2],v1[0]);
}
if(!(x2.empty()) && !(y2.empty())){
v2[0]=*(x2.begin());
v2[1]=*(y2.begin());
v2[2]=*(--x2.end());
v2[3]=*(--y2.end());
v2[4]=area(v2[3],v2[1],v2[2],v2[0]);
}
if(!(x3.empty()) && !(y3.empty())){
v3[0]=*(x3.begin());
v3[1]=*(y3.begin());
v3[2]=*(--x3.end());
v3[3]=*(--y3.end());
v3[4]=area(v3[3],v3[1],v3[2],v3[0]);
}
if(!(x4.empty()) && !(y4.empty())){
v4[0]=*(x4.begin());
v4[1]=*(y4.begin());
v4[2]=*(--x4.end());
v4[3]=*(--y4.end());
v4[4]=area(v4[3],v4[1],v4[2],v4[0]);
}
bool found=false;
if(!(x1.empty()) && !(y1.empty())){
found=true;
cout << "Q1: (" << v1[0] << ", " << v1[1] << ") (" << v1[2]<< ", " << v1[3] << ") " << v1[4] << endl;
}
if(!(x2.empty()) && !(y2.empty())){
found=true;
cout << "Q2: (" << v2[0] << ", " << v2[1] << ") (" << v2[2]<< ", " << v2[3] << ") " << v2[4] << endl;
}
if(!(x3.empty()) && !(y3.empty())){
found=true;
cout << "Q3: (" << v3[0] << ", " << v3[1] << ") (" << v3[2]<< ", " << v3[3] << ") " << v3[4] << endl;
}
if(!(x4.empty()) && !(y4.empty())){
found=true;
cout << "Q4: (" << v4[0] << ", " << v4[1] << ") (" << v4[2]<< ", " << v4[3] << ") " << v4[4] << endl;
}
if(!found){
cout << "No point in any quadrant" << endl;
}
} |
# 2068945, 2024-11-02 09:56:21, ----PPPP-P (50%)
#include<iostream>
#include<vector>
#include<utility>
#include<cmath>
using namespace std;
int main(){
vector<pair<int,int>> Q1,Q2,Q3,Q4;
int n,x,y;
cin>>n;
while (n--){
cin>>x>>y;
if(x>0 && y>0) Q1.push_back(make_pair(x,y));
else if(x<0 && y>0) Q2.push_back(make_pair(x,y));
else if(x<0 && y<0) Q3.push_back(make_pair(x,y));
else if(x>0 && y<0) Q4.push_back(make_pair(x,y));
}if(Q1.empty()&& Q2.empty()&&Q3.empty()&&Q4.empty()) cout<<"No point in any quadrant";
else{
int x1max=0,y1max=0,x1min=1e7,y1min=1e7,x2max=-1e7,y2max=0,x2min=0,y2min=1e7,x3max=-1e7,y3max=-1e7,x3min=0,y3min=0,x4max=0,y4max=-1e7,x4min=1e7,y4min=0;
for(auto i:Q1){
x1max=max(x1max,i.first);
y1max=max(y1max,i.second);
x1min=min(x1min,i.first);
y1min=min(y1min,i.second);
}
for(auto i:Q2){
x2max=max(x2max,i.first);
y2max=max(y2max,i.second);
x2min=min(x2min,i.first);
y2min=min(y2min,i.second);
}
for(auto i:Q3){
x3max=max(x3max,i.first);
y3max=max(y3max,i.second);
x3min=min(x3min,i.first);
y3min=min(y3min,i.second);
}
for(auto i:Q4){
x4max=max(x4max,i.first);
y4max=max(y4max,i.second);
x4min=min(x4min,i.first);
y4min=min(y4min,i.second);
}
cout<<"Q1: ("<<x1min<<", "<<y1min<<") ("<<x1max<<", "<<y1max<<") "<<(x1max-x1min)*(y1max-y1min)<<endl;
cout<<"Q2: ("<<x2min<<", "<<y2min<<") ("<<x2max<<", "<<y2max<<") "<<(x2max-x2min)*(y2max-y2min)<<endl;
cout<<"Q3: ("<<x3min<<", "<<y3min<<") ("<<x3max<<", "<<y3max<<") "<<(x3max-x3min)*(y3max-y3min)<<endl;
cout<<"Q4: ("<<x4min<<", "<<y4min<<") ("<<x4max<<", "<<y4max<<") "<<(x4max-x4min)*(y4max-y4min)<<endl;
}
} | # 2068997, 2024-11-02 10:01:43, PPPPPPPPPP (100%)
#include<iostream>
#include<vector>
#include<utility>
#include<cmath>
using namespace std;
int main(){
vector<pair<int,int>> Q1,Q2,Q3,Q4;
int n,x,y;
cin>>n;
while (n--){
cin>>x>>y;
if(x>0 && y>0) Q1.push_back(make_pair(x,y));
else if(x<0 && y>0) Q2.push_back(make_pair(x,y));
else if(x<0 && y<0) Q3.push_back(make_pair(x,y));
else if(x>0 && y<0) Q4.push_back(make_pair(x,y));
}if(Q1.empty()&& Q2.empty()&&Q3.empty()&&Q4.empty()) cout<<"No point in any quadrant";
else{
int x1max=0,y1max=0,x1min=1e7,y1min=1e7,x2max=-1e7,y2max=0,x2min=0,y2min=1e7,x3max=-1e7,y3max=-1e7,x3min=0,y3min=0,x4max=0,y4max=-1e7,x4min=1e7,y4min=0;
for(auto i:Q1){
x1max=max(x1max,i.first);
y1max=max(y1max,i.second);
x1min=min(x1min,i.first);
y1min=min(y1min,i.second);
}
for(auto i:Q2){
x2max=max(x2max,i.first);
y2max=max(y2max,i.second);
x2min=min(x2min,i.first);
y2min=min(y2min,i.second);
}
for(auto i:Q3){
x3max=max(x3max,i.first);
y3max=max(y3max,i.second);
x3min=min(x3min,i.first);
y3min=min(y3min,i.second);
}
for(auto i:Q4){
x4max=max(x4max,i.first);
y4max=max(y4max,i.second);
x4min=min(x4min,i.first);
y4min=min(y4min,i.second);
}if(Q1.size()>0)
cout<<"Q1: ("<<x1min<<", "<<y1min<<") ("<<x1max<<", "<<y1max<<") "<<(x1max-x1min)*(y1max-y1min)<<endl;
if(Q2.size()>0)
cout<<"Q2: ("<<x2min<<", "<<y2min<<") ("<<x2max<<", "<<y2max<<") "<<(x2max-x2min)*(y2max-y2min)<<endl;
if(Q3.size()>0)
cout<<"Q3: ("<<x3min<<", "<<y3min<<") ("<<x3max<<", "<<y3max<<") "<<(x3max-x3min)*(y3max-y3min)<<endl;
if(Q4.size()>0)
cout<<"Q4: ("<<x4min<<", "<<y4min<<") ("<<x4max<<", "<<y4max<<") "<<(x4max-x4min)*(y4max-y4min)<<endl;
}
} |
# 2069103, 2024-11-02 10:12:27, P----P---- (20%)
#include <bits/stdc++.h>
using namespace std ;
int main() {
int n ;
cin >> n ;
pair<int, int> inp ; bool check1 = false, check2 = false, check3 = false, check4 = false ;
map<string, vector<int>> q ;
q["Q1"] = {int(10e+6), int(10e+6), int(10e-6), int(10e-6)} ;
q["Q2"] = {int(10e+6), int(10e+6), int(10e-6), int(10e-6)} ;
q["Q3"] = {int(10e+6), int(10e+6), int(10e-6), int(10e-6)} ;
q["Q4"] = {int(10e+6), int(10e+6), int(10e-6), int(10e-6)} ;
for (int i = 0 ; i < n ; i++) {
cin >> inp.first >> inp.second ;
if (inp.first == 0 || inp.second == 0) continue ;
if (inp.first > 0 && inp.second > 0) {
check1 = true ;
q["Q1"][0] = min(inp.first, q["Q1"][0]) ;
q["Q1"][1] = min(inp.second, q["Q1"][1]) ;
q["Q1"][2] = max(inp.first, q["Q1"][2]) ;
q["Q1"][3] = max(inp.second, q["Q1"][3]) ;
}
else if (inp.first < 0 && inp.second > 0) {
check2 = true ;
q["Q2"][0] = min(inp.first, q["Q2"][0]) ;
q["Q2"][1] = min(inp.second, q["Q2"][1]) ;
q["Q2"][2] = max(inp.first, q["Q2"][2]) ;
q["Q2"][3] = max(inp.second, q["Q2"][3]) ;
}
else if (inp.first < 0 && inp.second < 0) {
check3 = true ;
q["Q3"][0] = min(inp.first, q["Q3"][0]) ;
q["Q3"][1] = min(inp.second, q["Q3"][1]) ;
q["Q3"][2] = max(inp.first, q["Q3"][2]) ;
q["Q3"][3] = max(inp.second, q["Q3"][3]) ;
}
else if (inp.first > 0 && inp.second < 0) {
check4 = true ;
q["Q4"][0] = min(inp.first, q["Q4"][0]) ;
q["Q4"][1] = min(inp.second, q["Q4"][1]) ;
q["Q4"][2] = max(inp.first, q["Q4"][2]) ;
q["Q4"][3] = max(inp.second, q["Q4"][3]) ;
}
}
if ((check1 || check2 || check3 || check4) == false) { cout << "No point in any quadrant" ;}
else {
if (check1 == true) {
cout << "Q1: (" << q["Q1"][0] << ", " << q["Q1"][1] << ") (" << q["Q1"][2] << ", " << q["Q1"][3] << ") " << (q["Q1"][2]-q["Q1"][0])*(q["Q1"][3]-q["Q1"][1]) ;
cout << "\n" ;
}
if (check2 == true) {
cout << "Q2: (" << q["Q2"][0] << ", " << q["Q2"][1] << ") (" << q["Q2"][2] << ", " << q["Q2"][3] << ") " << (q["Q2"][2]-q["Q2"][0])*(q["Q2"][3]-q["Q2"][1]) ;
cout << "\n" ;
}
if (check3 == true) {
cout << "Q3: (" << q["Q3"][0] << ", " << q["Q3"][1] << ") (" << q["Q3"][2] << ", " << q["Q3"][3] << ") " << (q["Q3"][2]-q["Q3"][0])*(q["Q3"][3]-q["Q3"][1]) ;
cout << "\n" ;
}
if (check4 == true) {
cout << "Q4: (" << q["Q4"][0] << ", " << q["Q4"][1] << ") (" << q["Q4"][2] << ", " << q["Q4"][3] << ") " << (q["Q4"][2]-q["Q4"][0])*(q["Q4"][3]-q["Q4"][1]) ;
cout << "\n" ;
}
}
} | # 2070145, 2024-11-02 11:54:10, PPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std ;
int main() {
int n ;
cin >> n ;
pair<int, int> inp ; bool check1 = false, check2 = false, check3 = false, check4 = false ;
map<string, vector<int>> q ;
q["Q1"] = {int(10e+6), int(10e+6), -10000, -10000} ;
q["Q2"] = {int(10e+6), int(10e+6), -10000, -10000} ;
q["Q3"] = {int(10e+6), int(10e+6), -10000, -10000} ;
q["Q4"] = {int(10e+6), int(10e+6), -10000, -10000} ;
for (int i = 0 ; i < n ; i++) {
cin >> inp.first >> inp.second ;
if (inp.first == 0 || inp.second == 0) continue ;
if (inp.first > 0 && inp.second > 0) {
check1 = true ;
q["Q1"][0] = min(inp.first, q["Q1"][0]) ;
q["Q1"][1] = min(inp.second, q["Q1"][1]) ;
q["Q1"][2] = max(inp.first, q["Q1"][2]) ;
q["Q1"][3] = max(inp.second, q["Q1"][3]) ;
}
else if (inp.first < 0 && inp.second > 0) {
check2 = true ;
q["Q2"][0] = min(inp.first, q["Q2"][0]) ;
q["Q2"][1] = min(inp.second, q["Q2"][1]) ;
q["Q2"][2] = max(inp.first, q["Q2"][2]) ;
q["Q2"][3] = max(inp.second, q["Q2"][3]) ;
}
else if (inp.first < 0 && inp.second < 0) {
check3 = true ;
q["Q3"][0] = min(inp.first, q["Q3"][0]) ;
q["Q3"][1] = min(inp.second, q["Q3"][1]) ;
q["Q3"][2] = max(inp.first, q["Q3"][2]) ;
q["Q3"][3] = max(inp.second, q["Q3"][3]) ;
}
else if (inp.first > 0 && inp.second < 0) {
check4 = true ;
q["Q4"][0] = min(inp.first, q["Q4"][0]) ;
q["Q4"][1] = min(inp.second, q["Q4"][1]) ;
q["Q4"][2] = max(inp.first, q["Q4"][2]) ;
q["Q4"][3] = max(inp.second, q["Q4"][3]) ;
}
}
if ((check1 || check2 || check3 || check4) == false) { cout << "No point in any quadrant" ;}
else {
if (check1 == true) {
cout << "Q1: (" << q["Q1"][0] << ", " << q["Q1"][1] << ") (" << q["Q1"][2] << ", " << q["Q1"][3] << ") " << (q["Q1"][2]-q["Q1"][0])*(q["Q1"][3]-q["Q1"][1]) ;
cout << "\n" ;
}
if (check2 == true) {
cout << "Q2: (" << q["Q2"][0] << ", " << q["Q2"][1] << ") (" << q["Q2"][2] << ", " << q["Q2"][3] << ") " << (q["Q2"][2]-q["Q2"][0])*(q["Q2"][3]-q["Q2"][1]) ;
cout << "\n" ;
}
if (check3 == true) {
cout << "Q3: (" << q["Q3"][0] << ", " << q["Q3"][1] << ") (" << q["Q3"][2] << ", " << q["Q3"][3] << ") " << (q["Q3"][2]-q["Q3"][0])*(q["Q3"][3]-q["Q3"][1]) ;
cout << "\n" ;
}
if (check4 == true) {
cout << "Q4: (" << q["Q4"][0] << ", " << q["Q4"][1] << ") (" << q["Q4"][2] << ", " << q["Q4"][3] << ") " << (q["Q4"][2]-q["Q4"][0])*(q["Q4"][3]-q["Q4"][1]) ;
cout << "\n" ;
}
}
} |
# 2071320, 2024-11-02 14:22:41, PPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
int x,y;
cin>>n;
vector<pair<int,int>> Q1,Q2,Q3,Q4;
for(int i=0;i<n;++i)
{
cin>>x>>y;
if(x>0&&y>0)
{
Q1.push_back(make_pair(x,y));
}
else if(x<0&&y<0)
{
Q3.push_back(make_pair(x,y));
}
else if(x>0&&y<0)
{
Q4.push_back(make_pair(x,y));
}
else if(x<0&&y>0)
{
Q2.push_back(make_pair(x,y));
}
}
int minq1y=1000000,minq1_x=1000000;
int max1=-1,may1=-1;
for(auto &a:Q1)
{
if(a.first<minq1_x) minq1_x = a.first;
if(a.second<minq1y) minq1y = a.second;
if(a.first>max1) max1 = a.first;
if(a.second>may1) may1 = a.second;
}
if(!Q1.empty()) cout<<"Q1: ("<<minq1_x<<", "<<minq1y<<") ("<<max1<<", "<<may1<<") "<<(max1-minq1_x)*(may1-minq1y)<<endl;
int maxx2=-1000000,maxy2=-1;
int miny2=1000000,minx2=1;
for(auto &b:Q2)
{
if(b.first>maxx2) maxx2 = b.first;
if(b.second>maxy2) maxy2 = b.second;
if(b.second<miny2) miny2 = b.second;
if(b.first<minx2) minx2 = b.first;
}
if(!Q2.empty()) cout<<"Q2: ("<<minx2<<", "<<miny2<<") ("<<maxx2<<", "<<maxy2<<") "<<(maxx2-minx2)*(maxy2-miny2)<<endl;
int maxx3=-1000000,maxy3=-1000000;
int minx3=1,miny3=1;
for(auto &c:Q3)
{
if(c.first>maxx3) maxx3 = c.first;
if(c.second>maxy3) maxy3 = c.second;
if(c.first<minx3) minx3 = c.first;
if(c.second<miny3) miny3 = c.second;
}
if(!Q3.empty()) cout<<"Q3: ("<<minx3<<", "<<miny3<<") ("<<maxx3<<", "<<maxy3<<") "<<(maxx3-minx3)*(maxy3-miny3)<<endl;
int maxx4=-1,maxy4=-1000000;
int minx4=1000000,miny4=1;
for(auto &d:Q4)
{
if(d.second>maxy4) maxy4 = d.second;
if(d.first>maxx4) maxx4 = d.first;
if(d.second<miny4) miny4 = d.second;
if(d.first<minx4) minx4 = d.first;
}
if(!Q4.empty()) cout<<"Q4: ("<<minx4<<", "<<miny4<<") ("<<maxx4<<", "<<maxy4<<") "<<(maxx4-minx4)*(maxy4-miny4)<<endl;
/*cout<<"q2";
for(auto &a:Q2) cout<<a.first<<" "<<a.second<<endl;
cout<<"q3";
for(auto &a:Q3) cout<<a.first<<" "<<a.second<<endl;
cout<<"q4";
for(auto &a:Q4) cout<<a.first<<" "<<a.second<<endl;*/
if(Q1.empty() && Q2.empty() && Q3.empty() && Q4.empty()) cout<<"No point in any quadrant";
else
{
}
return 0;
} | # 2071994, 2024-11-02 15:31:36, PPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,x,y;
cin>>n;
vector<pair<int,int>> Q1,Q2,Q3,Q4;
for(int i=0;i<n;++i){
cin>>x>>y;
if(x>0&&y>0) Q1.push_back(make_pair(x,y));
if(x<0&&y<0) Q3.push_back(make_pair(x,y));
if(x>0&&y<0) Q4.push_back(make_pair(x,y));
if(x<0&&y>0) Q2.push_back(make_pair(x,y));
}
int minq1y=1000000,minq1_x=1000000;
int max1=-1,may1=-1;
for(auto &a:Q1){
if(a.first<minq1_x) minq1_x = a.first;
if(a.second<minq1y) minq1y = a.second;
if(a.first>max1) max1 = a.first;
if(a.second>may1) may1 = a.second;
} if(!Q1.empty()) cout<<"Q1: ("<<minq1_x<<", "<<minq1y<<") ("<<max1<<", "<<may1<<") "<<(max1-minq1_x)*(may1-minq1y)<<endl;
int maxx2=-1000000,maxy2=-1;
int miny2=1000000,minx2=1;
for(auto &b:Q2){
if(b.first>maxx2) maxx2 = b.first;
if(b.second>maxy2) maxy2 = b.second;
if(b.second<miny2) miny2 = b.second;
if(b.first<minx2) minx2 = b.first;
} if(!Q2.empty()) cout<<"Q2: ("<<minx2<<", "<<miny2<<") ("<<maxx2<<", "<<maxy2<<") "<<(maxx2-minx2)*(maxy2-miny2)<<endl;
int maxx3=-1000000,maxy3=-1000000;
int minx3=1,miny3=1;
for(auto &c:Q3){
if(c.first>maxx3) maxx3 = c.first;
if(c.second>maxy3) maxy3 = c.second;
if(c.first<minx3) minx3 = c.first;
if(c.second<miny3) miny3 = c.second;
} if(!Q3.empty()) cout<<"Q3: ("<<minx3<<", "<<miny3<<") ("<<maxx3<<", "<<maxy3<<") "<<(maxx3-minx3)*(maxy3-miny3)<<endl;
int maxx4=-1,maxy4=-1000000;
int minx4=1000000,miny4=1;
for(auto &d:Q4){
if(d.second>maxy4) maxy4 = d.second;
if(d.first>maxx4) maxx4 = d.first;
if(d.second<miny4) miny4 = d.second;
if(d.first<minx4) minx4 = d.first;
} if(!Q4.empty()) cout<<"Q4: ("<<minx4<<", "<<miny4<<") ("<<maxx4<<", "<<maxy4<<") "<<(maxx4-minx4)*(maxy4-miny4)<<endl;
if(Q1.empty() && Q2.empty() && Q3.empty() && Q4.empty()) cout<<"No point in any quadrant";
} |
# 2069376, 2024-11-02 10:41:39, -----P---- (10%)
#include <bits/stdc++.h>
using namespace std;
int main() {
long int n;
cin >> n;
vector<pair<long int, long int>> Q1;
vector<pair<long int, long int>> Q2;
vector<pair<long int, long int>> Q3;
vector<pair<long int, long int>> Q4;
for (long int i = 0; i < n; i++) {
long int x,y;
cin >> x >> y;
if (x > 0 && y > 0) {
pair<long int, long int> p = make_pair(x,y);
Q1.push_back(p);
}
if (x < 0 && y > 0) {
pair<long int, long int> p = make_pair(x,y);
Q2.push_back(p);
}
if (x < 0 && y < 0) {
pair<long int, long int> p = make_pair(x,y);
Q3.push_back(p);
}
if (x > 0 && y < 0) {
pair<long int, long int> p = make_pair(x,y);
Q4.push_back(p);
}
}
if (Q1.size() != 0) {
long int maxx = Q1[0].first, maxy = Q1[0].second, minx = Q1[0].first, miny = Q1[0].second;
for (long int i = 1; i < Q1.size(); i++) {
if (Q1[i].first > maxx) {
maxx = Q1[i].first;
}
if (Q1[i].first < minx) {
minx = Q1[i].first;
}
if (Q1[i].second > maxy) {
maxy = Q1[i].second;
}
if (Q1[i].second < miny) {
miny = Q1[i].second;
}
}
long int a, b;
a = abs(maxx-minx);
b = abs(maxy-miny);
cout << "Q1: " << "(" << minx << "," << miny << ") (" << maxx << "," << maxy << ") " << a*b << endl;
}
if (Q2.size() != 0) {
long int maxx = Q2[0].first, maxy = Q2[0].second, minx = Q2[0].first, miny = Q2[0].second;
for (long int i = 1; i < Q2.size(); i++) {
if (Q2[i].first > maxx) {
maxx = Q2[i].first;
}
if (Q2[i].first < minx) {
minx = Q2[i].first;
}
if (Q2[i].second > maxy) {
maxy = Q2[i].second;
}
if (Q2[i].second < miny) {
miny = Q2[i].second;
}
}
long int a, b;
a = abs(maxx-minx);
b = abs(maxy-miny);
cout << "Q2: " << "(" << minx << "," << miny << ") (" << maxx << "," << maxy << ") " << a*b << endl;
}
if (Q3.size() != 0) {
long int maxx = Q3[0].first, maxy = Q3[0].second, minx = Q3[0].first, miny = Q3[0].second;
for (long int i = 1; i < Q3.size(); i++) {
if (Q3[i].first > maxx) {
maxx = Q3[i].first;
}
if (Q3[i].first < minx) {
minx = Q3[i].first;
}
if (Q3[i].second > maxy) {
maxy = Q3[i].second;
}
if (Q3[i].second < miny) {
miny = Q3[i].second;
}
}
long int a, b;
a = abs(maxx-minx);
b = abs(maxy-miny);
cout << "Q3: " << "(" << minx << "," << miny << ") (" << maxx << "," << maxy << ") " << a*b << endl;
}
if (Q4.size() != 0) {
long int maxx = Q4[0].first, maxy = Q4[0].second, minx = Q4[0].first, miny = Q4[0].second;
for (long int i = 1; i < Q4.size(); i++) {
if (Q4[i].first > maxx) {
maxx = Q4[i].first;
}
if (Q4[i].first < minx) {
minx = Q4[i].first;
}
if (Q4[i].second > maxy) {
maxy = Q4[i].second;
}
if (Q4[i].second < miny) {
miny = Q4[i].second;
}
}
long int a, b;
a = abs(maxx-minx);
b = abs(maxy-miny);
cout << "Q4: " << "(" << minx << "," << miny << ") (" << maxx << "," << maxy << ") " << a*b << endl;
}
if (Q1.size() == 0 && Q2.size() == 0 && Q3.size() == 0 && Q4.size() == 0) {
cout << "No point in any quadrant" << endl;
}
} | # 2069402, 2024-11-02 10:43:42, PPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std;
int main() {
long int n;
cin >> n;
vector<pair<long int, long int>> Q1;
vector<pair<long int, long int>> Q2;
vector<pair<long int, long int>> Q3;
vector<pair<long int, long int>> Q4;
for (long int i = 0; i < n; i++) {
long int x,y;
cin >> x >> y;
if (x > 0 && y > 0) {
pair<long int, long int> p = make_pair(x,y);
Q1.push_back(p);
}
if (x < 0 && y > 0) {
pair<long int, long int> p = make_pair(x,y);
Q2.push_back(p);
}
if (x < 0 && y < 0) {
pair<long int, long int> p = make_pair(x,y);
Q3.push_back(p);
}
if (x > 0 && y < 0) {
pair<long int, long int> p = make_pair(x,y);
Q4.push_back(p);
}
}
if (Q1.size() != 0) {
long int maxx = Q1[0].first, maxy = Q1[0].second, minx = Q1[0].first, miny = Q1[0].second;
for (long int i = 1; i < Q1.size(); i++) {
if (Q1[i].first > maxx) {
maxx = Q1[i].first;
}
if (Q1[i].first < minx) {
minx = Q1[i].first;
}
if (Q1[i].second > maxy) {
maxy = Q1[i].second;
}
if (Q1[i].second < miny) {
miny = Q1[i].second;
}
}
long int a, b;
a = abs(maxx-minx);
b = abs(maxy-miny);
cout << "Q1: " << "(" << minx << ", " << miny << ") (" << maxx << ", " << maxy << ") " << a*b << endl;
}
if (Q2.size() != 0) {
long int maxx = Q2[0].first, maxy = Q2[0].second, minx = Q2[0].first, miny = Q2[0].second;
for (long int i = 1; i < Q2.size(); i++) {
if (Q2[i].first > maxx) {
maxx = Q2[i].first;
}
if (Q2[i].first < minx) {
minx = Q2[i].first;
}
if (Q2[i].second > maxy) {
maxy = Q2[i].second;
}
if (Q2[i].second < miny) {
miny = Q2[i].second;
}
}
long int a, b;
a = abs(maxx-minx);
b = abs(maxy-miny);
cout << "Q2: " << "(" << minx << ", " << miny << ") (" << maxx << ", " << maxy << ") " << a*b << endl;
}
if (Q3.size() != 0) {
long int maxx = Q3[0].first, maxy = Q3[0].second, minx = Q3[0].first, miny = Q3[0].second;
for (long int i = 1; i < Q3.size(); i++) {
if (Q3[i].first > maxx) {
maxx = Q3[i].first;
}
if (Q3[i].first < minx) {
minx = Q3[i].first;
}
if (Q3[i].second > maxy) {
maxy = Q3[i].second;
}
if (Q3[i].second < miny) {
miny = Q3[i].second;
}
}
long int a, b;
a = abs(maxx-minx);
b = abs(maxy-miny);
cout << "Q3: " << "(" << minx << ", " << miny << ") (" << maxx << ", " << maxy << ") " << a*b << endl;
}
if (Q4.size() != 0) {
long int maxx = Q4[0].first, maxy = Q4[0].second, minx = Q4[0].first, miny = Q4[0].second;
for (long int i = 1; i < Q4.size(); i++) {
if (Q4[i].first > maxx) {
maxx = Q4[i].first;
}
if (Q4[i].first < minx) {
minx = Q4[i].first;
}
if (Q4[i].second > maxy) {
maxy = Q4[i].second;
}
if (Q4[i].second < miny) {
miny = Q4[i].second;
}
}
long int a, b;
a = abs(maxx-minx);
b = abs(maxy-miny);
cout << "Q4: " << "(" << minx << ", " << miny << ") (" << maxx << ", " << maxy << ") " << a*b << endl;
}
if (Q1.size() == 0 && Q2.size() == 0 && Q3.size() == 0 && Q4.size() == 0) {
cout << "No point in any quadrant" << endl;
}
} |
# 2071142, 2024-11-02 14:00:50, PPP--P---- (40%)
#include<bits/stdc++.h>
using namespace std;
int findmin(set<int>s){
int mins=999999;
for (auto c: s){
mins =min(c,mins);
}
return mins;
}
int findmax(set<int>s){
int mins=-999999;
for (auto c: s){
mins =max(c,mins);
}
return mins;
}
int main(){
int n;
cin>>n;
set<int> q1_x,q1_y,q2_x,q2_y,q3_x,q3_y,q4_x,q4_y;
int x ,y;
while (n--){
cin>>x>>y;
if (x!=0&&y!=0){
if (x>0&&y>0){//q1
q1_x.insert(x);
q1_y.insert(y);
}
else if(x<0&&y>0){//q2
q2_x.insert(x);
q2_y.insert(y);
}
else if(x>0&&y<0){//q3
q3_x.insert(x);
q3_y.insert(y);
}
else if(x<0&&y<0){//q4
q4_x.insert(x);
q4_y.insert(y);
}
}
}
// find q1
if (q1_x.empty()&&q1_y.empty()&&q2_x.empty()&&q2_y.empty()&&q3_x.empty()&&q3_y.empty()&&q4_x.empty()&&q4_y.empty()){
cout<<"No point in any quadrant"<<endl;
}
else{
if (!q1_x.empty()&&!q1_x.empty()){
int x1 = findmin(q1_x);
int y1 =findmin(q1_y);
int x2 = findmax(q1_x);
int y2 = findmax(q1_y);
int cal = (x2-x1)*(y2-y1);
cout<<"Q1: ("<<x1<<", "<<y1<<") ("<<x2<<", "<<y2<<") "<<cal<<endl;
}
if (!q2_x.empty()&&!q2_x.empty()){
int x1 = findmin(q2_x);
int y1 =findmin(q2_y);
int x2 = findmax(q2_x);
int y2 = findmax(q2_y);
int cal = (x2-x1)*(y2-y1);
cout<<"Q2: ("<<x1<<", "<<y1<<") ("<<x2<<", "<<y2<<") "<<cal<<endl;
}
if (!q3_x.empty()&&!q3_x.empty()){
int x1 = findmin(q3_x);
int y1 =findmin(q3_y);
int x2 = findmax(q3_x);
int y2 = findmax(q3_y);
int cal = (x2-x1)*(y2-y1);
cout<<"Q3: ("<<x1<<", "<<y1<<") ("<<x2<<", "<<y2<<") "<<cal<<endl;
}
if (!q4_x.empty()&&!q4_x.empty()){
int x1 = findmin(q4_x);
int y1 =findmin(q4_y);
int x2 = findmax(q4_x);
int y2 = findmax(q4_y);
int cal = (x2-x1)*(y2-y1);
cout<<"Q4: ("<<x1<<", "<<y1<<") ("<<x2<<", "<<y2<<") "<<cal<<endl;
}
}
} | # 2071155, 2024-11-02 14:02:29, PPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
int findmin(set<int>s){
int mins=999999;
for (auto c: s){
mins =min(c,mins);
}
return mins;
}
int findmax(set<int>s){
int mins=-999999;
for (auto c: s){
mins =max(c,mins);
}
return mins;
}
int main(){
int n;
cin>>n;
set<int> q1_x,q1_y,q2_x,q2_y,q3_x,q3_y,q4_x,q4_y;
int x ,y;
while (n--){
cin>>x>>y;
if (x!=0&&y!=0){
if (x>0&&y>0){//q1
q1_x.insert(x);
q1_y.insert(y);
}
else if(x<0&&y>0){//q2
q2_x.insert(x);
q2_y.insert(y);
}
else if(x>0&&y<0){//q3
q3_x.insert(x);
q3_y.insert(y);
}
else if(x<0&&y<0){//q4
q4_x.insert(x);
q4_y.insert(y);
}
}
}
// find q1
if (q1_x.empty()&&q1_y.empty()&&q2_x.empty()&&q2_y.empty()&&q3_x.empty()&&q3_y.empty()&&q4_x.empty()&&q4_y.empty()){
cout<<"No point in any quadrant"<<endl;
}
else{
if (!q1_x.empty()&&!q1_x.empty()){
int x1 = findmin(q1_x);
int y1 =findmin(q1_y);
int x2 = findmax(q1_x);
int y2 = findmax(q1_y);
int cal = (x2-x1)*(y2-y1);
cout<<"Q1: ("<<x1<<", "<<y1<<") ("<<x2<<", "<<y2<<") "<<cal<<endl;
}
if (!q2_x.empty()&&!q2_x.empty()){
int x1 = findmin(q2_x);
int y1 =findmin(q2_y);
int x2 = findmax(q2_x);
int y2 = findmax(q2_y);
int cal = (x2-x1)*(y2-y1);
cout<<"Q2: ("<<x1<<", "<<y1<<") ("<<x2<<", "<<y2<<") "<<cal<<endl;
}
if (!q4_x.empty()&&!q4_x.empty()){
int x1 = findmin(q4_x);
int y1 =findmin(q4_y);
int x2 = findmax(q4_x);
int y2 = findmax(q4_y);
int cal = (x2-x1)*(y2-y1);
cout<<"Q3: ("<<x1<<", "<<y1<<") ("<<x2<<", "<<y2<<") "<<cal<<endl;
}
if (!q3_x.empty()&&!q3_x.empty()){
int x1 = findmin(q3_x);
int y1 =findmin(q3_y);
int x2 = findmax(q3_x);
int y2 = findmax(q3_y);
int cal = (x2-x1)*(y2-y1);
cout<<"Q4: ("<<x1<<", "<<y1<<") ("<<x2<<", "<<y2<<") "<<cal<<endl;
}
}
} |
# 2069508, 2024-11-02 10:53:54, P----P---- (20%)
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
// vector<float> x;
// vector<float> y;
// for (int i = 0; i < n; i++)
// {
// float xin, yin;
// cin >> xin >> yin;
// x.push_back(xin);
// y.push_back(yin);
// }
vector<pair<float, float>> q1, q2, q3, q4;
for (int i = 0; i < n; i++)
{
float xin, yin;
cin >> xin >> yin;
if (xin > 0 && yin > 0)
q1.push_back(make_pair(xin, yin));
else if (xin < 0 && yin > 0)
q2.push_back(make_pair(xin, yin));
else if (xin < 0 && yin < 0)
q3.push_back(make_pair(xin, yin));
else if (xin > 0 && yin < 0)
q4.push_back(make_pair(xin, yin));
}
if (q1.size() == 0 && q2.size() == 0 && q3.size() == 0 && q4.size() == 0)
{
cout << "No point in any quadrant" << endl;
exit(0);
}
if (q1.size() != 0)
{
pair<float, float> bot_left, up_rigth;
vector<pair<float, float>> q1y(q1);
sort(q1.begin(), q1.end());
sort(q1y.begin(), q1y.end(), [](pair<float, float> a, pair<float, float> b)
{ return a.second < b.second; });
cout << "Q1: (" << q1[0].first << ", " << q1y[0].second << ") (" << q1[q1.size() - 1].first << ", " << q1y[q1y.size() - 1].second << ") "
<< (q1[q1.size() - 1].first - q1[0].first) * (q1y[q1y.size() - 1].second - q1y[0].second) << endl;
}
if (q2.size() != 0)
{
pair<float, float> bot_left, up_rigth;
vector<pair<float, float>> q2y(q2);
sort(q2.begin(), q2.end());
sort(q2y.begin(), q2y.end(), [](pair<float, float> a, pair<float, float> b)
{ return a.second < b.second; });
cout << "q2: (" << q2[0].first << ", " << q2y[0].second << ") (" << q2[q2.size() - 1].first << ", " << q2y[q2y.size() - 1].second << ") "
<< (q2[q2.size() - 1].first - q2[0].first) * (q2y[q2y.size() - 1].second - q2y[0].second) << endl;
}
if (q3.size() != 0)
{
pair<float, float> bot_left, up_rigth;
vector<pair<float, float>> q3y(q3);
sort(q3.begin(), q3.end());
sort(q3y.begin(), q3y.end(), [](pair<float, float> a, pair<float, float> b)
{ return a.second < b.second; });
cout << "q3: (" << q3[0].first << ", " << q3y[0].second << ") (" << q3[q3.size() - 1].first << ", " << q3y[q3y.size() - 1].second << ") "
<< (q3[q3.size() - 1].first - q3[0].first) * (q3y[q3y.size() - 1].second - q3y[0].second) << endl;
}
if (q4.size() != 0)
{
pair<float, float> bot_left, up_rigth;
vector<pair<float, float>> q4y(q4);
sort(q4.begin(), q4.end());
sort(q4y.begin(), q4y.end(), [](pair<float, float> a, pair<float, float> b)
{ return a.second < b.second; });
cout << "q4: (" << q4[0].first << ", " << q4y[0].second << ") (" << q4[q4.size() - 1].first << ", " << q4y[q4y.size() - 1].second << ") "
<< (q4[q4.size() - 1].first - q4[0].first) * (q4y[q4y.size() - 1].second - q4y[0].second) << endl;
}
} | # 2069524, 2024-11-02 10:55:05, PPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
// vector<float> x;
// vector<float> y;
// for (int i = 0; i < n; i++)
// {
// float xin, yin;
// cin >> xin >> yin;
// x.push_back(xin);
// y.push_back(yin);
// }
vector<pair<float, float>> q1, q2, q3, q4;
for (int i = 0; i < n; i++)
{
float xin, yin;
cin >> xin >> yin;
if (xin > 0 && yin > 0)
q1.push_back(make_pair(xin, yin));
else if (xin < 0 && yin > 0)
q2.push_back(make_pair(xin, yin));
else if (xin < 0 && yin < 0)
q3.push_back(make_pair(xin, yin));
else if (xin > 0 && yin < 0)
q4.push_back(make_pair(xin, yin));
}
if (q1.size() == 0 && q2.size() == 0 && q3.size() == 0 && q4.size() == 0)
{
cout << "No point in any quadrant" << endl;
exit(0);
}
if (q1.size() != 0)
{
pair<float, float> bot_left, up_rigth;
vector<pair<float, float>> q1y(q1);
sort(q1.begin(), q1.end());
sort(q1y.begin(), q1y.end(), [](pair<float, float> a, pair<float, float> b)
{ return a.second < b.second; });
cout << "Q1: (" << q1[0].first << ", " << q1y[0].second << ") (" << q1[q1.size() - 1].first << ", " << q1y[q1y.size() - 1].second << ") "
<< (q1[q1.size() - 1].first - q1[0].first) * (q1y[q1y.size() - 1].second - q1y[0].second) << endl;
}
if (q2.size() != 0)
{
pair<float, float> bot_left, up_rigth;
vector<pair<float, float>> q2y(q2);
sort(q2.begin(), q2.end());
sort(q2y.begin(), q2y.end(), [](pair<float, float> a, pair<float, float> b)
{ return a.second < b.second; });
cout << "Q2: (" << q2[0].first << ", " << q2y[0].second << ") (" << q2[q2.size() - 1].first << ", " << q2y[q2y.size() - 1].second << ") "
<< (q2[q2.size() - 1].first - q2[0].first) * (q2y[q2y.size() - 1].second - q2y[0].second) << endl;
}
if (q3.size() != 0)
{
pair<float, float> bot_left, up_rigth;
vector<pair<float, float>> q3y(q3);
sort(q3.begin(), q3.end());
sort(q3y.begin(), q3y.end(), [](pair<float, float> a, pair<float, float> b)
{ return a.second < b.second; });
cout << "Q3: (" << q3[0].first << ", " << q3y[0].second << ") (" << q3[q3.size() - 1].first << ", " << q3y[q3y.size() - 1].second << ") "
<< (q3[q3.size() - 1].first - q3[0].first) * (q3y[q3y.size() - 1].second - q3y[0].second) << endl;
}
if (q4.size() != 0)
{
pair<float, float> bot_left, up_rigth;
vector<pair<float, float>> q4y(q4);
sort(q4.begin(), q4.end());
sort(q4y.begin(), q4y.end(), [](pair<float, float> a, pair<float, float> b)
{ return a.second < b.second; });
cout << "Q4: (" << q4[0].first << ", " << q4y[0].second << ") (" << q4[q4.size() - 1].first << ", " << q4y[q4y.size() - 1].second << ") "
<< (q4[q4.size() - 1].first - q4[0].first) * (q4y[q4y.size() - 1].second - q4y[0].second) << endl;
}
} |
# 2070152, 2024-11-02 11:54:28, PPPPPPP-P- (80%)
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
vector<int> q1x, q1y, q2x, q2y, q3x, q3y, q4x, q4y;
int x, y;
while(n--)
{
cin >> x >> y;
if(x > 0 && y > 0)
{
q1x.push_back(x);
q1y.push_back(y);
}
else if(x < 0 && y > 0)
{
q2x.push_back(x);
q2y.push_back(y);
}
else if(x < 0 && y < 0)
{
q3x.push_back(x);
q3y.push_back(y);
}
else if(x > 0 && y < 0)
{
q4x.push_back(x);
q4y.push_back(y);
}
}
sort(q1x.begin(), q1x.end());
sort(q1y.begin(), q1y.end());
sort(q2x.begin(), q2x.end());
sort(q2y.begin(), q2y.end());
sort(q3x.begin(), q3x.end());
sort(q3y.begin(), q3y.end());
sort(q4x.begin(), q4x.end());
sort(q4y.begin(), q4y.end());
if(!q1x.empty())cout << "Q1: (" << q1x[0] << ", " << q1y[0]<< ") (" << q1x[q1x.size()-1] << ", " << q1y[q1y.size()-1] << ") " << (q1x[q1x.size()-1] - q1x[0]) * (q1y[q1y.size()-1] - q1y[0]) << endl;
if(!q2x.empty())cout << "Q2: (" << q2x[0] << ", " << q2y[0]<< ") (" << q2x[q2x.size()-1] << ", " << q2y[q2y.size()-1] << ") " << (q2x[q2x.size()-1] - q2x[0]) * (q2y[q2y.size()-1] - q2y[0]) << endl;
if(!q3x.empty())cout << "Q3: (" << q3x[0] << ", " << q3y[0]<< ") (" << q3x[q3x.size()-1] << ", " << q3y[q3y.size()-1] << ") " << (q3x[q3x.size()-1] - q3x[0]) * (q3y[q3y.size()-1] - q3y[0]) << endl;
if(!q4x.empty())cout << "Q4: (" << q4x[0] << ", " << q4y[0]<< ") (" << q4x[q4x.size()-1] << ", " << q4y[q4y.size()-1] << ") " << (q4x[q3x.size()-1] - q4x[0]) * (q4y[q4y.size()-1] - q4y[0]) << endl;
if(q1x.empty() && q2x.empty() && q3x.empty() && q4x.empty()) cout << "No point in any quadrant";
return 0;
} | # 2070173, 2024-11-02 11:55:29, PPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
vector<int> q1x, q1y, q2x, q2y, q3x, q3y, q4x, q4y;
int x, y;
while(n--)
{
cin >> x >> y;
if(x > 0 && y > 0)
{
q1x.push_back(x);
q1y.push_back(y);
}
else if(x < 0 && y > 0)
{
q2x.push_back(x);
q2y.push_back(y);
}
else if(x < 0 && y < 0)
{
q3x.push_back(x);
q3y.push_back(y);
}
else if(x > 0 && y < 0)
{
q4x.push_back(x);
q4y.push_back(y);
}
}
sort(q1x.begin(), q1x.end());
sort(q1y.begin(), q1y.end());
sort(q2x.begin(), q2x.end());
sort(q2y.begin(), q2y.end());
sort(q3x.begin(), q3x.end());
sort(q3y.begin(), q3y.end());
sort(q4x.begin(), q4x.end());
sort(q4y.begin(), q4y.end());
if(!q1x.empty())cout << "Q1: (" << q1x[0] << ", " << q1y[0]<< ") (" << q1x[q1x.size()-1] << ", " << q1y[q1y.size()-1] << ") " << (q1x[q1x.size()-1] - q1x[0]) * (q1y[q1y.size()-1] - q1y[0]) << endl;
if(!q2x.empty())cout << "Q2: (" << q2x[0] << ", " << q2y[0]<< ") (" << q2x[q2x.size()-1] << ", " << q2y[q2y.size()-1] << ") " << (q2x[q2x.size()-1] - q2x[0]) * (q2y[q2y.size()-1] - q2y[0]) << endl;
if(!q3x.empty())cout << "Q3: (" << q3x[0] << ", " << q3y[0]<< ") (" << q3x[q3x.size()-1] << ", " << q3y[q3y.size()-1] << ") " << (q3x[q3x.size()-1] - q3x[0]) * (q3y[q3y.size()-1] - q3y[0]) << endl;
if(!q4x.empty())cout << "Q4: (" << q4x[0] << ", " << q4y[0]<< ") (" << q4x[q4x.size()-1] << ", " << q4y[q4y.size()-1] << ") " << (q4x[q4x.size()-1] - q4x[0]) * (q4y[q4y.size()-1] - q4y[0]) << endl;
if(q1x.empty() && q2x.empty() && q3x.empty() && q4x.empty()) cout << "No point in any quadrant";
return 0;
} |
# 2071476, 2024-11-02 14:39:55, xxxxPxPPxP (40%)
#include <iostream>
#include <vector>
#include <set>
#include <utility>
#include <cmath>
using namespace std;
int main() {
int n = 0;
cin >> n;
//multiset<pair<int, int>> point = {}, q1 {}, q2 = {}, q3 = {}, q4 = {};
vector<pair<int, int>> point = {}, q1 {}, q2 = {}, q3 = {}, q4 = {};
vector<pair<int, int>> result_q1 = {}, result_q2 = {}, result_q3 = {}, result_q4 = {};
int x = 0 ,y = 0;
for (int i = 0; i < n; i++) {
cin >> x >> y;
point.push_back(make_pair(x, y));
}
for (auto e : point) {
if (e.first > 0 && e.second > 0) {
q1.push_back(make_pair(e.first, e.second));
}
if (e.first < 0 && e.second > 0) {
q2.push_back(make_pair(e.first, e.second));
}
if (e.first < 0 && e.second < 0) {
q3.push_back(make_pair(e.first, e.second));
}
if (e.first > 0 && e.second < 0) {
q4.push_back(make_pair(e.first, e.second));
}
}
set<int> sort_q1_x = {}, sort_q1_y = {};
for (auto e : q1) {
sort_q1_x.insert(e.first);
sort_q1_y.insert(e.second);
}
auto itr_less_q1_x = sort_q1_x.begin();
auto itr_less_q1_y = sort_q1_y.begin();
auto itr_most_q1_x = --(sort_q1_x.end());
auto itr_most_q1_y = --(sort_q1_y.end());
//result Q1
result_q1.push_back(make_pair(*(itr_less_q1_x), *(itr_less_q1_y)));
result_q1.push_back(make_pair(*(itr_most_q1_x), *(itr_most_q1_y)));
if (!result_q1.empty()) {
cout << endl;
cout << "Q1: ";
for (auto e : result_q1) {
cout << "(" << e.first << ", " << e.second << ") ";
}
int area = (abs(abs(*(itr_less_q1_x)) - abs(*(itr_most_q1_x)))) * (abs(abs(*(itr_less_q1_y)) - abs(*(itr_most_q1_y))));
cout << area;
}
//end
set<int> sort_q2_x = {}, sort_q2_y = {};
for (auto e : q2) {
sort_q2_x.insert(e.first);
sort_q2_y.insert(e.second);
}
auto itr_less_q2_x = sort_q2_x.begin();
auto itr_less_q2_y = sort_q2_y.begin();
auto itr_most_q2_x = --(sort_q2_x.end());
auto itr_most_q2_y = --(sort_q2_y.end());
//result Q2
result_q2.push_back(make_pair(*(itr_less_q2_x), *(itr_less_q2_y)));
result_q2.push_back(make_pair(*(itr_most_q2_x), *(itr_most_q2_y)));
if (!result_q2.empty()) {
cout << endl;
cout << "Q2: ";
for (auto e : result_q2) {
cout << "(" << e.first << ", " << e.second << ") ";
}
int area = (abs(abs(*(itr_less_q2_x)) - abs(*(itr_most_q2_x)))) * (abs(abs(*(itr_less_q2_y)) - abs(*(itr_most_q2_y))));
cout << area;
}
//end
set<int> sort_q3_x = {}, sort_q3_y = {};
for (auto e : q3) {
sort_q3_x.insert(e.first);
sort_q3_y.insert(e.second);
}
auto itr_less_q3_x = sort_q3_x.begin();
auto itr_less_q3_y = sort_q3_y.begin();
auto itr_most_q3_x = --(sort_q3_x.end());
auto itr_most_q3_y = --(sort_q3_y.end());
//result Q3
result_q3.push_back(make_pair(*(itr_less_q3_x), *(itr_less_q3_y)));
result_q3.push_back(make_pair(*(itr_most_q3_x), *(itr_most_q3_y)));
if (!result_q3.empty()) {
cout << endl;
cout << "Q3: ";
for (auto e : result_q3) {
cout << "(" << e.first << ", " << e.second << ") ";
}
int area = (abs(abs(*(itr_less_q3_x)) - abs(*(itr_most_q3_x)))) * (abs(abs(*(itr_less_q3_y)) - abs(*(itr_most_q3_y))));
cout << area;
}
//end
set<int> sort_q4_x = {}, sort_q4_y = {};
for (auto e : q4) {
sort_q4_x.insert(e.first);
sort_q4_y.insert(e.second);
}
auto itr_less_q4_x = sort_q4_x.begin();
auto itr_less_q4_y = sort_q4_y.begin();
auto itr_most_q4_x = --(sort_q4_x.end());
auto itr_most_q4_y = --(sort_q4_y.end());
//result Q3
result_q4.push_back(make_pair(*(itr_less_q4_x), *(itr_less_q4_y)));
result_q4.push_back(make_pair(*(itr_most_q4_x), *(itr_most_q4_y)));
if (!result_q4.empty()) {
cout << endl;
cout << "Q4: ";
for (auto e : result_q4) {
cout << "(" << e.first << ", " << e.second << ") ";
}
int area = (abs(abs(*(itr_less_q4_x)) - abs(*(itr_most_q4_x)))) * (abs(abs(*(itr_less_q4_y)) - abs(*(itr_most_q4_y))));
cout << area;
}
} | # 2071550, 2024-11-02 14:47:56, PPPPPPPPPP (100%)
#include <iostream>
#include <vector>
#include <set>
#include <utility>
#include <cmath>
using namespace std;
int main() {
int n = 0;
cin >> n;
bool noresult = true;
//multiset<pair<int, int>> point = {}, q1 {}, q2 = {}, q3 = {}, q4 = {};
vector<pair<int, int>> point = {}, q1 {}, q2 = {}, q3 = {}, q4 = {};
vector<pair<int, int>> result_q1 = {}, result_q2 = {}, result_q3 = {}, result_q4 = {};
int x = 0 ,y = 0;
for (int i = 0; i < n; i++) {
cin >> x >> y;
point.push_back(make_pair(x, y));
}
for (auto e : point) {
if (e.first > 0 && e.second > 0) {
q1.push_back(make_pair(e.first, e.second));
}
if (e.first < 0 && e.second > 0) {
q2.push_back(make_pair(e.first, e.second));
}
if (e.first < 0 && e.second < 0) {
q3.push_back(make_pair(e.first, e.second));
}
if (e.first > 0 && e.second < 0) {
q4.push_back(make_pair(e.first, e.second));
}
}
if (!q1.empty()) {
set<int> sort_q1_x = {}, sort_q1_y = {};
for (auto e : q1) {
sort_q1_x.insert(e.first);
sort_q1_y.insert(e.second);
}
auto itr_less_q1_x = sort_q1_x.begin();
auto itr_less_q1_y = sort_q1_y.begin();
auto itr_most_q1_x = --(sort_q1_x.end());
auto itr_most_q1_y = --(sort_q1_y.end());
//result Q1
result_q1.push_back(make_pair(*(itr_less_q1_x), *(itr_less_q1_y)));
result_q1.push_back(make_pair(*(itr_most_q1_x), *(itr_most_q1_y)));
if (!result_q1.empty()) {
cout << endl;
cout << "Q1: ";
for (auto e : result_q1) {
cout << "(" << e.first << ", " << e.second << ") ";
}
int area = (abs(abs(*(itr_less_q1_x)) - abs(*(itr_most_q1_x)))) * (abs(abs(*(itr_less_q1_y)) - abs(*(itr_most_q1_y))));
cout << area;
noresult = false;
}
//end
}
if (!q2.empty()) {
set<int> sort_q2_x = {}, sort_q2_y = {};
for (auto e : q2) {
sort_q2_x.insert(e.first);
sort_q2_y.insert(e.second);
}
auto itr_less_q2_x = sort_q2_x.begin();
auto itr_less_q2_y = sort_q2_y.begin();
auto itr_most_q2_x = --(sort_q2_x.end());
auto itr_most_q2_y = --(sort_q2_y.end());
//result Q2
result_q2.push_back(make_pair(*(itr_less_q2_x), *(itr_less_q2_y)));
result_q2.push_back(make_pair(*(itr_most_q2_x), *(itr_most_q2_y)));
if (!result_q2.empty()) {
cout << endl;
cout << "Q2: ";
for (auto e : result_q2) {
cout << "(" << e.first << ", " << e.second << ") ";
}
int area = (abs(abs(*(itr_less_q2_x)) - abs(*(itr_most_q2_x)))) * (abs(abs(*(itr_less_q2_y)) - abs(*(itr_most_q2_y))));
cout << area;
noresult = false;
}
//end
}
if (!q3.empty()) {
set<int> sort_q3_x = {}, sort_q3_y = {};
for (auto e : q3) {
sort_q3_x.insert(e.first);
sort_q3_y.insert(e.second);
}
auto itr_less_q3_x = sort_q3_x.begin();
auto itr_less_q3_y = sort_q3_y.begin();
auto itr_most_q3_x = --(sort_q3_x.end());
auto itr_most_q3_y = --(sort_q3_y.end());
//result Q3
result_q3.push_back(make_pair(*(itr_less_q3_x), *(itr_less_q3_y)));
result_q3.push_back(make_pair(*(itr_most_q3_x), *(itr_most_q3_y)));
if (!result_q3.empty()) {
cout << endl;
cout << "Q3: ";
for (auto e : result_q3) {
cout << "(" << e.first << ", " << e.second << ") ";
}
int area = (abs(abs(*(itr_less_q3_x)) - abs(*(itr_most_q3_x)))) * (abs(abs(*(itr_less_q3_y)) - abs(*(itr_most_q3_y))));
cout << area;
noresult = false;
}
//end
}
if (!q4.empty()) {
set<int> sort_q4_x = {}, sort_q4_y = {};
for (auto e : q4) {
sort_q4_x.insert(e.first);
sort_q4_y.insert(e.second);
}
auto itr_less_q4_x = sort_q4_x.begin();
auto itr_less_q4_y = sort_q4_y.begin();
auto itr_most_q4_x = --(sort_q4_x.end());
auto itr_most_q4_y = --(sort_q4_y.end());
//result Q3
result_q4.push_back(make_pair(*(itr_less_q4_x), *(itr_less_q4_y)));
result_q4.push_back(make_pair(*(itr_most_q4_x), *(itr_most_q4_y)));
if (!result_q4.empty()) {
cout << endl;
cout << "Q4: ";
for (auto e : result_q4) {
cout << "(" << e.first << ", " << e.second << ") ";
}
int area = (abs(abs(*(itr_less_q4_x)) - abs(*(itr_most_q4_x)))) * (abs(abs(*(itr_less_q4_y)) - abs(*(itr_most_q4_y))));
cout << area;
noresult = false;
}
}
if (noresult == true) {
cout << "No point in any quadrant";
}
} |
# 2070725, 2024-11-02 13:08:16, xxxxPxPPxP (40%)
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
int n;
int x, y;
cin >> n;
vector<pair<int, int>> q1;
vector<pair<int, int>> q2;
vector<pair<int, int>> q3;
vector<pair<int, int>> q4;
vector<int> q1x;
vector<int> q1y;
vector<int> q2x;
vector<int> q2y;
vector<int> q3x;
vector<int> q3y;
vector<int> q4x;
vector<int> q4y;
while(n--){
cin >> x >> y;
if(x > 0 && y > 0){
q1.push_back({x, y});
q1x.push_back(x);
q1y.push_back(y);
}
else if(x < 0 && y > 0){
q2.push_back({x, y});
q2x.push_back(x);
q2y.push_back(y);
}
else if(x < 0 && y < 0){
q3.push_back({x, y});
q3x.push_back(x);
q3y.push_back(y);
}
else if(x > 0 && y < 0){
q4.push_back({x, y});
q4x.push_back(x);
q4y.push_back(y);
}
}
//cal area
int w1, h1, area1;
sort(q1x.begin(), q1x.end());
sort(q1y.begin(), q1y.end());
w1 = q1x.back() - q1x.front();
h1 = q1y.back() - q1y.front();
area1 = w1 * h1;
cout << "Q1: " << "(" << q1x.front() << ", " << q1y.front() << ") (" << q1x.back() << ", " << q1y.back() << ") " << area1 << endl;
int w2, h2, area2;
sort(q2x.begin(), q2x.end());
sort(q2y.begin(), q2y.end());
w2 = q2x.back() - q2x.front();
h2 = q2y.back() - q2y.front();
area2 = w2 * h2;
cout << "Q2: " << "(" << q2x.front() << ", " << q2y.front() << ") (" << q2x.back() << ", " << q2y.back() << ") " << area2 << endl;
int w3, h3, area3;
sort(q3x.begin(), q3x.end());
sort(q3y.begin(), q3y.end());
w3 = q3x.back() - q3x.front();
h3 = q3y.back() - q3y.front();
area3 = w3 * h3;
cout << "Q3: " << "(" << q3x.front() << ", " << q3y.front() << ") (" << q3x.back() << ", " << q3y.back() << ") " << area3 << endl;
int w4, h4,area4;
sort(q4x.begin(), q4x.end());
sort(q4y.begin(), q4y.end());
w4 = q4x.back() - q4x.front();
h4 = q4y.back() - q4y.front();
area4 = w4 * h4;
cout << "Q4: " << "(" << q4x.front() << ", " << q4y.front() << ") (" << q4x.back() << ", " << q4y.back() << ") " << area4 << endl;
} | # 2070770, 2024-11-02 13:14:21, PPPPPPPPPP (100%)
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
int n;
int x, y;
cin >> n;
vector<pair<int, int>> q1;
vector<pair<int, int>> q2;
vector<pair<int, int>> q3;
vector<pair<int, int>> q4;
vector<int> q1x;
vector<int> q1y;
vector<int> q2x;
vector<int> q2y;
vector<int> q3x;
vector<int> q3y;
vector<int> q4x;
vector<int> q4y;
while(n--){
cin >> x >> y;
if(x > 0 && y > 0){
q1.push_back({x, y});
q1x.push_back(x);
q1y.push_back(y);
}
else if(x < 0 && y > 0){
q2.push_back({x, y});
q2x.push_back(x);
q2y.push_back(y);
}
else if(x < 0 && y < 0){
q3.push_back({x, y});
q3x.push_back(x);
q3y.push_back(y);
}
else if(x > 0 && y < 0){
q4.push_back({x, y});
q4x.push_back(x);
q4y.push_back(y);
}
}
if(q1.empty() && q2.empty() && q3.empty() && q4.empty()){
cout << "No point in any quadrant";
}
else{
//cal area
if(!(q1.empty())){
int w1, h1, area1;
sort(q1x.begin(), q1x.end());
sort(q1y.begin(), q1y.end());
w1 = q1x.back() - q1x.front();
h1 = q1y.back() - q1y.front();
area1 = w1 * h1;
cout << "Q1: " << "(" << q1x.front() << ", " << q1y.front() << ") (" << q1x.back() << ", " << q1y.back() << ") " << area1 << endl;
}
if(!(q2.empty())){
int w2, h2, area2;
sort(q2x.begin(), q2x.end());
sort(q2y.begin(), q2y.end());
w2 = q2x.back() - q2x.front();
h2 = q2y.back() - q2y.front();
area2 = w2 * h2;
cout << "Q2: " << "(" << q2x.front() << ", " << q2y.front() << ") (" << q2x.back() << ", " << q2y.back() << ") " << area2 << endl;
}
if(!(q3.empty())){
int w3, h3, area3;
sort(q3x.begin(), q3x.end());
sort(q3y.begin(), q3y.end());
w3 = q3x.back() - q3x.front();
h3 = q3y.back() - q3y.front();
area3 = w3 * h3;
cout << "Q3: " << "(" << q3x.front() << ", " << q3y.front() << ") (" << q3x.back() << ", " << q3y.back() << ") " << area3 << endl;
}
if(!(q4.empty())){
int w4, h4,area4;
sort(q4x.begin(), q4x.end());
sort(q4y.begin(), q4y.end());
w4 = q4x.back() - q4x.front();
h4 = q4y.back() - q4y.front();
area4 = w4 * h4;
cout << "Q4: " << "(" << q4x.front() << ", " << q4y.front() << ") (" << q4x.back() << ", " << q4y.back() << ") " << area4 << endl;
}
}
} |
# 2069127, 2024-11-02 10:15:08, ----PP---- (20%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int num;
cin >> num;
vector<pair<int,int>> q1;
vector<pair<int,int>> q2;
vector<pair<int,int>> q3;
vector<pair<int,int>> q4;
for(int i =0 ;i < num;i++){
int x,y;
cin >> x >> y;
if(x == 0 || y == 0){
continue;
}else if(x > 0 && y >0){
q1.push_back(make_pair(x,y));
}else if(x < 0 && y >0){
q2.push_back(make_pair(x,y));
}else if(x < 0 && y <0){
q3.push_back(make_pair(x,y));
}else if(x > 0 && y <0){
q4.push_back(make_pair(x,y));
}
}
if(q1.empty() && q2.empty() && q3.empty() && q4.empty()){
cout << "No point in any quadrant";
return 0;
}
if(!q1.empty()){
int Minx = 9999999;
int Miny = 9999999;
int Maxx = -9999999;
int Maxy = -9999999;
for(auto i: q1){
if(i.first < Minx){
Minx = i.first;
}
if(i.second < Miny){
Miny = i.second;
}
if(i.first > Maxx){
Maxx = i.first;
}
if(i.second > Maxy){
Maxy = i.second;
}
}
int area = (Maxx-Minx)*(Maxy-Miny);
cout << "Q1: "<< "(" << Minx << ", " << Miny << ") (" << Maxx << ", " << Miny << ")" << " " << area << endl;
}
if(!q2.empty()){
int Minx = 9999999;
int Miny = 9999999;
int Maxx = -9999999;
int Maxy = -9999999;
for(auto i: q2){
if(i.first < Minx){
Minx = i.first;
}
if(i.second < Miny){
Miny = i.second;
}
if(i.first > Maxx){
Maxx = i.first;
}
if(i.second > Maxy){
Maxy = i.second;
}
}
int area = (Maxx-Minx)*(Maxy-Miny);
cout << "Q2: " << "(" << Minx << ", " << Miny << ") (" << Maxx << ", " << Miny << ")" << " " << area << endl;
}
if(!q3.empty()){
int Minx = 9999999;
int Miny = 9999999;
int Maxx = -9999999;
int Maxy = -9999999;
for(auto i: q3){
if(i.first < Minx){
Minx = i.first;
}
if(i.second < Miny){
Miny = i.second;
}
if(i.first > Maxx){
Maxx = i.first;
}
if(i.second > Maxy){
Maxy = i.second;
}
}
int area = (Maxx-Minx)*(Maxy-Miny);
cout << "Q3: " << "(" << Minx << ", " << Miny << ") (" << Maxx << ", " << Miny << ")" << " " << area << endl;
}
if(!q4.empty()){
int Minx = 9999999;
int Miny = 9999999;
int Maxx = -9999999;
int Maxy = -9999999;
for(auto i: q4){
if(i.first < Minx){
Minx = i.first;
}
if(i.second < Miny){
Miny = i.second;
}
if(i.first > Maxx){
Maxx = i.first;
}
if(i.second > Maxy){
Maxy = i.second;
}
}
int area = (Maxx-Minx)*(Maxy-Miny);
cout << "Q4: " << "(" << Minx << ", " << Miny << ") (" << Maxx << ", " << Miny << ")" << " " << area << endl;
}
return 0;
} | # 2069133, 2024-11-02 10:16:24, PPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int num;
cin >> num;
vector<pair<int,int>> q1;
vector<pair<int,int>> q2;
vector<pair<int,int>> q3;
vector<pair<int,int>> q4;
for(int i =0 ;i < num;i++){
int x,y;
cin >> x >> y;
if(x == 0 || y == 0){
continue;
}else if(x > 0 && y >0){
q1.push_back(make_pair(x,y));
}else if(x < 0 && y >0){
q2.push_back(make_pair(x,y));
}else if(x < 0 && y <0){
q3.push_back(make_pair(x,y));
}else if(x > 0 && y <0){
q4.push_back(make_pair(x,y));
}
}
if(q1.empty() && q2.empty() && q3.empty() && q4.empty()){
cout << "No point in any quadrant";
return 0;
}
if(!q1.empty()){
int Minx = 9999999;
int Miny = 9999999;
int Maxx = -9999999;
int Maxy = -9999999;
for(auto i: q1){
if(i.first < Minx){
Minx = i.first;
}
if(i.second < Miny){
Miny = i.second;
}
if(i.first > Maxx){
Maxx = i.first;
}
if(i.second > Maxy){
Maxy = i.second;
}
}
int area = (Maxx-Minx)*(Maxy-Miny);
cout << "Q1: "<< "(" << Minx << ", " << Miny << ") (" << Maxx << ", " << Maxy << ")" << " " << area << endl;
}
if(!q2.empty()){
int Minx = 9999999;
int Miny = 9999999;
int Maxx = -9999999;
int Maxy = -9999999;
for(auto i: q2){
if(i.first < Minx){
Minx = i.first;
}
if(i.second < Miny){
Miny = i.second;
}
if(i.first > Maxx){
Maxx = i.first;
}
if(i.second > Maxy){
Maxy = i.second;
}
}
int area = (Maxx-Minx)*(Maxy-Miny);
cout << "Q2: " << "(" << Minx << ", " << Miny << ") (" << Maxx << ", " << Maxy << ")" << " " << area << endl;
}
if(!q3.empty()){
int Minx = 9999999;
int Miny = 9999999;
int Maxx = -9999999;
int Maxy = -9999999;
for(auto i: q3){
if(i.first < Minx){
Minx = i.first;
}
if(i.second < Miny){
Miny = i.second;
}
if(i.first > Maxx){
Maxx = i.first;
}
if(i.second > Maxy){
Maxy = i.second;
}
}
int area = (Maxx-Minx)*(Maxy-Miny);
cout << "Q3: " << "(" << Minx << ", " << Miny << ") (" << Maxx << ", " << Maxy << ")" << " " << area << endl;
}
if(!q4.empty()){
int Minx = 9999999;
int Miny = 9999999;
int Maxx = -9999999;
int Maxy = -9999999;
for(auto i: q4){
if(i.first < Minx){
Minx = i.first;
}
if(i.second < Miny){
Miny = i.second;
}
if(i.first > Maxx){
Maxx = i.first;
}
if(i.second > Maxy){
Maxy = i.second;
}
}
int area = (Maxx-Minx)*(Maxy-Miny);
cout << "Q4: " << "(" << Minx << ", " << Miny << ") (" << Maxx << ", " << Maxy << ")" << " " << area << endl;
}
return 0;
} |
# 2069435, 2024-11-02 10:46:27, xxxxPxPPxP (40%)
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int max_area(vector<int> v1 ,vector<int> v2){
int max_x=v1[v1.size()-1]-v1[0];
int max_y=v2[v1.size()-1]-v2[0];
return max_x*max_y;
}
int main(){
int n,x,y;
cin >> n;
vector<int> q1x;
vector<int> q1y;
vector<int> q2x;
vector<int> q2y;
vector<int> q3x;
vector<int> q3y;
vector<int> q4x;
vector<int> q4y;
for(int i=0;i<n;i++){
cin >> x >> y;
if(x>0 && y>0){
q1x.push_back(x);
q1y.push_back(y);
}else if(x<0 && y>0){
q2x.push_back(x);
q2y.push_back(y);
}else if(x<0 && y<0){
q3x.push_back(x);
q3y.push_back(y);
}else if(x>0 && y<0){
q4x.push_back(x);
q4y.push_back(y);
}
}
sort(q1x.begin(),q1x.end());
sort(q1y.begin(),q1y.end());
sort(q2x.begin(),q2x.end());
sort(q2y.begin(),q2y.end());
sort(q3x.begin(),q3x.end());
sort(q3y.begin(),q3y.end());
sort(q4x.begin(),q4x.end());
sort(q4y.begin(),q4y.end());
cout << "Q1: (" << q1x[0] << ", " << q1y[0] << ") (" << q1x[q1x.size()-1] << ", " << q1y[q1y.size()-1] << ") " << max_area(q1x,q1y) << endl;
cout << "Q2: (" << q2x[0] << ", " << q2y[0] << ") (" << q2x[q2x.size()-1] << ", " << q2y[q2y.size()-1] << ") " << max_area(q2x,q2y) << endl;
cout << "Q3: (" << q3x[0] << ", " << q3y[0] << ") (" << q3x[q3x.size()-1] << ", " << q3y[q3y.size()-1] << ") " << max_area(q3x,q3y) << endl;
cout << "Q4: (" << q4x[0] << ", " << q4y[0] << ") (" << q4x[q4x.size()-1] << ", " << q4y[q4y.size()-1] << ") " << max_area(q4x,q4y) << endl;
} | # 2069583, 2024-11-02 11:00:23, PPPPPPPPPP (100%)
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int max_area(vector<int> v1 ,vector<int> v2){
int max_x=v1[v1.size()-1]-v1[0];
int max_y=v2[v1.size()-1]-v2[0];
return max_x*max_y;
}
int main(){
int n,x,y;
cin >> n;
vector<int> q1x;
vector<int> q1y;
vector<int> q2x;
vector<int> q2y;
vector<int> q3x;
vector<int> q3y;
vector<int> q4x;
vector<int> q4y;
for(int i=0;i<n;i++){
cin >> x >> y;
if(x>0 && y>0){
q1x.push_back(x);
q1y.push_back(y);
}else if(x<0 && y>0){
q2x.push_back(x);
q2y.push_back(y);
}else if(x<0 && y<0){
q3x.push_back(x);
q3y.push_back(y);
}else if(x>0 && y<0){
q4x.push_back(x);
q4y.push_back(y);
}
}
sort(q1x.begin(),q1x.end());
sort(q1y.begin(),q1y.end());
sort(q2x.begin(),q2x.end());
sort(q2y.begin(),q2y.end());
sort(q3x.begin(),q3x.end());
sort(q3y.begin(),q3y.end());
sort(q4x.begin(),q4x.end());
sort(q4y.begin(),q4y.end());
if(!(q1x.empty() || q1y.empty())){
cout << "Q1: (" << q1x[0] << ", " << q1y[0] << ") (" << q1x[q1x.size()-1] << ", " << q1y[q1y.size()-1] << ") " << max_area(q1x,q1y) << endl;
}
if(!(q2x.empty() || q2y.empty())){
cout << "Q2: (" << q2x[0] << ", " << q2y[0] << ") (" << q2x[q2x.size()-1] << ", " << q2y[q2y.size()-1] << ") " << max_area(q2x,q2y) << endl;
}
if(!(q3x.empty() || q3y.empty())){
cout << "Q3: (" << q3x[0] << ", " << q3y[0] << ") (" << q3x[q3x.size()-1] << ", " << q3y[q3y.size()-1] << ") " << max_area(q3x,q3y) << endl;
}
if(!(q4x.empty() || q4y.empty())){
cout << "Q4: (" << q4x[0] << ", " << q4y[0] << ") (" << q4x[q4x.size()-1] << ", " << q4y[q4y.size()-1] << ") " << max_area(q4x,q4y) << endl;
}
if((q1x.empty() || q1y.empty()) && (q2x.empty() || q2y.empty()) && (q3x.empty() || q3y.empty()) && (q4x.empty() || q4y.empty())){
cout << "No point in any quadrant" << endl;
}
} |
# 2071266, 2024-11-02 14:15:25, -----P---- (10%)
#include<iostream>
#include<stack>
#include<set>
#include<map>
#include<climits>
#include<cmath>
using namespace std;
int main(){
int n = 0;
cin>>n;
// int areaQ1 = 0,areaQ2 = 0,areaQ3 = 0,areaQ4 = 0;
set<int>height1;// 2 5 6
set<int>width1;// 2 4 5
set<int>height2;// 2 5 6
set<int>width2;// 2 4 5
set<int>height3;// 2 5 6
set<int>width3;// 2 4 5
set<int>height4;// 2 5 6
set<int>width4;// 2 4 5
for(int i=0;i<n;i++){
int x,y;
cin>>x>>y;
if(x != 0 & y != 0){
if(x > 0 && y > 0)// Q1
{
height1.insert(abs(y));
width1.insert(abs(x));
}
else if(x < 0 && y > 0){// Q2
height2.insert(abs(y));
width2.insert(abs(x));
}
else if(x < 0 && y < 0){// Q3
height3.insert(abs(y));
width3.insert(abs(x));
}
else if(x > 0 && y < 0){// Q4
height4.insert(abs(y));
width4.insert(abs(x));
}
}
}
bool check = 0;
if(height1.size() >= 1){
cout<<"1 : ";
check = 1;
cout<<abs(*height1.rbegin() - *height1.begin()) * abs(*width1.rbegin() - *width1.begin())<<'\n';
}
if(height2.size() >= 1){
cout<<"2 : ";
check = 1;
cout<<abs(*height2.rbegin() - *height2.begin()) * abs(*width2.rbegin() - *width2.begin())<<'\n';
}
if(height3.size() >= 1){
cout<<"3 : ";
check = 1;
cout<<abs(*height3.rbegin() - *height3.begin()) * abs(*width3.rbegin() - *width3.begin())<<'\n';
}
if(height4.size() >= 1){
cout<<"Q4: ";
// cout<<"("<<*width4.begin()<<", "<<*width4.rbegin()<<") ("<<...<<", "<<...<<") ";
check = 1;
cout<<abs(*height4.rbegin() - *height4.begin()) * abs(*width4.rbegin() - *width4.begin())<<'\n';
}
if(check == 0){
cout<<"No point in any quadrant";
}
} | # 2071321, 2024-11-02 14:22:58, PPPPPPPPPP (100%)
#include<iostream>
#include<stack>
#include<set>
#include<map>
#include<climits>
#include<cmath>
using namespace std;
int main(){
int n = 0;
cin>>n;
// int areaQ1 = 0,areaQ2 = 0,areaQ3 = 0,areaQ4 = 0;
set<int>height1;// 2 5 6
set<int>width1;// 2 4 5
set<int>height2;// 2 5 6
set<int>width2;// 2 4 5
set<int>height3;// 2 5 6
set<int>width3;// 2 4 5
set<int>height4;// 2 5 6
set<int>width4;// 2 4 5
for(int i=0;i<n;i++){
int x,y;
cin>>x>>y;
if(x != 0 & y != 0){
if(x > 0 && y > 0)// Q1
{
height1.insert(abs(y));
width1.insert(abs(x));
}
else if(x < 0 && y > 0){// Q2
height2.insert(abs(y));
width2.insert(abs(x));
}
else if(x < 0 && y < 0){// Q3
height3.insert(abs(y));
width3.insert(abs(x));
}
else if(x > 0 && y < 0){// Q4
height4.insert(abs(y));
width4.insert(abs(x));
}
}
}
bool check = 0;
if(height1.size() >= 1){
cout<<"Q1: ";
cout<<"("<<*width1.begin()<<", "<<*height1.begin()<<") ("<<*width1.rbegin()<<", "<<*height1.rbegin()<<") ";
check = 1;
cout<<abs(*height1.rbegin() - *height1.begin()) * abs(*width1.rbegin() - *width1.begin())<<'\n';
}
if(height2.size() >= 1){
cout<<"Q2: ";
cout<<"(-"<<*width2.rbegin()<<", "<<*height2.begin()<<") (-"<<*width2.begin()<<", "<<*height2.rbegin()<<") ";
check = 1;
cout<<abs(*height2.rbegin() - *height2.begin()) * abs(*width2.rbegin() - *width2.begin())<<'\n';
}
if(height3.size() >= 1){
cout<<"Q3: ";
check = 1;
cout<<"(-"<<*width3.rbegin()<<", -"<<*height3.rbegin()<<") (-"<<*width3.begin()<<", -"<<*height3.begin()<<") ";
cout<<abs(*height3.rbegin() - *height3.begin()) * abs(*width3.rbegin() - *width3.begin())<<'\n';
}
if(height4.size() >= 1){
cout<<"Q4: ";
// cout<<"("<<*width4.begin()<<", "<<*width4.rbegin()<<") ("<<...<<", "<<...<<") ";
cout<<"("<<*width4.begin()<<", -"<<*height4.rbegin()<<") ("<<*width4.rbegin()<<", -"<<*height4.begin()<<") ";
check = 1;
cout<<abs(*height4.rbegin() - *height4.begin()) * abs(*width4.rbegin() - *width4.begin())<<'\n';
}
if(check == 0){
cout<<"No point in any quadrant";
}
} |
# 2068848, 2024-11-02 09:46:33, ----P-PP-P (40%)
#include<iostream>
#include<vector>
using namespace std;
struct point
{
int x,y;
};
int main()
{
vector<point> Q1;
vector<point> Q2;
vector<point> Q3;
vector<point> Q4;
int n;
cin >> n;
for (int i = 0; i < n; i++)
{
point temp;
int A,B;
cin >> A >> B;
temp.x = A;
temp.y = B;
if(A > 0 && B > 0)
{
Q1.push_back(temp);
}
if(A < 0 && B > 0)
{
Q2.push_back(temp);
}
if(A < 0 && B < 0)
{
Q3.push_back(temp);
}
if(A > 0 && B < 0)
{
Q4.push_back(temp);
}
}
int noyx = 100000, noyy = 100000, makx = -100000, maky = -100000;
for (size_t i = 0; i < Q1.size(); i++)
{
noyx = min(Q1[i].x,noyx);
noyy = min(Q1[i].y,noyy);
makx = max(Q1[i].x,makx);
maky = max(Q1[i].y,maky);
}
cout << "Q1: ";
cout << '(' << noyx << ", " << noyy << ") ";
cout << '(' << makx << ", " << maky << ") ";
cout << (makx-noyx) * (maky-noyy) << '\n';
noyx = 100000, noyy = 100000, makx = -100000, maky = -100000;
for (size_t i = 0; i < Q2.size(); i++)
{
noyx = min(Q2[i].x,noyx);
noyy = min(Q2[i].y,noyy);
makx = max(Q2[i].x,makx);
maky = max(Q2[i].y,maky);
}
cout << "Q2: ";
cout << '(' << noyx << ", " << noyy << ") ";
cout << '(' << makx << ", " << maky << ") ";
cout << (makx-noyx) * (maky-noyy) << '\n';
noyx = 100000, noyy = 100000, makx = -100000, maky = -100000;
for (size_t i = 0; i < Q3.size(); i++)
{
noyx = min(Q3[i].x,noyx);
noyy = min(Q3[i].y,noyy);
makx = max(Q3[i].x,makx);
maky = max(Q3[i].y,maky);
}
cout << "Q3: ";
cout << '(' << noyx << ", " << noyy << ") ";
cout << '(' << makx << ", " << maky << ") ";
cout << (makx-noyx) * (maky-noyy) << '\n';
noyx = 100000, noyy = 100000, makx = -100000, maky = -100000;
for (size_t i = 0; i < Q4.size(); i++)
{
noyx = min(Q4[i].x,noyx);
noyy = min(Q4[i].y,noyy);
makx = max(Q4[i].x,makx);
maky = max(Q4[i].y,maky);
}
cout << "Q4: ";
cout << '(' << noyx << ", " << noyy << ") ";
cout << '(' << makx << ", " << maky << ") ";
cout << (makx-noyx) * (maky-noyy) << '\n';
} | # 2068887, 2024-11-02 09:50:56, PPPPPPPPPP (100%)
#include<iostream>
#include<vector>
using namespace std;
struct point
{
int x,y;
};
int main()
{
vector<point> Q1;
vector<point> Q2;
vector<point> Q3;
vector<point> Q4;
int n;
cin >> n;
for (int i = 0; i < n; i++)
{
point temp;
int A,B;
cin >> A >> B;
temp.x = A;
temp.y = B;
if(A > 0 && B > 0)
{
Q1.push_back(temp);
}
if(A < 0 && B > 0)
{
Q2.push_back(temp);
}
if(A < 0 && B < 0)
{
Q3.push_back(temp);
}
if(A > 0 && B < 0)
{
Q4.push_back(temp);
}
}
int noyx = 100000, noyy = 100000, makx = -100000, maky = -100000;
if(Q1.size() != 0)
{
for (size_t i = 0; i < Q1.size(); i++)
{
noyx = min(Q1[i].x,noyx);
noyy = min(Q1[i].y,noyy);
makx = max(Q1[i].x,makx);
maky = max(Q1[i].y,maky);
}
cout << "Q1: ";
cout << '(' << noyx << ", " << noyy << ") ";
cout << '(' << makx << ", " << maky << ") ";
cout << (makx-noyx) * (maky-noyy) << '\n';
}
noyx = 100000, noyy = 100000, makx = -100000, maky = -100000;
if(Q2.size() != 0)
{
for (size_t i = 0; i < Q2.size(); i++)
{
noyx = min(Q2[i].x,noyx);
noyy = min(Q2[i].y,noyy);
makx = max(Q2[i].x,makx);
maky = max(Q2[i].y,maky);
}
cout << "Q2: ";
cout << '(' << noyx << ", " << noyy << ") ";
cout << '(' << makx << ", " << maky << ") ";
cout << (makx-noyx) * (maky-noyy) << '\n';
}
noyx = 100000, noyy = 100000, makx = -100000, maky = -100000;
if(Q3.size() != 0)
{
for (size_t i = 0; i < Q3.size(); i++)
{
noyx = min(Q3[i].x,noyx);
noyy = min(Q3[i].y,noyy);
makx = max(Q3[i].x,makx);
maky = max(Q3[i].y,maky);
}
cout << "Q3: ";
cout << '(' << noyx << ", " << noyy << ") ";
cout << '(' << makx << ", " << maky << ") ";
cout << (makx-noyx) * (maky-noyy) << '\n';
}
noyx = 100000, noyy = 100000, makx = -100000, maky = -100000;
if(Q4.size() != 0)
{
for (size_t i = 0; i < Q4.size(); i++)
{
noyx = min(Q4[i].x,noyx);
noyy = min(Q4[i].y,noyy);
makx = max(Q4[i].x,makx);
maky = max(Q4[i].y,maky);
}
cout << "Q4: ";
cout << '(' << noyx << ", " << noyy << ") ";
cout << '(' << makx << ", " << maky << ") ";
cout << (makx-noyx) * (maky-noyy) << '\n';
}
if(Q1.size() + Q2.size() + Q3.size() + Q4.size() == 0)
{
cout << "No point in any quadrant";
}
} |
# 2070933, 2024-11-02 13:35:33, PP---P---- (30%)
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <cmath>
using namespace std;
bool findBox(vector<pair<int, int>> &vec, int q)
{
int max_x = INT32_MIN, max_y = INT32_MIN, min_x = INT32_MAX, min_y = INT32_MAX;
if (vec.empty())
{
return false;
}
for (auto &elem : vec)
{
max_x = max(max_x, elem.first);
max_y = max(max_y, elem.second);
min_x = min(min_x, elem.first);
min_y = min(min_y, elem.second);
}
cout << "Q" << q << ": ";
cout << "(" << min_x << ", " << min_y << ") ";
cout << "(" << max_x << ", " << max_y << ") ";
cout << abs((max_x - min_x) * (max_y - min_y)) << endl;
return true;
}
int main()
{
int n;
cin >> n;
vector<pair<int, int>> q1;
vector<pair<int, int>> q2;
vector<pair<int, int>> q3;
vector<pair<int, int>> q4;
findBox(q1, 1);
for (int i = 0; i < n; i++)
{
int x, y;
cin >> x >> y;
if (x > 0 && y > 0)
q1.push_back(make_pair(x, y));
else if (x < 0 && y > 0)
q2.push_back(make_pair(x, y));
else if (x < 0 && y < 0)
q3.push_back(make_pair(x, y));
else if (x > 0 && y < 0)
q4.push_back(make_pair(x, y));
}
if (!findBox(q1, 1) && !findBox(q2, 2) && !findBox(q3, 3) && !findBox(q4, 4))
{
cout << "No point in any quadrant";
}
} | # 2070985, 2024-11-02 13:41:04, PPPPPPPPPP (100%)
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <cmath>
using namespace std;
bool findBox(vector<pair<int, int>> &vec, int q)
{
int max_x = INT32_MIN, max_y = INT32_MIN, min_x = INT32_MAX, min_y = INT32_MAX;
if (vec.empty())
{
return false;
}
for (auto &elem : vec)
{
max_x = max(max_x, elem.first);
max_y = max(max_y, elem.second);
min_x = min(min_x, elem.first);
min_y = min(min_y, elem.second);
}
cout << "Q" << q << ": ";
cout << "(" << min_x << ", " << min_y << ") ";
cout << "(" << max_x << ", " << max_y << ") ";
cout << abs((max_x - min_x) * (max_y - min_y)) << endl;
return true;
}
int main()
{
int n;
cin >> n;
vector<pair<int, int>> q1;
vector<pair<int, int>> q2;
vector<pair<int, int>> q3;
vector<pair<int, int>> q4;
findBox(q1, 1);
for (int i = 0; i < n; i++)
{
int x, y;
cin >> x >> y;
if (x > 0 && y > 0)
q1.push_back(make_pair(x, y));
else if (x < 0 && y > 0)
q2.push_back(make_pair(x, y));
else if (x < 0 && y < 0)
q3.push_back(make_pair(x, y));
else if (x > 0 && y < 0)
q4.push_back(make_pair(x, y));
}
bool find1 = findBox(q1, 1);
bool find2 = findBox(q2, 2);
bool find3 = findBox(q3, 3) ;
bool find4 = findBox(q4, 4);
if (!(find1||find2||find3||find4))
{
cout << "No point in any quadrant";
}
} |
# 2071451, 2024-11-02 14:36:43, -P-P-P--P- (40%)
#include<bits/stdc++.h>
#include<cmath>
#include<climits>
using namespace std;
int main(){
int n,a,b;
int minx1=INT_MAX,miny1=INT_MAX;
int minx2=INT_MAX,miny2 =INT_MAX;
int minx3=INT_MAX,miny3 =INT_MAX;
int minx4=INT_MAX,miny4=INT_MAX;
int maxx1=0,maxy1=0;
int maxx2=0,maxy2=0;
int maxx3=0,maxy3 =0;
int maxx4=0,maxy4=0;
bool pass1=false;
bool pass2=false;
bool pass3=false;
bool pass4=false;
cin>>n;
for(int i=0;i<n;i++){
cin>>a>>b;
if(a==0||b==0) continue;
if(a>0&&b>0){//q1
if(a>maxx1) maxx1=a;
if(b>maxy1) maxy1=b;
cout<<minx1<<endl;
if(a<minx1) minx1=a;
if(b<miny1) miny1=b;
pass1=true;
}
else if(a<0&&b<0){//q3
a=-1*a;
b=-1*b;
if(a>maxx3) maxx3=a;
if(b>maxy3) maxy3=b;
if(a<minx3) minx3=a;
if(b<miny3) miny3=b;
pass3=true;
}
else if(a>0&&b<0)//q4
{
b=-1*b;
if(a>maxx4) maxx4=a;
if(b>maxy4) maxy4=b;
if(a<minx4) minx4=a;
if(b<miny4) miny4=b;
pass4=true;
}
else if(a<0&&b>0){//q2
a=-1*a;
if(a>maxx2) maxx2=a;
if(b>maxy2) maxy2=b;
if(a<minx2) minx2=a;
if(b<miny2) miny2=b;
pass2=true;
}
}
if(pass1){
int area=(maxx1-minx1)*(maxy1-miny1);
cout<<"Q1: ("<<minx1<<", "<<miny1<<") ("<<maxx1<<", "<<maxy1<<") "<<area<<endl;
}
if(pass2){
int area=(maxx2-minx2)*(maxy2-miny2);
cout<<"Q2: ("<<-maxx2<<", "<<miny2<<") ("<<-minx2<<", "<<maxy2<<") "<<area<<endl;
}
if(pass3){
int area=(maxx3-minx3)*(maxy3-miny3);
cout<<"Q3: ("<<-maxx3<<", "<<-maxy3<<") ("<<-minx3<<", "<<-miny3<<") "<<area<<endl;
}
if(pass4){
int area=(maxx4-minx4)*(maxy4-miny4);
cout<<"Q4: ("<<minx4<<", "<<-maxy4<<") ("<<maxx4<<", "<<-miny4<<") "<<area<<endl;
}
if(!(pass1||pass2||pass3||pass4)){
cout<<"No point in any quadrant";
}
} | # 2071475, 2024-11-02 14:39:05, PPPPPPPPPP (100%)
#include<bits/stdc++.h>
#include<cmath>
#include<climits>
using namespace std;
int main(){
int n,a,b;
int minx1=INT_MAX,miny1=INT_MAX;
int minx2=INT_MAX,miny2 =INT_MAX;
int minx3=INT_MAX,miny3 =INT_MAX;
int minx4=INT_MAX,miny4=INT_MAX;
int maxx1=0,maxy1=0;
int maxx2=0,maxy2=0;
int maxx3=0,maxy3 =0;
int maxx4=0,maxy4=0;
bool pass1=false;
bool pass2=false;
bool pass3=false;
bool pass4=false;
cin>>n;
for(int i=0;i<n;i++){
cin>>a>>b;
if(a==0||b==0) continue;
if(a>0&&b>0){//q1
if(a>maxx1) maxx1=a;
if(b>maxy1) maxy1=b;
if(a<minx1) minx1=a;
if(b<miny1) miny1=b;
pass1=true;
}
else if(a<0&&b<0){//q3
a=-1*a;
b=-1*b;
if(a>maxx3) maxx3=a;
if(b>maxy3) maxy3=b;
if(a<minx3) minx3=a;
if(b<miny3) miny3=b;
pass3=true;
}
else if(a>0&&b<0)//q4
{
b=-1*b;
if(a>maxx4) maxx4=a;
if(b>maxy4) maxy4=b;
if(a<minx4) minx4=a;
if(b<miny4) miny4=b;
pass4=true;
}
else if(a<0&&b>0){//q2
a=-1*a;
if(a>maxx2) maxx2=a;
if(b>maxy2) maxy2=b;
if(a<minx2) minx2=a;
if(b<miny2) miny2=b;
pass2=true;
}
}
if(pass1){
int area=(maxx1-minx1)*(maxy1-miny1);
cout<<"Q1: ("<<minx1<<", "<<miny1<<") ("<<maxx1<<", "<<maxy1<<") "<<area<<endl;
}
if(pass2){
int area=(maxx2-minx2)*(maxy2-miny2);
cout<<"Q2: ("<<-maxx2<<", "<<miny2<<") ("<<-minx2<<", "<<maxy2<<") "<<area<<endl;
}
if(pass3){
int area=(maxx3-minx3)*(maxy3-miny3);
cout<<"Q3: ("<<-maxx3<<", "<<-maxy3<<") ("<<-minx3<<", "<<-miny3<<") "<<area<<endl;
}
if(pass4){
int area=(maxx4-minx4)*(maxy4-miny4);
cout<<"Q4: ("<<minx4<<", "<<-maxy4<<") ("<<maxx4<<", "<<-miny4<<") "<<area<<endl;
}
if(!(pass1||pass2||pass3||pass4)){
cout<<"No point in any quadrant";
}
} |
# 2069431, 2024-11-02 10:46:09, PPP--P---- (40%)
#include <bits/stdc++.h>
using namespace std;
void findMax(vector<pair<int, int>> &q, int c)
{
set<int> x;
set<int> y;
for (auto a : q)
{
x.insert(a.first);
y.insert(a.second);
}
int minx = *(x.begin());
int maxx = *(--x.end());
int miny = *(y.begin());
int maxy = *(--y.end());
int l = maxx - minx;
int h = maxy - miny;
cout << "Q" << c << ": "
<< "(" << minx << ", " << miny << ")"
<< " "
<< "(" << maxx << ", " << maxy << ")"
<< " " << l * h << endl;
}
int main()
{
int n;
cin >> n;
vector<pair<int, int>> q1;
vector<pair<int, int>> q2;
vector<pair<int, int>> q3;
vector<pair<int, int>> q4;
for (int i = 0; i < n; i++)
{
int x, y;
cin >> x >> y;
if (x > 0 && y > 0)
{
q1.push_back({x, y});
}
else if (x < 0 && y > 0)
{
q2.push_back({x, y});
}
else if (x < 0 && y < 0)
{
q3.push_back({x, y});
}
else if (x > 0 && y < 0)
{
q4.push_back({x, y});
}
}
if (!q1.empty())
{
findMax(q1, 1);
}
if (!q2.empty())
{
findMax(q2, 2);
}
if (!q3.empty())
{
findMax(q2, 3);
}
if (!q4.empty())
{
findMax(q2, 4);
}
///
if (q1.empty() && q2.empty() && q3.empty() && q4.empty())
{
cout << "No point in any quadrant";
}
} | # 2069441, 2024-11-02 10:47:05, PPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std;
void findMax(vector<pair<int, int>> &q, int c)
{
set<int> x;
set<int> y;
for (auto a : q)
{
x.insert(a.first);
y.insert(a.second);
}
int minx = *(x.begin());
int maxx = *(--x.end());
int miny = *(y.begin());
int maxy = *(--y.end());
int l = maxx - minx;
int h = maxy - miny;
cout << "Q" << c << ": "
<< "(" << minx << ", " << miny << ")"
<< " "
<< "(" << maxx << ", " << maxy << ")"
<< " " << l * h << endl;
}
int main()
{
int n;
cin >> n;
vector<pair<int, int>> q1;
vector<pair<int, int>> q2;
vector<pair<int, int>> q3;
vector<pair<int, int>> q4;
for (int i = 0; i < n; i++)
{
int x, y;
cin >> x >> y;
if (x > 0 && y > 0)
{
q1.push_back({x, y});
}
else if (x < 0 && y > 0)
{
q2.push_back({x, y});
}
else if (x < 0 && y < 0)
{
q3.push_back({x, y});
}
else if (x > 0 && y < 0)
{
q4.push_back({x, y});
}
}
if (!q1.empty())
{
findMax(q1, 1);
}
if (!q2.empty())
{
findMax(q2, 2);
}
if (!q3.empty())
{
findMax(q3, 3);
}
if (!q4.empty())
{
findMax(q4, 4);
}
///
if (q1.empty() && q2.empty() && q3.empty() && q4.empty())
{
cout << "No point in any quadrant";
}
} |
# 2070931, 2024-11-02 13:35:27, -----P---- (10%)
#include <iostream>
#include <set>
std::set<int> q1x, q1y, q2x, q2y, q3x, q3y, q4x, q4y;
int totalCoordinate, x, y;
bool notEmpty1, notEmpty2, notEmpty3, notEmpty4;
int main()
{
std::cin >> totalCoordinate;
for (int i = 0; i < totalCoordinate; i++)
{
std::cin >> x >> y;
if (x > 0 && y > 0) // Q1
{
q1x.insert(x);
q1y.insert(y);
bool notEmpty1 = true;
}
else if (x < 0 && y > 0) // Q2
{
q2x.insert(x);
q2y.insert(y);
bool notEmpty2 = true;
}
else if (x < 0 && y < 0) // Q3
{
q3x.insert(x);
q3y.insert(y);
bool notEmpty3 = true;
}
else if (x > 0 && y < 0) // Q4
{
q4x.insert(x);
q4y.insert(y);
bool notEmpty4 = true;
}
}
if (!notEmpty1 && !notEmpty2 && !notEmpty3 && !notEmpty4)
{
std::cout << "No point in any quadrant";
return 0;
}
if (notEmpty1)
{
std::cout << "Q1: ";
std::cout << "(" << *q1x.begin() << ", " << *q1y.begin() << ") (" << *q1x.rbegin() << ", " << *q1y.rbegin() << ") ";
std::cout << (*q1x.rbegin() - *q1x.begin()) * (*q1y.rbegin() - *q1y.begin());
std::cout << "\n";
}
if (notEmpty2)
{
std::cout << "Q2: ";
std::cout << "(" << *q2x.begin() << ", " << *q2y.begin() << ") (" << *q2x.rbegin() << ", " << *q2y.rbegin() << ") ";
std::cout << (*q2x.rbegin() - *q2x.begin()) * (*q2y.rbegin() - *q2y.begin());
std::cout << "\n";
}
if (notEmpty3)
{
std::cout << "Q3: ";
std::cout << "(" << *q3x.begin() << ", " << *q3y.begin() << ") (" << *q3x.rbegin() << ", " << *q3y.rbegin() << ") ";
std::cout << (*q3x.rbegin() - *q3x.begin()) * (*q3y.rbegin() - *q3y.begin());
std::cout << "\n";
}
if (notEmpty4)
{
std::cout << "Q4: ";
std::cout << "(" << *q4x.begin() << ", " << *q4y.begin() << ") (" << *q4x.rbegin() << ", " << *q4y.rbegin() << ") ";
std::cout << (*q4x.rbegin() - *q4x.begin()) * (*q4y.rbegin() - *q4y.begin());
std::cout << "\n";
}
} | # 2070983, 2024-11-02 13:41:00, PPPPPPPPPP (100%)
#include <iostream>
#include <set>
std::set<int> q1x, q1y, q2x, q2y, q3x, q3y, q4x, q4y;
int totalCoordinate, x, y;
bool notEmpty1, notEmpty2, notEmpty3, notEmpty4;
int main()
{
std::cin >> totalCoordinate;
for (int i = 0; i < totalCoordinate; i++)
{
std::cin >> x >> y;
if (x > 0 && y > 0) // Q1
{
q1x.insert(x);
q1y.insert(y);
notEmpty1 = true;
}
else if (x < 0 && y > 0) // Q2
{
q2x.insert(x);
q2y.insert(y);
notEmpty2 = true;
}
else if (x < 0 && y < 0) // Q3
{
q3x.insert(x);
q3y.insert(y);
notEmpty3 = true;
}
else if (x > 0 && y < 0) // Q4
{
q4x.insert(x);
q4y.insert(y);
notEmpty4 = true;
}
}
if (!notEmpty1 && !notEmpty2 && !notEmpty3 && !notEmpty4)
{
std::cout << "No point in any quadrant";
return 0;
}
if (notEmpty1)
{
std::cout << "Q1: ";
std::cout << "(" << *q1x.begin() << ", " << *q1y.begin() << ") (" << *q1x.rbegin() << ", " << *q1y.rbegin() << ") ";
std::cout << (*q1x.rbegin() - *q1x.begin()) * (*q1y.rbegin() - *q1y.begin());
std::cout << "\n";
}
if (notEmpty2)
{
std::cout << "Q2: ";
std::cout << "(" << *q2x.begin() << ", " << *q2y.begin() << ") (" << *q2x.rbegin() << ", " << *q2y.rbegin() << ") ";
std::cout << (*q2x.rbegin() - *q2x.begin()) * (*q2y.rbegin() - *q2y.begin());
std::cout << "\n";
}
if (notEmpty3)
{
std::cout << "Q3: ";
std::cout << "(" << *q3x.begin() << ", " << *q3y.begin() << ") (" << *q3x.rbegin() << ", " << *q3y.rbegin() << ") ";
std::cout << (*q3x.rbegin() - *q3x.begin()) * (*q3y.rbegin() - *q3y.begin());
std::cout << "\n";
}
if (notEmpty4)
{
std::cout << "Q4: ";
std::cout << "(" << *q4x.begin() << ", " << *q4y.begin() << ") (" << *q4x.rbegin() << ", " << *q4y.rbegin() << ") ";
std::cout << (*q4x.rbegin() - *q4x.begin()) * (*q4y.rbegin() - *q4y.begin());
std::cout << "\n";
}
} |
# 2071464, 2024-11-02 14:38:04, ---------- (0%)
#include<bits/stdc++.h>
using namespace std;
int main() {
int n, x, y; cin >> n;
int xmax[4], ymax[4], xmin[4], ymin[4];
for(int i = 0; i < 4; i++) {
xmax[i] = 0;
ymax[i] = 0;
xmin[i] = 0;
ymin[i] = 0;
}
for(int i = 0; i < n; i++) {
cin >> x >> y;
if(x != 0 && y != 0) {
if(x > 0 && y > 0) {
if(xmax[0] == 0) xmax[0] = x;
if(ymax[0] == 0) ymax[0] = y;
if(xmin[0] == 0) xmin[0] = x;
if(ymin[0] == 0) ymin[0] = y;
if(x > xmax[0]) xmax[0] = x;
if(x < xmin[0]) xmin[0] = x;
if(y > ymax[0]) ymax[0] = y;
if(y < ymin[0]) ymin[0] = y;
} else if(x < 0 && y > 0) {
if(xmax[1] == 0) xmax[1] = x;
if(ymax[1] == 0) ymax[1] = y;
if(xmin[1] == 0) xmin[1] = x;
if(ymin[1] == 0) ymin[1] = y;
if(x > xmax[1]) xmax[1] = x;
if(x < xmin[1]) xmin[1] = x;
if(y > ymax[1]) ymax[1] = y;
if(y < ymin[1]) ymin[1] = y;
} else if( x < 0 && y < 0) {
if(xmax[2] == 0) xmax[2] = x;
if(ymax[2] == 0) ymax[2] = y;
if(xmin[2] == 0) xmin[2] = x;
if(ymin[2] == 0) ymin[2] = y;
if(x > xmax[2]) xmax[2] = x;
if(x < xmin[2]) xmin[2] = x;
if(y > ymax[2]) ymax[2] = y;
if(y < ymin[2]) ymin[2] = y;
} else if (x < 0 && y < 0) {
if(xmax[3] == 0) xmax[3] = x;
if(ymax[3] == 0) ymax[3] = y;
if(xmin[3] == 0) xmin[3] = x;
if(ymin[3] == 0) ymin[3] = y;
if(x > xmax[3]) xmax[3] = x;
if(x < xmin[3]) xmin[3] = x;
if(y > ymax[3]) ymax[3] = y;
if(y < ymin[3]) ymin[3] = y;
}
}
}
int area[4], w[4], l[4];
for(int i = 0; i < 4; i++) {
w[i] = ymax[i]-ymin[i];
l[i] = xmax[i] - xmin[i];
area[i] = w[i]*l[i];
cout << 'Q' << i << ": (" << xmin[i] << ", " << ymin[i] << ") (" << xmax[i] << ", " << ymax[i] << ") " << area[i] << endl;
}
} | # 2071504, 2024-11-02 14:42:55, PPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
int main() {
int n, x, y; cin >> n;
int xmax[4], ymax[4], xmin[4], ymin[4];
for(int i = 0; i < 4; i++) {
xmax[i] = 0;
ymax[i] = 0;
xmin[i] = 0;
ymin[i] = 0;
}
for(int i = 0; i < n; i++) {
cin >> x >> y;
if(x != 0 && y != 0) {
if(x > 0 && y > 0) {
if(xmax[0] == 0) xmax[0] = x;
if(ymax[0] == 0) ymax[0] = y;
if(xmin[0] == 0) xmin[0] = x;
if(ymin[0] == 0) ymin[0] = y;
if(x > xmax[0]) xmax[0] = x;
if(x < xmin[0]) xmin[0] = x;
if(y > ymax[0]) ymax[0] = y;
if(y < ymin[0]) ymin[0] = y;
} else if(x < 0 && y > 0) {
if(xmax[1] == 0) xmax[1] = x;
if(ymax[1] == 0) ymax[1] = y;
if(xmin[1] == 0) xmin[1] = x;
if(ymin[1] == 0) ymin[1] = y;
if(x > xmax[1]) xmax[1] = x;
if(x < xmin[1]) xmin[1] = x;
if(y > ymax[1]) ymax[1] = y;
if(y < ymin[1]) ymin[1] = y;
} else if( x < 0 && y < 0) {
if(xmax[2] == 0) xmax[2] = x;
if(ymax[2] == 0) ymax[2] = y;
if(xmin[2] == 0) xmin[2] = x;
if(ymin[2] == 0) ymin[2] = y;
if(x > xmax[2]) xmax[2] = x;
if(x < xmin[2]) xmin[2] = x;
if(y > ymax[2]) ymax[2] = y;
if(y < ymin[2]) ymin[2] = y;
} else if (x > 0 && y < 0) {
if(xmax[3] == 0) xmax[3] = x;
if(ymax[3] == 0) ymax[3] = y;
if(xmin[3] == 0) xmin[3] = x;
if(ymin[3] == 0) ymin[3] = y;
if(x > xmax[3]) xmax[3] = x;
if(x < xmin[3]) xmin[3] = x;
if(y > ymax[3]) ymax[3] = y;
if(y < ymin[3]) ymin[3] = y;
}
}
}
int count = 0;
int area[4], w[4], l[4];
for(int i = 0; i < 4; i++) {
if(xmax[i] == 0) continue;
count++;
w[i] = ymax[i]-ymin[i];
l[i] = xmax[i] - xmin[i];
area[i] = w[i]*l[i];
cout << 'Q' << i+1 << ": (" << xmin[i] << ", " << ymin[i] << ") (" << xmax[i] << ", " << ymax[i] << ") " << area[i] << endl;
}
if(count == 0) cout << "No point in any quadrant";
} |
# 2070775, 2024-11-02 13:15:54, -----P---- (10%)
#include<iostream>
#include<string>
#include<math.h>
using namespace std;
int main(){
int n,x,y;
int x_max[4] ={0,0,0,0};
int y_max[4] ={0,0,0,0};
int x_min[4] ={0,0,0,0};
int y_min[4] ={0,0,0,0};
int count[4] ={0,0,0,0};
cin>>n;
for(int i=0;i<n;i++){
cin>>x>>y;
//Q1
if(x>0 && y>0){
if(count[0]==0){
x_max[0]=x;
y_max[0]=y;
x_min[0]=x;
y_min[0]=y;
}
else{
if(x>x_max[0]){
x_max[0]=x;
}
if(y>y_max[0]){
y_max[0]=y;
}
if(x<x_min[0]){
x_min[0]=x;
}
if(y<y_min[0]){
y_min[0]=y;
}
}
count[0]++;
}
//Q2
if(x<0 && y>0){
if(count[1]==0){
x_max[1]=x;
y_max[1]=y;
x_min[1]=x;
y_min[1]=y;
}
else{
if(x>x_max[1]){
x_max[1]=x;
}
if(y>y_max[1]){
y_max[1]=y;
}
if(x<x_min[1]){
x_min[1]=x;
}
if(y<y_min[1]){
y_min[1]=y;
}
}
count[1]++;
}
//Q3
if(x<0 && y<0){
if(count[2]==0){
x_max[2]=x;
y_max[2]=y;
x_min[2]=x;
y_min[2]=y;
}
else{
if(x>x_max[2]){
x_max[2]=x;
}
if(y>y_max[2]){
y_max[2]=y;
}
if(x<x_min[2]){
x_min[2]=x;
}
if(y<y_min[2]){
y_min[2]=y;
}
}
count[2]++;
}
//Q4
if(x>0 && y<0){
if(count[3]==0){
x_max[3]=x;
y_max[3]=y;
x_min[3]=x;
y_min[3]=y;
}
else{
if(x>x_max[3]){
x_max[3]=x;
}
if(y>y_max[3]){
y_max[3]=y;
}
if(x<x_min[3]){
x_min[3]=x;
}
if(y<y_min[3]){
y_min[3]=y;
}
}
count[3]++;
}
}
int check =0;
for(int i=0;i<4;i++){
if(count[i]!=0){
cout<<"Q"<<i+1<<" ("<<x_min[i]<<", "<<y_min[i]<<") ("<<x_max[i]<<", "<<y_max[i]<<") ";
cout<<(x_max[i]-x_min[i])*(y_max[i]-y_min[i])<<endl;
check++;
}
}
if(check==0){
cout<<"No point in any quadrant";
}
} | # 2070792, 2024-11-02 13:16:52, PPPPPPPPPP (100%)
#include<iostream>
#include<string>
#include<math.h>
using namespace std;
int main(){
int n,x,y;
int x_max[4] ={0,0,0,0};
int y_max[4] ={0,0,0,0};
int x_min[4] ={0,0,0,0};
int y_min[4] ={0,0,0,0};
int count[4] ={0,0,0,0};
cin>>n;
for(int i=0;i<n;i++){
cin>>x>>y;
//Q1
if(x>0 && y>0){
if(count[0]==0){
x_max[0]=x;
y_max[0]=y;
x_min[0]=x;
y_min[0]=y;
}
else{
if(x>x_max[0]){
x_max[0]=x;
}
if(y>y_max[0]){
y_max[0]=y;
}
if(x<x_min[0]){
x_min[0]=x;
}
if(y<y_min[0]){
y_min[0]=y;
}
}
count[0]++;
}
//Q2
if(x<0 && y>0){
if(count[1]==0){
x_max[1]=x;
y_max[1]=y;
x_min[1]=x;
y_min[1]=y;
}
else{
if(x>x_max[1]){
x_max[1]=x;
}
if(y>y_max[1]){
y_max[1]=y;
}
if(x<x_min[1]){
x_min[1]=x;
}
if(y<y_min[1]){
y_min[1]=y;
}
}
count[1]++;
}
//Q3
if(x<0 && y<0){
if(count[2]==0){
x_max[2]=x;
y_max[2]=y;
x_min[2]=x;
y_min[2]=y;
}
else{
if(x>x_max[2]){
x_max[2]=x;
}
if(y>y_max[2]){
y_max[2]=y;
}
if(x<x_min[2]){
x_min[2]=x;
}
if(y<y_min[2]){
y_min[2]=y;
}
}
count[2]++;
}
//Q4
if(x>0 && y<0){
if(count[3]==0){
x_max[3]=x;
y_max[3]=y;
x_min[3]=x;
y_min[3]=y;
}
else{
if(x>x_max[3]){
x_max[3]=x;
}
if(y>y_max[3]){
y_max[3]=y;
}
if(x<x_min[3]){
x_min[3]=x;
}
if(y<y_min[3]){
y_min[3]=y;
}
}
count[3]++;
}
}
int check =0;
for(int i=0;i<4;i++){
if(count[i]!=0){
cout<<"Q"<<i+1<<": ("<<x_min[i]<<", "<<y_min[i]<<") ("<<x_max[i]<<", "<<y_max[i]<<") ";
cout<<(x_max[i]-x_min[i])*(y_max[i]-y_min[i])<<endl;
check++;
}
}
if(check==0){
cout<<"No point in any quadrant";
}
} |
# 2069104, 2024-11-02 10:12:28, -----P---- (10%)
#include<iostream>
#include<utility>
#include<vector>
#include<set>
#include<map>
#include<cmath>
#include<iomanip>
using namespace std;
int main(){
int n;cin>>n;
set<int>q1_x;
set<int>q1_y;
set<int>q2_x;
set<int>q2_y;
set<int>q3_x;
set<int>q3_y;
set<int>q4_x;
set<int>q4_y;
int box1,box2;
while(n--){
cin >> box1 >> box2;
if(box1 != 0 && box2 != 0){
//q1
if(box1>0&&box2>0){
q1_x.insert(box1);
q1_y.insert(box2);
}
//q2
else if(box1<0&&box2>0){
q2_x.insert(box1);
q2_y.insert(box2);
}
//q3
else if(box1<0&&box2<0){
q3_x.insert(box1);
q3_y.insert(box2);
}
//q4
else if(box1>0&&box2<0){
q4_x.insert(box1);
q4_y.insert(box2);
}
}
}
vector<pair<int,int>>Q1,Q2,Q3,Q4;
int pt1=0,pt2=0,pt3=0,pt4=0;
//q1
if(!q1_x.empty()&&!q1_y.empty()){
auto x_1_min = q1_x.begin();
auto y_1_min = q1_y.begin();
Q1.push_back({*(x_1_min),*(y_1_min)});
auto x_1_max = q1_x.end()--;
auto y_1_max = q1_y.end()--;
Q1.push_back({*(x_1_max),*(y_1_max)});
pt1 = (*(y_1_max)-*(y_1_min))*(*(x_1_max)-*(x_1_min));
}
//q2
if(!q2_x.empty()&&!q2_y.empty()){
auto x_2_min = q2_x.begin();
auto y_2_min = q2_y.begin();
Q2.push_back({*(x_2_min),*(y_2_min)});
auto x_2_max = q2_x.end()--;
auto y_2_max = q2_y.end()--;
Q2.push_back({*(x_2_max),*(y_2_max)});
pt2 = (*(y_2_max)-*(y_2_min))*(*(x_2_max)-*(x_2_min));
}
//q3
if(!q3_x.empty()&&!q3_y.empty()){
auto x_3_min = q3_x.begin();
auto y_3_min = q3_y.begin();
Q3.push_back({*(x_3_min),*(y_3_min)});
auto x_3_max = q3_x.end()--;
auto y_3_max = q3_y.end()--;
Q3.push_back({*(x_3_max),*(y_3_max)});
pt3 = (*(y_3_max)-*(y_3_min))*(*(x_3_max)-*(x_3_min));
}
//q4
if(!q4_x.empty()&&!q4_y.empty()){
auto x_4_min = q4_x.begin();
auto y_4_min = q4_y.begin();
Q4.push_back({*(x_4_min),*(y_4_min)});
auto x_4_max = q4_x.end()--;
auto y_4_max = q4_y.end()--;
Q4.push_back({*(x_4_max),*(y_4_max)});
pt4 = (*(y_4_max)-*(y_4_min))*(*(x_4_max)-*(x_4_min));
}
//out
if(Q1.empty()&&Q2.empty()&&Q3.empty()&&Q4.empty()) cout <<"No point in any quadrant"<<endl;
else{
if(!Q1.empty()){
cout <<"Q1: ";
for(auto v:Q1){
cout<<"("<<v.first<<", "<<v.second<<") ";
}
cout<<pt1<<endl;
}
if(!Q2.empty()){
cout <<"Q2: ";
for(auto v:Q2){
cout<<"("<<v.first<<", "<<v.second<<") ";
}
cout<<pt2<<endl;
}
if(!Q3.empty()){
cout <<"Q3: ";
for(auto v:Q3){
cout<<"("<<v.first<<", "<<v.second<<") ";
}
cout<<pt3<<endl;
}
if(!Q4.empty()){
cout <<"Q4: ";
for(auto v:Q4){
cout<<"("<<v.first<<", "<<v.second<<") ";
}
cout<<pt4<<endl;
}
}
} | # 2069226, 2024-11-02 10:28:08, PPPPPPPPPP (100%)
#include<iostream>
#include<utility>
#include<vector>
#include<set>
#include<map>
#include<cmath>
#include<iomanip>
using namespace std;
int main(){
int n;cin>>n;
set<int>q1_x;
set<int>q1_y;
set<int>q2_x;
set<int>q2_y;
set<int>q3_x;
set<int>q3_y;
set<int>q4_x;
set<int>q4_y;
int box1,box2;
while(n--){
cin >> box1 >> box2;
if(box1 != 0 && box2 != 0){
//q1
if(box1>0&&box2>0){
q1_x.insert(box1);
q1_y.insert(box2);
}
//q2
else if(box1<0&&box2>0){
q2_x.insert(box1);
q2_y.insert(box2);
}
//q3
else if(box1<0&&box2<0){
q3_x.insert(box1);
q3_y.insert(box2);
}
//q4
else if(box1>0&&box2<0){
q4_x.insert(box1);
q4_y.insert(box2);
}
}
}
vector<pair<int,int>>Q1,Q2,Q3,Q4;
int pt1=0,pt2=0,pt3=0,pt4=0;
//q1
if(!q1_x.empty()&&!q1_y.empty()){
auto x_1_min = q1_x.begin();
auto y_1_min = q1_y.begin();
Q1.push_back({*(x_1_min),*(y_1_min)});
auto x_1_max = q1_x.end();
auto y_1_max = q1_y.end();
x_1_max--;
y_1_max--;
Q1.push_back({*(x_1_max),*(y_1_max)});
pt1 = abs(*(y_1_max)-*(y_1_min))*(*(x_1_max)-*(x_1_min));
}
//q2
if(!q2_x.empty()&&!q2_y.empty()){
auto x_2_min = q2_x.begin();
auto y_2_min = q2_y.begin();
Q2.push_back({*(x_2_min),*(y_2_min)});
auto x_2_max = q2_x.end();
auto y_2_max = q2_y.end();
x_2_max--;
y_2_max--;
Q2.push_back({*(x_2_max),*(y_2_max)});
pt2 = abs(*(y_2_max)-*(y_2_min))*(*(x_2_max)-*(x_2_min));
}
//q3
if(!q3_x.empty()&&!q3_y.empty()){
auto x_3_min = q3_x.begin();
auto y_3_min = q3_y.begin();
Q3.push_back({*(x_3_min),*(y_3_min)});
auto x_3_max = q3_x.end();
auto y_3_max = q3_y.end();
x_3_max--;
y_3_max--;
Q3.push_back({*(x_3_max),*(y_3_max)});
pt3 = abs(*(y_3_max)-*(y_3_min))*(*(x_3_max)-*(x_3_min));
}
//q4
if(!q4_x.empty()&&!q4_y.empty()){
auto x_4_min = q4_x.begin();
auto y_4_min = q4_y.begin();
Q4.push_back({*(x_4_min),*(y_4_min)});
auto x_4_max = q4_x.end();
auto y_4_max = q4_y.end();
x_4_max--;
y_4_max--;
Q4.push_back({*(x_4_max),*(y_4_max)});
pt4 = abs(*(y_4_max)-*(y_4_min))*(*(x_4_max)-*(x_4_min));
}
//out
if(Q1.empty()&&Q2.empty()&&Q3.empty()&&Q4.empty()) cout <<"No point in any quadrant"<<endl;
else{
if(!Q1.empty()){
cout <<"Q1: ";
for(auto v:Q1){
cout<<"("<<v.first<<", "<<v.second<<") ";
}
cout<<pt1<<endl;
}
if(!Q2.empty()){
cout <<"Q2: ";
for(auto v:Q2){
cout<<"("<<v.first<<", "<<v.second<<") ";
}
cout<<pt2<<endl;
}
if(!Q3.empty()){
cout <<"Q3: ";
for(auto v:Q3){
cout<<"("<<v.first<<", "<<v.second<<") ";
}
cout<<pt3<<endl;
}
if(!Q4.empty()){
cout <<"Q4: ";
for(auto v:Q4){
cout<<"("<<v.first<<", "<<v.second<<") ";
}
cout<<pt4<<endl;
}
}
} |
# 2071041, 2024-11-02 13:48:21, xxxxPPPPxP (50%)
#include <iostream>
#include <set>
using namespace std;
int main() {
int n;
cin >> n;
set<int>q1x,q1y,q2x,q2y,q3x,q3y,q4x,q4y;
int count = 0;
for (int i = 0; i < n; i++) {
int x,y;
cin >> x >> y;
if (x == 0 || y == 0) continue;
count ++;
if (x > 0) {
if (y > 0) {
q1x.insert(x);
q1y.insert(y);
}
else if (y < 0) {
q4x.insert(x);
q4y.insert(y);
}
}
else if (x < 0) {
if (y > 0) {
q2x.insert(x);
q2y.insert(y);
}
else if (y < 0) {
q3x.insert(x);
q3y.insert(y);
}
}
}
if (count == 0) {
cout << "No point in any quadrant";
return 0;
}
auto x1 = q1x.end(), y1 = q1y.end(), x2 = q2x.end(), y2 = q2y.end(), x3 = q3x.end(), y3 = q3y.end(), x4 = q4x.end(), y4 = q4y.end();
x1--;
y1--;
x2--;
y2--;
x3--;
y3--;
x4--;
y4--;
int q1a, q2a, q3a, q4a;
q1a = ((*x1 - *(q1x.begin())) * (*y1 - *(q1y.begin())));
q2a = ((*x2 - *(q2x.begin())) * (*y2 - *(q2y.begin())));
q3a = ((*x3 - *(q3x.begin())) * (*y3 - *(q3y.begin())));
q4a = ((*x4 - *(q4x.begin())) * (*y4 - *(q4y.begin())));
if (!q1x.empty()) cout << "Q1: (" << *q1x.begin() << ", " << *q1y.begin() << ") (" << *x1 << ", " << *y1 << ") " << q1a << endl;
if (!q2x.empty()) cout << "Q2: (" << *q2x.begin() << ", " << *q2y.begin() << ") (" << *x2 << ", " << *y2 << ") " << q2a << endl;
if (!q3x.empty()) cout << "Q3: (" << *q3x.begin() << ", " << *q3y.begin() << ") (" << *x3 << ", " << *y3 << ") " << q3a << endl;
if (!q4x.empty()) cout << "Q4: (" << *q4x.begin() << ", " << *q4y.begin() << ") (" << *x4 << ", " << *y4 << ") " << q4a << endl;
} | # 2071091, 2024-11-02 13:54:33, PPPPPPPPPP (100%)
#include <iostream>
#include <algorithm>
#include <set>
using namespace std;
int main() {
int n;
cin >> n;
set<int>q1x,q1y,q2x,q2y,q3x,q3y,q4x,q4y;
int count = 0;
for (int i = 0; i < n; i++) {
int x,y;
cin >> x >> y;
if (x == 0 || y == 0) continue;
count ++;
if (x > 0) {
if (y > 0) {
q1x.insert(x);
q1y.insert(y);
}
else if (y < 0) {
q4x.insert(x);
q4y.insert(y);
}
}
else if (x < 0) {
if (y > 0) {
q2x.insert(x);
q2y.insert(y);
}
else if (y < 0) {
q3x.insert(x);
q3y.insert(y);
}
}
}
if (count == 0) {
cout << "No point in any quadrant";
return 0;
}
auto x1 = max_element(q1x.begin(),q1x.end());
auto y1 = max_element(q1y.begin(),q1y.end());
auto x2 = max_element(q2x.begin(),q2x.end());
auto y2 = max_element(q2y.begin(),q2y.end());
auto x3 = max_element(q3x.begin(),q3x.end());
auto y3 = max_element(q3y.begin(),q3y.end());
auto x4 = max_element(q4x.begin(),q4x.end());
auto y4 = max_element(q4y.begin(),q4y.end());
int q1a, q2a, q3a, q4a;
q1a = ((*x1 - *(q1x.begin())) * (*y1 - *(q1y.begin())));
q2a = ((*x2 - *(q2x.begin())) * (*y2 - *(q2y.begin())));
q3a = ((*x3 - *(q3x.begin())) * (*y3 - *(q3y.begin())));
q4a = ((*x4 - *(q4x.begin())) * (*y4 - *(q4y.begin())));
if (!q1x.empty()) cout << "Q1: (" << *q1x.begin() << ", " << *q1y.begin() << ") (" << *x1 << ", " << *y1 << ") " << q1a << endl;
if (!q2x.empty()) cout << "Q2: (" << *q2x.begin() << ", " << *q2y.begin() << ") (" << *x2 << ", " << *y2 << ") " << q2a << endl;
if (!q3x.empty()) cout << "Q3: (" << *q3x.begin() << ", " << *q3y.begin() << ") (" << *x3 << ", " << *y3 << ") " << q3a << endl;
if (!q4x.empty()) cout << "Q4: (" << *q4x.begin() << ", " << *q4y.begin() << ") (" << *x4 << ", " << *y4 << ") " << q4a << endl;
} |
# 2071064, 2024-11-02 13:50:10, P----P---- (20%)
#include<iostream>
#include<cmath>
int ar(int x1,int y1,int x2,int y2)
{
int x =abs(x1-x2);
int y = abs(y1-y2);
return x*y;
}
int main(){
int g;
std::cin>>g;
int x=0,y=0, o[16],ch1=0,ch2=0,ch3=0,ch4=0;
for(int i=0;i<g;i++)
{
std::cin>>x>>y;
if(x!=0&&y!=0)
{
if(x>0&&y>0)
{
if(ch1==0)
{
o[0]=x;
o[2]=x;
o[1]=y;
o[3]=y;
ch1++;
}
else
{
if(x>o[2])o[2]=x;
if(x<o[0])o[0]=x;
if(y>o[3])o[3]=y;
if(y<o[1])o[1]=y;
}
}
if(x<0&&y>0)
{
if(ch2==0)
{
o[4]=x;
o[6]=x;
o[5]=y;
o[7]=y;
ch2++;
}
else
{
if(x>o[6])o[6]=x;
if(x<o[4])o[4]=x;
if(y>o[7])o[7]=y;
if(y<o[5])o[5]=y;
}
}
if(x<0&&y<0)
{
if(ch3==0)
{
o[8]=x;
o[10]=x;
o[9]=y;
o[11]=y;
ch3++;
}
else
{
if(x>o[10])o[10]=x;
if(x<o[8])o[8]=x;
if(y>o[11])o[11]=y;
if(y<o[9])o[9]=y;
}
}
if(x>0&&y<0)
{
if(ch4==0)
{
o[12]=x;
o[14]=x;
o[13]=y;
o[15]=y;
ch4++;
}
else
{
if(x>o[14])o[14]=x;
if(x<o[12])o[12]=x;
if(y>o[15])o[15]=y;
if(y<o[13])o[13]=y;
}
}
}
}
if(ch1!=0){
std::cout<<"Q1: ("<<o[0]<<", "<<o[1]<<") ("<<o[2]<<", "<<o[3]<<") "<<ar(o[0],o[1],o[2],o[3])<<"\n";
}
if(ch2!=0){
std::cout<<"Q1: ("<<o[4]<<", "<<o[5]<<") ("<<o[6]<<", "<<o[7]<<") "<<ar(o[4],o[5],o[6],o[7])<<"\n";
}
if(ch3!=0){
std::cout<<"Q1: ("<<o[8]<<", "<<o[9]<<") ("<<o[10]<<", "<<o[11]<<") "<<ar(o[8],o[9],o[10],o[11])<<"\n";
}
if(ch4!=0){
std::cout<<"Q1: ("<<o[12]<<", "<<o[13]<<") ("<<o[14]<<", "<<o[15]<<") "<<ar(o[12],o[13],o[14],o[15]);
}
if(ch1==0&&ch2==0&&ch3==0&&ch4==0)std::cout<<"No point in any quadrant";
} | # 2071079, 2024-11-02 13:52:30, PPPPPPPPPP (100%)
#include<iostream>
#include<cmath>
int ar(int x1,int y1,int x2,int y2)
{
int x =abs(x1-x2);
int y = abs(y1-y2);
return x*y;
}
int main(){
int g;
std::cin>>g;
int x=0,y=0, o[16],ch1=0,ch2=0,ch3=0,ch4=0;
for(int i=0;i<g;i++)
{
std::cin>>x>>y;
if(x!=0&&y!=0)
{
if(x>0&&y>0)
{
if(ch1==0)
{
o[0]=x;
o[2]=x;
o[1]=y;
o[3]=y;
ch1++;
}
else
{
if(x>o[2])o[2]=x;
if(x<o[0])o[0]=x;
if(y>o[3])o[3]=y;
if(y<o[1])o[1]=y;
}
}
if(x<0&&y>0)
{
if(ch2==0)
{
o[4]=x;
o[6]=x;
o[5]=y;
o[7]=y;
ch2++;
}
else
{
if(x>o[6])o[6]=x;
if(x<o[4])o[4]=x;
if(y>o[7])o[7]=y;
if(y<o[5])o[5]=y;
}
}
if(x<0&&y<0)
{
if(ch3==0)
{
o[8]=x;
o[10]=x;
o[9]=y;
o[11]=y;
ch3++;
}
else
{
if(x>o[10])o[10]=x;
if(x<o[8])o[8]=x;
if(y>o[11])o[11]=y;
if(y<o[9])o[9]=y;
}
}
if(x>0&&y<0)
{
if(ch4==0)
{
o[12]=x;
o[14]=x;
o[13]=y;
o[15]=y;
ch4++;
}
else
{
if(x>o[14])o[14]=x;
if(x<o[12])o[12]=x;
if(y>o[15])o[15]=y;
if(y<o[13])o[13]=y;
}
}
}
}
if(ch1!=0){
std::cout<<"Q1: ("<<o[0]<<", "<<o[1]<<") ("<<o[2]<<", "<<o[3]<<") "<<ar(o[0],o[1],o[2],o[3])<<"\n";
}
if(ch2!=0){
std::cout<<"Q2: ("<<o[4]<<", "<<o[5]<<") ("<<o[6]<<", "<<o[7]<<") "<<ar(o[4],o[5],o[6],o[7])<<"\n";
}
if(ch3!=0){
std::cout<<"Q3: ("<<o[8]<<", "<<o[9]<<") ("<<o[10]<<", "<<o[11]<<") "<<ar(o[8],o[9],o[10],o[11])<<"\n";
}
if(ch4!=0){
std::cout<<"Q4: ("<<o[12]<<", "<<o[13]<<") ("<<o[14]<<", "<<o[15]<<") "<<ar(o[12],o[13],o[14],o[15]);
}
if(ch1==0&&ch2==0&&ch3==0&&ch4==0)std::cout<<"No point in any quadrant";
} |
# 2069554, 2024-11-02 10:58:07, PPPPP-PPPP (90%)
#include <iostream>
#include <utility>
using namespace std;
int main() {
pair<int, int> q[4][2];
int n;
cin>>n;
int x,y;
bool check[4] = {false,false,false,false};
int xl[4],xu[4],yl[4],yu[4];
for (int i=0 ; i<n ; i++) {
cin>>x>>y;
if (x==0 || y==0) continue;
if (x>0 && y>0) { // q1
if (check[0]) {
xl[0] = min(x,xl[0]);
xu[0] = max(x,xu[0]);
yl[0] = min(y,yl[0]);
yu[0] = max(y,yu[0]);
q[0][0] = {xl[0],yl[0]};
q[0][1] = {xu[0],yu[0]};
} else {
q[0][0] = {x,y};
q[0][1] = {x,y};
check[0] = true;
xl[0] = x;
xu[0] = x;
yl[0] = y;
yu[0] = y;
}
}
else if (x<0 && y>0) { // q2
if (check[1]) {
xl[1] = min(x,xl[1]);
xu[1] = max(x,xu[1]);
yl[1] = min(y,yl[1]);
yu[1] = max(y,yu[1]);
q[1][0] = {xl[1],yl[1]};
q[1][1] = {xu[1],yu[1]};
} else {
q[1][0] = {x,y};
q[1][1] = {x,y};
check[1] = true;
xl[1] = x;
xu[1] = x;
yl[1] = y;
yu[1] = y;
}
}
else if (x<0 && y<0) { // q3
if (check[2]) {
xl[2] = min(x,xl[2]);
xu[2] = max(x,xu[2]);
yl[2] = min(y,yl[2]);
yu[2] = max(y,yu[2]);
q[2][0] = {xl[2],yl[2]};
q[2][1] = {xu[2],yu[2]};
} else {
q[2][0] = {x,y};
q[2][1] = {x,y};
check[2] = true;
xl[2] = x;
xu[2] = x;
yl[2] = y;
yu[2] = y;
}
}
else if (x>0 && y<0) { //q4
if (check[3]) {
xl[3] = min(x,xl[3]);
xu[3] = max(x,xu[3]);
yl[3] = min(y,yl[3]);
yu[3] = max(y,yu[3]);
q[3][0] = {xl[3],yl[3]};
q[3][1] = {xu[3],yu[3]};
} else {
q[3][0] = {x,y};
q[3][1] = {x,y};
check[3] = true;
xl[3] = x;
xu[3] = x;
yl[3] = y;
yu[3] = y;
}
}
}
for (int i=0 ; i<4 ; i++) {
if (!check[i]) continue;
if (i==0) cout<<"Q1: ";
else if (i==1) cout<<"Q2: ";
else if (i==2) cout<<"Q3: ";
else if (i==3) cout<<"Q4: ";
for (int j=0 ; j<2 ; j++) {
cout<<"("<<q[i][j].first<<", "<<q[i][j].second<<") ";
}
cout<<(q[i][1].first-q[i][0].first)* (q[i][1].second-q[i][0].second)<<endl;
}
} | # 2069585, 2024-11-02 11:00:36, PPPPPPPPPP (100%)
#include <iostream>
#include <utility>
using namespace std;
int main() {
pair<int, int> q[4][2];
int n;
cin>>n;
int x,y;
bool check[4] = {false,false,false,false};
int xl[4],xu[4],yl[4],yu[4];
for (int i=0 ; i<n ; i++) {
cin>>x>>y;
if (x==0 || y==0) continue;
if (x>0 && y>0) { // q1
if (check[0]) {
xl[0] = min(x,xl[0]);
xu[0] = max(x,xu[0]);
yl[0] = min(y,yl[0]);
yu[0] = max(y,yu[0]);
q[0][0] = {xl[0],yl[0]};
q[0][1] = {xu[0],yu[0]};
} else {
q[0][0] = {x,y};
q[0][1] = {x,y};
check[0] = true;
xl[0] = x;
xu[0] = x;
yl[0] = y;
yu[0] = y;
}
}
else if (x<0 && y>0) { // q2
if (check[1]) {
xl[1] = min(x,xl[1]);
xu[1] = max(x,xu[1]);
yl[1] = min(y,yl[1]);
yu[1] = max(y,yu[1]);
q[1][0] = {xl[1],yl[1]};
q[1][1] = {xu[1],yu[1]};
} else {
q[1][0] = {x,y};
q[1][1] = {x,y};
check[1] = true;
xl[1] = x;
xu[1] = x;
yl[1] = y;
yu[1] = y;
}
}
else if (x<0 && y<0) { // q3
if (check[2]) {
xl[2] = min(x,xl[2]);
xu[2] = max(x,xu[2]);
yl[2] = min(y,yl[2]);
yu[2] = max(y,yu[2]);
q[2][0] = {xl[2],yl[2]};
q[2][1] = {xu[2],yu[2]};
} else {
q[2][0] = {x,y};
q[2][1] = {x,y};
check[2] = true;
xl[2] = x;
xu[2] = x;
yl[2] = y;
yu[2] = y;
}
}
else if (x>0 && y<0) { //q4
if (check[3]) {
xl[3] = min(x,xl[3]);
xu[3] = max(x,xu[3]);
yl[3] = min(y,yl[3]);
yu[3] = max(y,yu[3]);
q[3][0] = {xl[3],yl[3]};
q[3][1] = {xu[3],yu[3]};
} else {
q[3][0] = {x,y};
q[3][1] = {x,y};
check[3] = true;
xl[3] = x;
xu[3] = x;
yl[3] = y;
yu[3] = y;
}
}
}
if (!check[0] && !check[1] && !check[2] && !check[3]){
cout<<"No point in any quadrant";
} else {
for (int i=0 ; i<4 ; i++) {
if (!check[i]) continue;
if (i==0) cout<<"Q1: ";
else if (i==1) cout<<"Q2: ";
else if (i==2) cout<<"Q3: ";
else if (i==3) cout<<"Q4: ";
for (int j=0 ; j<2 ; j++) {
cout<<"("<<q[i][j].first<<", "<<q[i][j].second<<") ";
}
cout<<(q[i][1].first-q[i][0].first)* (q[i][1].second-q[i][0].second)<<endl;
}
}
} |
# 2070920, 2024-11-02 13:33:16, ---------- (0%)
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n, a, b;
cin >> n;
vector<int> x1, y1, x2, y2, x3, y3, x4, y4;
for (int i = 0; i < n; i++){
cin >> a >> b;
if (a > 0 && b > 0){
x1.push_back(a);
y1.push_back(b);
}
if (a < 0 && b > 0){
x2.push_back(a);
y2.push_back(b);
}
if (a < 0 && b < 0){
x3.push_back(a);
y3.push_back(b);
}
if (a > 0 && b < 0){
x4.push_back(a);
y4.push_back(b);
}
}
bool c = false;
if(x1.size()>=2){
c = true;
auto minx = min_element(x1.begin(),x1.end());
auto miny = min_element(y1.begin(),y1.end());
auto maxx = max_element(x1.begin(),x1.end());
auto maxy = max_element(y1.begin(),y1.end());
int p = (*maxx-*minx)*(*maxy-*miny);
cout << "Q1: (" << *minx << ", " << *miny << ") (" << *maxx << ", " <<*maxy<<") " << p <<endl;
}
if(x1.size()>=2){
c = true;
auto minx = min_element(x1.begin(),x1.end());
auto miny = min_element(y1.begin(),y1.end());
auto maxx = max_element(x1.begin(),x1.end());
auto maxy = max_element(y1.begin(),y1.end());
int p = (*maxx-*minx)*(*maxy-*miny);
cout << "Q1: (" << *minx << ", " << *miny << ") (" << *maxx << ", " <<*maxy<<") " << p <<endl;
}
if(x1.size()>=2){
c = true;
auto minx = min_element(x1.begin(),x1.end());
auto miny = min_element(y1.begin(),y1.end());
auto maxx = max_element(x1.begin(),x1.end());
auto maxy = max_element(y1.begin(),y1.end());
int p = (*maxx-*minx)*(*maxy-*miny);
cout << "Q1: (" << *minx << ", " << *miny << ") (" << *maxx << ", " <<*maxy<<") " << p <<endl;
}
if(x1.size()>=2){
c = true;
auto minx = min_element(x1.begin(),x1.end());
auto miny = min_element(y1.begin(),y1.end());
auto maxx = max_element(x1.begin(),x1.end());
auto maxy = max_element(y1.begin(),y1.end());
int p = (*maxx-*minx)*(*maxy-*miny);
cout << "Q1: (" << *minx << ", " << *miny << ") (" << *maxx << ", " <<*maxy<<") " << p <<endl;
}
} | # 2070949, 2024-11-02 13:37:16, PPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n, a, b;
cin >> n;
vector<int> x1, y1, x2, y2, x3, y3, x4, y4;
for (int i = 0; i < n; i++){
cin >> a >> b;
if (a > 0 && b > 0){
x1.push_back(a);
y1.push_back(b);
}
if (a < 0 && b > 0){
x2.push_back(a);
y2.push_back(b);
}
if (a < 0 && b < 0){
x3.push_back(a);
y3.push_back(b);
}
if (a > 0 && b < 0){
x4.push_back(a);
y4.push_back(b);
}
}
bool c = false;
if(x1.size()!=0){
c = true;
auto minx = min_element(x1.begin(),x1.end());
auto miny = min_element(y1.begin(),y1.end());
auto maxx = max_element(x1.begin(),x1.end());
auto maxy = max_element(y1.begin(),y1.end());
int p = (*maxx-*minx)*(*maxy-*miny);
cout << "Q1: (" << *minx << ", " << *miny << ") (" << *maxx << ", " <<*maxy<<") " << p <<endl;
}
if(x2.size()!=0){
c = true;
auto minx = min_element(x2.begin(),x2.end());
auto miny = min_element(y2.begin(),y2.end());
auto maxx = max_element(x2.begin(),x2.end());
auto maxy = max_element(y2.begin(),y2.end());
int p = (*maxx-*minx)*(*maxy-*miny);
cout << "Q2: (" << *minx << ", " << *miny << ") (" << *maxx << ", " <<*maxy<<") " << p <<endl;
}
if(x3.size()!=0){
c = true;
auto minx = min_element(x3.begin(),x3.end());
auto miny = min_element(y3.begin(),y3.end());
auto maxx = max_element(x3.begin(),x3.end());
auto maxy = max_element(y3.begin(),y3.end());
int p = (*maxx-*minx)*(*maxy-*miny);
cout << "Q3: (" << *minx << ", " << *miny << ") (" << *maxx << ", " <<*maxy<<") " << p <<endl;
}
if(x4.size()!=0){
c = true;
auto minx = min_element(x4.begin(),x4.end());
auto miny = min_element(y4.begin(),y4.end());
auto maxx = max_element(x4.begin(),x4.end());
auto maxy = max_element(y4.begin(),y4.end());
int p = (*maxx-*minx)*(*maxy-*miny);
cout << "Q4: (" << *minx << ", " << *miny << ") (" << *maxx << ", " <<*maxy<<") " << p <<endl;
}
if(!c) cout << "No point in any quadrant";
} |
# 2069263, 2024-11-02 10:32:25, PPPPPPPPPP (100%)
#include <iostream>
#include <set>
#include <vector>
using namespace std;
void setPointValue(pair<pair<int, int>, pair<int, int>> &point, pair<int, int> item);
int main()
{
int n;
cin >> n;
pair<int, int> input;
vector<pair<int, int>> inputs;
for (int i = 0; i < n; i++)
{
cin >> input.first >> input.second;
inputs.push_back(input);
}
set<pair<int, int>> Q1, Q2, Q3, Q4;
for (pair<int, int> coordinate : inputs)
{
if (coordinate.first == 0 || coordinate.second == 0) continue;
else
{
if (coordinate.first > 0 && coordinate.second > 0) Q1.insert(coordinate);
else if (coordinate.first < 0 && coordinate.second > 0) Q2.insert(coordinate);
else if (coordinate.first < 0 && coordinate.second < 0) Q3.insert(coordinate);
else Q4.insert(coordinate);
}
}
if (Q1.empty() && Q2.empty() && Q3.empty() &&Q4.empty())
{
cout << "No point in any quadrant\n";
return 0;
}
//iterate each set, find min, max
pair<pair<int, int>, pair<int, int>> pointQ1, pointQ2, pointQ3, pointQ4; // {lower left, upper right}
pointQ1 = {{INT32_MAX, INT32_MAX}, {INT32_MIN, INT32_MIN}};
pointQ2 = {{INT32_MAX, INT32_MAX}, {INT32_MIN, INT32_MIN}};
pointQ3 = {{INT32_MAX, INT32_MAX}, {INT32_MIN, INT32_MIN}};
pointQ4 = {{INT32_MAX, INT32_MAX}, {INT32_MIN, INT32_MIN}};
int area1, area2, area3, area4;
if (!Q1.empty())
{
for (pair<int, int> item : Q1)
{
setPointValue(pointQ1, item);
}
area1 = (pointQ1.second.first - pointQ1.first.first) * (pointQ1.second.second - pointQ1.first.second);
}
else area1 = -1;
if (!Q2.empty())
{
for (pair<int, int> item : Q2)
{
setPointValue(pointQ2, item);
}
area2 = (pointQ2.second.first - pointQ2.first.first) * (pointQ2.second.second - pointQ2.first.second);
}
else area2 = -1;
if (!Q3.empty())
{
for (pair<int, int> item : Q3)
{
setPointValue(pointQ3, item);
}
area3 = (pointQ3.second.first - pointQ3.first.first) * (pointQ3.second.second - pointQ3.first.second);
}
else area3 = -1;
if (!Q4.empty())
{
for (pair<int, int> item : Q4)
{
setPointValue(pointQ4, item);
}
area4 = (pointQ4.second.first - pointQ4.first.first) * (pointQ4.second.second - pointQ4.first.second);
}
else area4 = -1;
if (area1 != -1)
{
cout << "Q1: (" << pointQ1.first.first << ", " << pointQ1.first.second << ") (" << pointQ1.second.first << ", " << pointQ1.second.second << ") " << area1 << endl;
}
if (area2 != -1)
{
cout << "Q2: (" << pointQ2.first.first << ", " << pointQ2.first.second << ") (" << pointQ2.second.first << ", " << pointQ2.second.second << ") " << area2 << endl;
}
if (area3 != -1)
{
cout << "Q3: (" << pointQ3.first.first << ", " << pointQ3.first.second << ") (" << pointQ3.second.first << ", " << pointQ3.second.second << ") " << area3 << endl;
}
if (area4 != -1)
{
cout << "Q4: (" << pointQ4.first.first << ", " << pointQ4.first.second << ") (" << pointQ4.second.first << ", " << pointQ4.second.second << ") " << area4 << endl;
}
return 0;
}
void setPointValue(pair<pair<int, int>, pair<int, int>> &point, pair<int, int> item)
{
point.first.first = min(point.first.first, item.first);
point.first.second = min(point.first.second, item.second);
point.second.first = max(point.second.first, item.first);
point.second.second = max(point.second.second, item.second);
} | # 2070049, 2024-11-02 11:47:10, PPPPPPPPPP (100%)
#include <iostream>
#include <set>
#include <vector>
using namespace std;
int calculateArea(set<pair<int, int>> &Q, pair<pair<int, int>, pair<int, int>> &pointQ);
void setPointValue(pair<pair<int, int>, pair<int, int>> &point, pair<int, int> item);
int main()
{
int n;
cin >> n;
pair<int, int> input;
vector<pair<int, int>> inputs;
for (int i = 0; i < n; i++)
{
cin >> input.first >> input.second;
inputs.push_back(input);
}
set<pair<int, int>> Q1, Q2, Q3, Q4;
for (pair<int, int> coordinate : inputs)
{
if (coordinate.first == 0 || coordinate.second == 0) continue;
else
{
if (coordinate.first > 0 && coordinate.second > 0) Q1.insert(coordinate);
else if (coordinate.first < 0 && coordinate.second > 0) Q2.insert(coordinate);
else if (coordinate.first < 0 && coordinate.second < 0) Q3.insert(coordinate);
else Q4.insert(coordinate);
}
}
if (Q1.empty() && Q2.empty() && Q3.empty() &&Q4.empty())
{
cout << "No point in any quadrant\n";
return 0;
}
// iterate each set, find min, max
pair<pair<int, int>, pair<int, int>> pointQ1, pointQ2, pointQ3, pointQ4; // {lower left, upper right}
pointQ1 = {{INT32_MAX, INT32_MAX}, {INT32_MIN, INT32_MIN}};
pointQ2 = {{INT32_MAX, INT32_MAX}, {INT32_MIN, INT32_MIN}};
pointQ3 = {{INT32_MAX, INT32_MAX}, {INT32_MIN, INT32_MIN}};
pointQ4 = {{INT32_MAX, INT32_MAX}, {INT32_MIN, INT32_MIN}};
// calculate sq area of each quadrant
int area1, area2, area3, area4;
area1 = calculateArea(Q1, pointQ1);
area2 = calculateArea(Q2, pointQ2);
area3 = calculateArea(Q3, pointQ3);
area4 = calculateArea(Q4, pointQ4);
// output
if (area1 != -1) cout << "Q1: (" << pointQ1.first.first << ", " << pointQ1.first.second << ") (" << pointQ1.second.first << ", " << pointQ1.second.second << ") " << area1 << endl;
if (area2 != -1) cout << "Q2: (" << pointQ2.first.first << ", " << pointQ2.first.second << ") (" << pointQ2.second.first << ", " << pointQ2.second.second << ") " << area2 << endl;
if (area3 != -1) cout << "Q3: (" << pointQ3.first.first << ", " << pointQ3.first.second << ") (" << pointQ3.second.first << ", " << pointQ3.second.second << ") " << area3 << endl;
if (area4 != -1) cout << "Q4: (" << pointQ4.first.first << ", " << pointQ4.first.second << ") (" << pointQ4.second.first << ", " << pointQ4.second.second << ") " << area4 << endl;
return 0;
}
int calculateArea(set<pair<int, int>> &Q, pair<pair<int, int>, pair<int, int>> &pointQ)
{
int area = 0;
if (!Q.empty())
{
for (pair<int, int> item : Q)
{
setPointValue(pointQ, item);
}
area = (pointQ.second.first - pointQ.first.first) * (pointQ.second.second - pointQ.first.second);
}
else area = -1;
return area;
}
void setPointValue(pair<pair<int, int>, pair<int, int>> &point, pair<int, int> item)
{
point.first.first = min(point.first.first, item.first);
point.first.second = min(point.first.second, item.second);
point.second.first = max(point.second.first, item.first);
point.second.second = max(point.second.second, item.second);
} |
# 2068981, 2024-11-02 09:59:14, PPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
int main(){
vector<pair<int,int>> q1,q2,q3,q4;
vector<int> xq1,xq2,xq3,xq4;
vector<int> yq1,yq2,yq3,yq4;
bool printed=0;
int i,n,x,y;
cin >> n;
for(i=0;i<n;i++){
cin >> x >> y;
if(x>0&&y>0){
q1.push_back({x,y});
xq1.push_back(x);
yq1.push_back(y);
}
if(x<0&&y>0){
q2.push_back({x,y});
xq2.push_back(x);
yq2.push_back(y);
}
if(x<0&&y<0){
q3.push_back({x,y});
xq3.push_back(x);
yq3.push_back(y);
}
if(x>0&&y<0){
q4.push_back({x,y});
xq4.push_back(x);
yq4.push_back(y);
}
}
if(!xq1.empty()){
cout << "Q1: (" << *(min_element(xq1.begin(),xq1.end())) << ", " << *(min_element(yq1.begin(),yq1.end())) << ") (" << *(max_element(xq1.begin(),xq1.end())) << ", " << *(max_element(yq1.begin(),yq1.end())) << ") ";
cout << abs((*(max_element(xq1.begin(),xq1.end()))-*(min_element(xq1.begin(),xq1.end())))*(*(max_element(yq1.begin(),yq1.end()))-*(min_element(yq1.begin(),yq1.end()))));
printed=1;
}
if(!xq2.empty()){
if(printed){
printed=0;
cout << endl;
}
cout << "Q2: (" << *(min_element(xq2.begin(),xq2.end())) << ", " << *(min_element(yq2.begin(),yq2.end())) << ") (" << *(max_element(xq2.begin(),xq2.end())) << ", " << *(max_element(yq2.begin(),yq2.end())) << ") ";
cout << abs((*(max_element(xq2.begin(),xq2.end()))-*(min_element(xq2.begin(),xq2.end())))*(*(max_element(yq2.begin(),yq2.end()))-*(min_element(yq2.begin(),yq2.end()))));
printed=1;
}
if(!xq3.empty()){
if(printed){
printed=0;
cout << endl;
}
cout << "Q3: (" << *(min_element(xq3.begin(),xq3.end())) << ", " << *(min_element(yq3.begin(),yq3.end())) << ") (" << *(max_element(xq3.begin(),xq3.end())) << ", " << *(max_element(yq3.begin(),yq3.end())) << ") ";
cout << abs((*(max_element(xq3.begin(),xq3.end()))-*(min_element(xq3.begin(),xq3.end())))*(*(max_element(yq3.begin(),yq3.end()))-*(min_element(yq3.begin(),yq3.end()))));
printed=1;
}
if(!xq4.empty()){
if(printed){
printed=0;
cout << endl;
}
cout << "Q4: (" << *(min_element(xq4.begin(),xq4.end())) << ", " << *(min_element(yq4.begin(),yq4.end())) << ") (" << *(max_element(xq4.begin(),xq4.end())) << ", " << *(max_element(yq4.begin(),yq4.end())) << ") ";
cout << abs((*(max_element(xq4.begin(),xq4.end()))-*(min_element(xq4.begin(),xq4.end())))*(*(max_element(yq4.begin(),yq4.end()))-*(min_element(yq4.begin(),yq4.end()))));
printed=1;
}
if(xq1.empty()&&xq2.empty()&&xq3.empty()&&xq4.empty()){
cout << "No point in any quadrant";
}
} | # 2068983, 2024-11-02 10:00:08, PPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
int main(){
vector<int> xq1,xq2,xq3,xq4,yq1,yq2,yq3,yq4;
bool printed=0;
int i,n,x,y;
cin >> n;
for(i=0;i<n;i++){
cin >> x >> y;
if(x>0&&y>0){
xq1.push_back(x);
yq1.push_back(y);
}
if(x<0&&y>0){
xq2.push_back(x);
yq2.push_back(y);
}
if(x<0&&y<0){
xq3.push_back(x);
yq3.push_back(y);
}
if(x>0&&y<0){
xq4.push_back(x);
yq4.push_back(y);
}
}
if(!xq1.empty()){
cout << "Q1: (" << *(min_element(xq1.begin(),xq1.end())) << ", " << *(min_element(yq1.begin(),yq1.end())) << ") (" << *(max_element(xq1.begin(),xq1.end())) << ", " << *(max_element(yq1.begin(),yq1.end())) << ") ";
cout << abs((*(max_element(xq1.begin(),xq1.end()))-*(min_element(xq1.begin(),xq1.end())))*(*(max_element(yq1.begin(),yq1.end()))-*(min_element(yq1.begin(),yq1.end()))));
printed=1;
}
if(!xq2.empty()){
if(printed){
printed=0;
cout << endl;
}
cout << "Q2: (" << *(min_element(xq2.begin(),xq2.end())) << ", " << *(min_element(yq2.begin(),yq2.end())) << ") (" << *(max_element(xq2.begin(),xq2.end())) << ", " << *(max_element(yq2.begin(),yq2.end())) << ") ";
cout << abs((*(max_element(xq2.begin(),xq2.end()))-*(min_element(xq2.begin(),xq2.end())))*(*(max_element(yq2.begin(),yq2.end()))-*(min_element(yq2.begin(),yq2.end()))));
printed=1;
}
if(!xq3.empty()){
if(printed){
printed=0;
cout << endl;
}
cout << "Q3: (" << *(min_element(xq3.begin(),xq3.end())) << ", " << *(min_element(yq3.begin(),yq3.end())) << ") (" << *(max_element(xq3.begin(),xq3.end())) << ", " << *(max_element(yq3.begin(),yq3.end())) << ") ";
cout << abs((*(max_element(xq3.begin(),xq3.end()))-*(min_element(xq3.begin(),xq3.end())))*(*(max_element(yq3.begin(),yq3.end()))-*(min_element(yq3.begin(),yq3.end()))));
printed=1;
}
if(!xq4.empty()){
if(printed){
printed=0;
cout << endl;
}
cout << "Q4: (" << *(min_element(xq4.begin(),xq4.end())) << ", " << *(min_element(yq4.begin(),yq4.end())) << ") (" << *(max_element(xq4.begin(),xq4.end())) << ", " << *(max_element(yq4.begin(),yq4.end())) << ") ";
cout << abs((*(max_element(xq4.begin(),xq4.end()))-*(min_element(xq4.begin(),xq4.end())))*(*(max_element(yq4.begin(),yq4.end()))-*(min_element(yq4.begin(),yq4.end()))));
printed=1;
}
if(xq1.empty()&&xq2.empty()&&xq3.empty()&&xq4.empty()){
cout << "No point in any quadrant";
}
} |
# 2070934, 2024-11-02 13:35:40, PPPP-P---- (50%)
#include <bits/stdc++.h>
using namespace std;
int main() {
int n; cin >> n;
set<int> q1X, q1Y,q2X, q2Y,q3X, q3Y,q4X, q4Y;
int x,y,count = 0;
for (int i=0; i<n; i++) {
cin >> x >> y;
if (x>0 && y > 0) {
q1X.insert(x);
q1Y.insert(y);
count+=1;
} else if (x<0 && y>0) {
q2X.insert(x);
q2Y.insert(y);
count+= 1;
} else if (x<0 && y<0) {
q3X.insert(x);
q3Y.insert(y);
count+= 1;
} else if (x>0 && y<0) {
q4X.insert(x);
q4Y.insert(y);
count+= 1;
}
}
//q1
if (count==0) {
cout << "No point in any quadrant";
} else {
if(q1X.empty()==false&&q1Y.empty()==false) {
cout << "Q1: ";
auto ib1 = q1X.begin(), ib2 = q1Y.begin();
auto it1 = q1X.rbegin(), it2 = q1Y.rbegin();
pair<int,int> q1bot = make_pair(*ib1,*ib2);
pair<int,int> q1top = make_pair(*it1,*it2);
int size = (q1top.first-q1bot.first)*(q1top.second-q1bot.second);
cout << "(" << q1bot.first << ", " << q1bot.second << ") ";
cout << "(" << q1top.first << ", " << q1top.second << ") " << size << endl;
}
//q2
if(q2X.empty()==false&&q2Y.empty()==false) {
cout << "Q2: ";
auto ib1 = q2X.begin(), ib2 = q2Y.begin();
auto it1 = q2X.rbegin(), it2 = q2Y.rbegin();
pair<int,int> q2bot = make_pair(*ib1,*ib2);
pair<int,int> q2top = make_pair(*it1,*it2);
int size = (q2top.first-q2bot.first)*(q2top.second-q2bot.second);
cout << "(" << q2bot.first << ", " << q2bot.second << ") ";
cout << "(" << q2top.first << ", " << q2top.second << ") " << size << endl;
}
if(q3X.empty()==false&&q3Y.empty()==false) {
cout << "Q3: ";
auto ib1 = q3X.begin(), ib2 = q3Y.begin();
auto it1 = q3X.rbegin(), it2 = q3Y.rbegin();
pair<int,int> q3bot = make_pair(*ib1,*ib2);
pair<int,int> q3top = make_pair(*it1,*it2);
int size = (q3top.first-q3bot.first)*(q3top.second-q3bot.second);
cout << "(" << q3bot.first << ", " << q3bot.second << ") ";
cout << "(" << q3top.first << ", " << q3top.second << ") " << size << endl;
}
if(q4X.empty()==false&&q4Y.empty()==false) {
cout << "Q1: ";
auto ib1 = q4X.begin(), ib2 = q4Y.begin();
auto it1 = q4X.rbegin(), it2 = q4Y.rbegin();
pair<int,int> q4bot = make_pair(*ib1,*ib2);
pair<int,int> q4top = make_pair(*it1,*it2);
int size = (q4top.first-q4bot.first)*(q4top.second-q4bot.second);
cout << "(" << q4bot.first << ", " << q4bot.second << ") ";
cout << "(" << q4top.first << ", " << q4top.second << ") " << size << endl;
}
}
} | # 2070946, 2024-11-02 13:36:58, PPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std;
int main() {
int n; cin >> n;
set<int> q1X, q1Y,q2X, q2Y,q3X, q3Y,q4X, q4Y;
int x,y,count = 0;
for (int i=0; i<n; i++) {
cin >> x >> y;
if (x>0 && y > 0) {
q1X.insert(x);
q1Y.insert(y);
count+=1;
} else if (x<0 && y>0) {
q2X.insert(x);
q2Y.insert(y);
count+= 1;
} else if (x<0 && y<0) {
q3X.insert(x);
q3Y.insert(y);
count+= 1;
} else if (x>0 && y<0) {
q4X.insert(x);
q4Y.insert(y);
count+= 1;
}
}
//q1
if (count==0) {
cout << "No point in any quadrant";
} else {
if(q1X.empty()==false&&q1Y.empty()==false) {
cout << "Q1: ";
auto ib1 = q1X.begin(), ib2 = q1Y.begin();
auto it1 = q1X.rbegin(), it2 = q1Y.rbegin();
pair<int,int> q1bot = make_pair(*ib1,*ib2);
pair<int,int> q1top = make_pair(*it1,*it2);
int size = (q1top.first-q1bot.first)*(q1top.second-q1bot.second);
cout << "(" << q1bot.first << ", " << q1bot.second << ") ";
cout << "(" << q1top.first << ", " << q1top.second << ") " << size << endl;
}
//q2
if(q2X.empty()==false&&q2Y.empty()==false) {
cout << "Q2: ";
auto ib1 = q2X.begin(), ib2 = q2Y.begin();
auto it1 = q2X.rbegin(), it2 = q2Y.rbegin();
pair<int,int> q2bot = make_pair(*ib1,*ib2);
pair<int,int> q2top = make_pair(*it1,*it2);
int size = (q2top.first-q2bot.first)*(q2top.second-q2bot.second);
cout << "(" << q2bot.first << ", " << q2bot.second << ") ";
cout << "(" << q2top.first << ", " << q2top.second << ") " << size << endl;
}
if(q3X.empty()==false&&q3Y.empty()==false) {
cout << "Q3: ";
auto ib1 = q3X.begin(), ib2 = q3Y.begin();
auto it1 = q3X.rbegin(), it2 = q3Y.rbegin();
pair<int,int> q3bot = make_pair(*ib1,*ib2);
pair<int,int> q3top = make_pair(*it1,*it2);
int size = (q3top.first-q3bot.first)*(q3top.second-q3bot.second);
cout << "(" << q3bot.first << ", " << q3bot.second << ") ";
cout << "(" << q3top.first << ", " << q3top.second << ") " << size << endl;
}
if(q4X.empty()==false&&q4Y.empty()==false) {
cout << "Q4: ";
auto ib1 = q4X.begin(), ib2 = q4Y.begin();
auto it1 = q4X.rbegin(), it2 = q4Y.rbegin();
pair<int,int> q4bot = make_pair(*ib1,*ib2);
pair<int,int> q4top = make_pair(*it1,*it2);
int size = (q4top.first-q4bot.first)*(q4top.second-q4bot.second);
cout << "(" << q4bot.first << ", " << q4bot.second << ") ";
cout << "(" << q4top.first << ", " << q4top.second << ") " << size << endl;
}
}
} |
# 2071060, 2024-11-02 13:49:51, PPPPP-PPPP (90%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
set<int> q1x;
set<int> q1y;
set<int> q2x;
set<int> q2y;
set<int> q3x;
set<int> q3y;
set<int> q4x;
set<int> q4y;
int x,y;
for(int i=0;i<n;i++){
cin>>x>>y;
if(x>0&&y>0){ //q1
q1x.insert(x);
q1y.insert(y);
}
else if(x>0&&y<0){ //q4
q4x.insert(x);
q4y.insert(y);
}
else if(x<0&&y>0){ //q2
q2x.insert(x);
q2y.insert(y);
}
else if(x<0&&y<0){ //q3
q3x.insert(x);
q3y.insert(y);
}
}
if(q1x.size()){
cout<<"Q1: ("<<*(q1x.begin())<<", "<<*(q1y.begin())<<") ("<<*(q1x.rbegin())<<", "<<*(q1y.rbegin())<<") ";
int x = *(q1x.rbegin()) - *(q1x.begin());
int y = *(q1y.rbegin()) - *(q1y.begin());
cout<<x*y<<endl;
}
if(q2x.size()){
cout<<"Q2: ("<<*(q2x.begin())<<", "<<*(q2y.begin())<<") ("<<*(q2x.rbegin())<<", "<<*(q2y.rbegin())<<") ";
int x = *(q2x.rbegin()) - *(q2x.begin());
int y = *(q2y.rbegin()) - *(q2y.begin());
cout<<x*y<<endl;
}
if(q3x.size()){
cout<<"Q3: ("<<*(q3x.begin())<<", "<<*(q3y.begin())<<") ("<<*(q3x.rbegin())<<", "<<*(q3y.rbegin())<<") ";
int x = *(q3x.rbegin()) - *(q3x.begin());
int y = *(q3y.rbegin()) - *(q3y.begin());
cout<<x*y<<endl;
}
if(q4x.size()){
cout<<"Q4: ("<<*(q4x.begin())<<", "<<*(q4y.begin())<<") ("<<*(q4x.rbegin())<<", "<<*(q4y.rbegin())<<") ";
int x = *(q4x.rbegin()) - *(q4x.begin());
int y = *(q4y.rbegin()) - *(q4y.begin());
cout<<x*y<<endl;
}
} | # 2071075, 2024-11-02 13:51:24, PPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
set<int> q1x;
set<int> q1y;
set<int> q2x;
set<int> q2y;
set<int> q3x;
set<int> q3y;
set<int> q4x;
set<int> q4y;
int x,y;
for(int i=0;i<n;i++){
cin>>x>>y;
if(x>0&&y>0){ //q1
q1x.insert(x);
q1y.insert(y);
}
else if(x>0&&y<0){ //q4
q4x.insert(x);
q4y.insert(y);
}
else if(x<0&&y>0){ //q2
q2x.insert(x);
q2y.insert(y);
}
else if(x<0&&y<0){ //q3
q3x.insert(x);
q3y.insert(y);
}
}
if(q1x.size()){
cout<<"Q1: ("<<*(q1x.begin())<<", "<<*(q1y.begin())<<") ("<<*(q1x.rbegin())<<", "<<*(q1y.rbegin())<<") ";
int x = *(q1x.rbegin()) - *(q1x.begin());
int y = *(q1y.rbegin()) - *(q1y.begin());
cout<<x*y<<endl;
}
if(q2x.size()){
cout<<"Q2: ("<<*(q2x.begin())<<", "<<*(q2y.begin())<<") ("<<*(q2x.rbegin())<<", "<<*(q2y.rbegin())<<") ";
int x = *(q2x.rbegin()) - *(q2x.begin());
int y = *(q2y.rbegin()) - *(q2y.begin());
cout<<x*y<<endl;
}
if(q3x.size()){
cout<<"Q3: ("<<*(q3x.begin())<<", "<<*(q3y.begin())<<") ("<<*(q3x.rbegin())<<", "<<*(q3y.rbegin())<<") ";
int x = *(q3x.rbegin()) - *(q3x.begin());
int y = *(q3y.rbegin()) - *(q3y.begin());
cout<<x*y<<endl;
}
if(q4x.size()){
cout<<"Q4: ("<<*(q4x.begin())<<", "<<*(q4y.begin())<<") ("<<*(q4x.rbegin())<<", "<<*(q4y.rbegin())<<") ";
int x = *(q4x.rbegin()) - *(q4x.begin());
int y = *(q4y.rbegin()) - *(q4y.begin());
cout<<x*y<<endl;
}
if(!(q1x.size()||q2x.size()||q3x.size()||q4x.size()))cout<<"No point in any quadrant";
} |
# 2068829, 2024-11-02 09:42:44, xxxx-x--x- (0%)
#include<bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int n; cin>>n;
int x,y;
vector <int> xq1,xq2,xq3,xq4;
vector <int> yq1,yq2,yq3,yq4;
for(int i=0;i<n;i++){
cin>>x>>y;
if(x>0 && y>0){
xq1.push_back(x);
yq1.push_back(y);
}
else if(x>0 && y<0){
xq2.push_back(x);
yq2.push_back(y);
}
else if(x<0 && y<0){
xq3.push_back(x);
yq3.push_back(y);
}
else if(x>0 && y>0){
xq4.push_back(x);
yq4.push_back(y);
}
}
int mxx1 = *max_element(xq1.begin(),xq1.end());
int mnx1 = *min_element(xq1.begin(),xq1.end());
int mxx2 = *max_element(xq2.begin(),xq2.end());
int mnx2 = *min_element(xq2.begin(),xq2.end());
int mxx3 = *max_element(xq3.begin(),xq3.end());
int mnx3 = *min_element(xq3.begin(),xq3.end());
int mxx4 = *max_element(xq4.begin(),xq4.end());
int mnx4 = *min_element(xq4.begin(),xq4.end());
int mxy1 = *max_element(yq1.begin(),yq1.end());
int mny1 = *min_element(yq1.begin(),yq1.end());
int mxy2 = *max_element(yq2.begin(),yq2.end());
int mny2 = *min_element(yq2.begin(),yq2.end());
int mxy3 = *max_element(yq3.begin(),yq3.end());
int mny3 = *min_element(yq3.begin(),yq3.end());
int mxy4 = *max_element(yq4.begin(),yq4.end());
int mny4 = *min_element(yq4.begin(),yq4.end());
if(xq1.size()!=0){
cout<<"Q1: ("<<mnx1<<", "<<mny1<<") ("<<mxx1<<", "<<mxy1<<") "<<(mxx1-mnx1)*(mxy1-mny1)<<"\n";
}
if(xq2.size()!=0){
cout<<"Q2: ("<<mnx2<<", "<<mny2<<") ("<<mxx2<<", "<<mxy2<<") "<<(mxx2-mnx2)*(mxy2-mny2)<<"\n";
}
if(xq3.size()!=0){
cout<<"Q3: ("<<mnx3<<", "<<mny3<<") ("<<mxx3<<", "<<mxy3<<") "<<(mxx3-mnx3)*(mxy3-mny3)<<"\n";
}
if(xq4.size()!=0){
cout<<"Q4: ("<<mnx4<<", "<<mny4<<") ("<<mxx4<<", "<<mxy4<<") "<<(mxx4-mnx4)*(mxy4-mny4)<<"\n";
}
if(xq1.size()==0&&xq2.size()==0&&xq3.size()==0&&xq4.size()==0){
cout<<"No point in any quadrant";
}
return 0;
} | # 2069014, 2024-11-02 10:03:23, PPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n; cin>>n;
int x,y;
vector <int> xq1,xq2,xq3,xq4;
vector <int> yq1,yq2,yq3,yq4;
for(int i=0;i<n;i++){
cin>>x>>y;
if(x>0 && y>0){
xq1.push_back(x);
yq1.push_back(y);
//cout<<"s";
}
else if(x<0 && y>0){
xq2.push_back(x);
yq2.push_back(y);
}
else if(x<0 && y<0){
xq3.push_back(x);
yq3.push_back(y);
}
else if(x>0 && y<0){
xq4.push_back(x);
yq4.push_back(y);
}
}
int &mxx1 = *max_element(xq1.begin(),xq1.end());
int &mnx1 = *min_element(xq1.begin(),xq1.end());
int &mxx2 = *max_element(xq2.begin(),xq2.end());
int &mnx2 = *min_element(xq2.begin(),xq2.end());
int &mxx3 = *max_element(xq3.begin(),xq3.end());
int &mnx3 = *min_element(xq3.begin(),xq3.end());
int &mxx4 = *max_element(xq4.begin(),xq4.end());
int &mnx4 = *min_element(xq4.begin(),xq4.end());
int &mxy1 = *max_element(yq1.begin(),yq1.end());
int &mny1 = *min_element(yq1.begin(),yq1.end());
int &mxy2 = *max_element(yq2.begin(),yq2.end());
int &mny2 = *min_element(yq2.begin(),yq2.end());
int &mxy3 = *max_element(yq3.begin(),yq3.end());
int &mny3 = *min_element(yq3.begin(),yq3.end());
int &mxy4 = *max_element(yq4.begin(),yq4.end());
int &mny4 = *min_element(yq4.begin(),yq4.end());
//cout<<mxx1<<" "<<mxx2<<" " <<mxy1<<" "<<mxy2<<" ";
if(xq1.size()!=0){
cout<<"Q1: ("<<mnx1<<", "<<mny1<<") ("<<mxx1<<", "<<mxy1<<") "<<(mxx1-mnx1)*(mxy1-mny1)<<"\n";
}
if(xq2.size()!=0){
cout<<"Q2: ("<<mnx2<<", "<<mny2<<") ("<<mxx2<<", "<<mxy2<<") "<<(mxx2-mnx2)*(mxy2-mny2)<<"\n";
}
if(xq3.size()!=0){
cout<<"Q3: ("<<mnx3<<", "<<mny3<<") ("<<mxx3<<", "<<mxy3<<") "<<(mxx3-mnx3)*(mxy3-mny3)<<"\n";
}
if(xq4.size()!=0){
cout<<"Q4: ("<<mnx4<<", "<<mny4<<") ("<<mxx4<<", "<<mxy4<<") "<<(mxx4-mnx4)*(mxy4-mny4)<<"\n";
}
if(xq1.size()==0&&xq2.size()==0&&xq3.size()==0&&xq4.size()==0){
cout<<"No point in any quadrant";
}
return 0;
} |
# 2070705, 2024-11-02 13:04:35, -x-x-x--x- (0%)
#include<bits/stdc++.h>
using namespace std;
int main()
{
set<int> Q1X;
set<int> Q1Y;
set<int> Q2X;
set<int> Q2Y;
set<int> Q3X;
set<int> Q3Y;
set<int> Q4X;
set<int> Q4Y;
vector<int> temp;
int x,y;
int t;
cin>>t;
while (t--)
{
cin>>x>>y;
if(x>=1&&y>=1)
{
Q1X.insert(x);
Q1Y.insert(y);
}
if(x<=-1&&y>=1)
{
Q2X.insert(x);
Q2X.insert(y);
}
if(x<=-1&&y<=-1)
{
Q3X.insert(x);
Q3Y.insert(y);
}
if(x>=1&&y<=-1)
{
Q4X.insert(x);
Q4Y.insert(y);
}
}
for(auto i:Q1X)
{
temp.push_back(i);
}
int minx=temp[0];
int maxx=temp[temp.size()-1];
temp.clear();
for(auto i:Q1Y)
{
temp.push_back(i);
}
int miny=temp[0];
int maxy=temp[temp.size()-1];
temp.clear();
cout<<"Q1: ";
cout<<"("<<minx<<", "<<miny<<") "<<"("<<maxx<<", "<<maxy<<") "<<(maxx-minx)*(maxy-miny)<<endl;
for(auto i:Q2X)
{
temp.push_back(i);
}
minx=temp[0];
maxx=temp[temp.size()-1];
temp.clear();
for(auto i:Q2Y)
{
temp.push_back(i);
}
miny=temp[0];
maxy=temp[temp.size()-1];
temp.clear();
cout<<"Q2: ";
cout<<"("<<minx<<", "<<miny<<") "<<"("<<maxx<<", "<<maxy<<") "<<(maxx-minx)*(maxy-miny)<<endl;
for(auto i:Q3X)
{
temp.push_back(i);
}
minx=temp[0];
maxx=temp[temp.size()-1];
temp.clear();
for(auto i:Q3Y)
{
temp.push_back(i);
}
miny=temp[0];
maxy=temp[temp.size()-1];
temp.clear();
cout<<"Q3: ";
cout<<"("<<minx<<", "<<miny<<") "<<"("<<maxx<<", "<<maxy<<") "<<(maxx-minx)*(maxy-miny)<<endl;
for(auto i:Q4X)
{
temp.push_back(i);
}
minx=temp[0];
maxx=temp[temp.size()-1];
temp.clear();
for(auto i:Q4Y)
{
temp.push_back(i);
}
miny=temp[0];
maxy=temp[temp.size()-1];
temp.clear();
cout<<"Q4: ";
cout<<"("<<minx<<", "<<miny<<") "<<"("<<maxx<<", "<<maxy<<") "<<(maxx-minx)*(maxy-miny)<<endl;
} | # 2070785, 2024-11-02 13:16:26, PPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
int main()
{
set<int> Q1X;
set<int> Q1Y;
set<int> Q2X;
set<int> Q2Y;
set<int> Q3X;
set<int> Q3Y;
set<int> Q4X;
set<int> Q4Y;
vector<int> temp;
int x,y;
int t;
cin>>t;
int c=0;
while (t--)
{
cin>>x>>y;
if(x==0||y==0)
{
}
else if(x>=1&&y>=1)
{
Q1X.insert(x);
Q1Y.insert(y);
}
else if(x<=-1&&y>=1)
{
Q2X.insert(x);
Q2Y.insert(y);
}
else if(x<=-1&&y<=-1)
{
Q3X.insert(x);
Q3Y.insert(y);
}
else if(x>=1&&y<=-1)
{
Q4X.insert(x);
Q4Y.insert(y);
}
}
int minx;
int maxx;
int miny;
int maxy;
if(Q1X.size()!=0)
{
c++;
for(auto i:Q1X)
{
temp.push_back(i);
}
minx=temp[0];
maxx=temp[temp.size()-1];
temp.clear();
for(auto i:Q1Y)
{
temp.push_back(i);
}
miny=temp[0];
maxy=temp[temp.size()-1];
temp.clear();
cout<<"Q1: ";
cout<<"("<<minx<<", "<<miny<<") "<<"("<<maxx<<", "<<maxy<<") "<<(maxx-minx)*(maxy-miny)<<endl;
}
if(Q2X.size()!=0)
{
c++;
for(auto i:Q2X)
{
temp.push_back(i);
}
minx=temp[0];
maxx=temp[temp.size()-1];
temp.clear();
for(auto i:Q2Y)
{
temp.push_back(i);
}
miny=temp[0];
maxy=temp[temp.size()-1];
temp.clear();
cout<<"Q2: ";
cout<<"("<<minx<<", "<<miny<<") "<<"("<<maxx<<", "<<maxy<<") "<<(maxx-minx)*(maxy-miny)<<endl;
}
if(Q3X.size()!=0)
{
c++;
for(auto i:Q3X)
{
temp.push_back(i);
}
minx=temp[0];
maxx=temp[temp.size()-1];
temp.clear();
for(auto i:Q3Y)
{
temp.push_back(i);
}
miny=temp[0];
maxy=temp[temp.size()-1];
temp.clear();
cout<<"Q3: ";
cout<<"("<<minx<<", "<<miny<<") "<<"("<<maxx<<", "<<maxy<<") "<<(maxx-minx)*(maxy-miny)<<endl;
}
if(Q4X.size()!=0)
{
c++;
for(auto i:Q4X)
{
temp.push_back(i);
}
minx=temp[0];
maxx=temp[temp.size()-1];
temp.clear();
for(auto i:Q4Y)
{
temp.push_back(i);
}
miny=temp[0];
maxy=temp[temp.size()-1];
temp.clear();
cout<<"Q4: ";
cout<<"("<<minx<<", "<<miny<<") "<<"("<<maxx<<", "<<maxy<<") "<<(maxx-minx)*(maxy-miny)<<endl;
}
if(c==0)
{
cout<<"No point in any quadrant";
}
} |
# 2069240, 2024-11-02 10:30:10, ----P-PP-P (40%)
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n, x, y;
bool check = false, f1 = false, f2 = false, f3 = false, f4 = false;
cin >> n;
// vector<pair<int, int>> xy;
int minx[4], miny[4], maxx[4], maxy[4];
while (n--)
{
cin >> x >> y;
if (x > 0 && y > 0)
{
if (!f1)
{
minx[0] = x;
miny[0] = y;
maxx[0] = x;
maxy[0] = y;
}
if (x < minx[0])
minx[0] = x;
if (x > maxx[0])
maxx[0] = x;
if (y < miny[0])
miny[0] = y;
if (y > maxy[0])
maxy[0] = y;
f1 = true;
}
else if (x < 0 && y > 0)
{
if (!f2)
{
minx[1] = x;
miny[1] = y;
maxx[1] = x;
maxy[1] = y;
}
if (x < minx[1])
minx[1] = x;
if (x > maxx[1])
maxx[1] = x;
if (y < miny[1])
miny[1] = y;
if (y > maxy[1])
maxy[1] = y;
f2 = true;
}
else if (x < 0 && y < 0)
{
if (!f3)
{
minx[2] = x;
miny[2] = y;
maxx[2] = x;
maxy[2] = y;
}
if (x < minx[2])
minx[2] = x;
if (x > maxx[2])
maxx[2] = x;
if (y < miny[2])
miny[2] = y;
if (y > maxy[2])
maxy[2] = y;
f3 = true;
}
else if (x > 0 && y < 0)
{
if (!f4)
{
minx[3] = x;
miny[3] = y;
maxx[3] = x;
maxy[3] = y;
}
if (x < minx[3])
minx[3] = x;
if (x > maxx[3])
maxx[3] = x;
if (y < miny[3])
miny[3] = y;
if (y > maxy[3])
maxy[3] = y;
f4 = true;
}
}
for (int i = 0; i < 4; ++i)
{
if (minx[i] != miny[i] != maxx[i] != maxy[i])
{
check=true;
cout << "Q" << i + 1 << ": (" << minx[i] << ", " << miny[i] << ") (" << maxx[i] << ", " << maxy[i] << ") " << (maxx[i] - minx[i]) * (maxy[i] - miny[i]) << endl;
}
}
if(!check)
cout << "No point in any quadrant" << endl;
} | # 2069304, 2024-11-02 10:35:13, PPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n, x, y;
bool check = false, f1 = false, f2 = false, f3 = false, f4 = false;
cin >> n;
// vector<pair<int, int>> xy;
int minx[4] = {0}, miny[4] = {0}, maxx[4] = {0}, maxy[4] = {0};
while (n--)
{
cin >> x >> y;
if (x > 0 && y > 0)
{
if (!f1)
{
minx[0] = x;
miny[0] = y;
maxx[0] = x;
maxy[0] = y;
}
if (x < minx[0])
minx[0] = x;
if (x > maxx[0])
maxx[0] = x;
if (y < miny[0])
miny[0] = y;
if (y > maxy[0])
maxy[0] = y;
f1 = true;
}
else if (x < 0 && y > 0)
{
if (!f2)
{
minx[1] = x;
miny[1] = y;
maxx[1] = x;
maxy[1] = y;
}
if (x < minx[1])
minx[1] = x;
if (x > maxx[1])
maxx[1] = x;
if (y < miny[1])
miny[1] = y;
if (y > maxy[1])
maxy[1] = y;
f2 = true;
}
else if (x < 0 && y < 0)
{
if (!f3)
{
minx[2] = x;
miny[2] = y;
maxx[2] = x;
maxy[2] = y;
}
if (x < minx[2])
minx[2] = x;
if (x > maxx[2])
maxx[2] = x;
if (y < miny[2])
miny[2] = y;
if (y > maxy[2])
maxy[2] = y;
f3 = true;
}
else if (x > 0 && y < 0)
{
if (!f4)
{
minx[3] = x;
miny[3] = y;
maxx[3] = x;
maxy[3] = y;
}
if (x < minx[3])
minx[3] = x;
if (x > maxx[3])
maxx[3] = x;
if (y < miny[3])
miny[3] = y;
if (y > maxy[3])
maxy[3] = y;
f4 = true;
}
}
for (int i = 0; i < 4; ++i)
{
if (minx[i] != 0 && maxx[i] != 0 && miny[i] != 0 && maxy[i] != 0)
{
check = true;
cout << "Q" << i + 1 << ": (" << minx[i] << ", " << miny[i] << ") (" << maxx[i] << ", " << maxy[i] << ") " << (maxx[i] - minx[i]) * (maxy[i] - miny[i]) << endl;
}
}
if (!check)
cout << "No point in any quadrant" << endl;
} |
# 2070922, 2024-11-02 13:33:45, PPPPP-PPPP (90%)
#include <iostream>
#include <vector>
#include <set> // who knows
#include <algorithm>
using namespace std;
int main() {
int N;
cin >> N;
int x,y;
set<int> Q1x, Q1y, Q2x, Q2y, Q3x, Q3y, Q4x, Q4y;
for (int i = 0; i < N; i++) {
cin >> x >> y;
if (x != 0 && y != 0) {
if (x > 0 && y > 0) {
Q1x.insert(x); Q1y.insert(y);
} else if (x < 0 && y > 0) {
Q2x.insert(x); Q2y.insert(y);
} else if (x < 0 && y < 0) {
Q3x.insert(x); Q3y.insert(y);
} else if (x > 0 && y < 0) {
Q4x.insert(x); Q4y.insert(y);
}
}
}
int min1x = *min_element(Q1x.begin(),Q1x.end()), max1x = *max_element(Q1x.begin(),Q1x.end());
int min1y = *min_element(Q1y.begin(),Q1y.end()), max1y = *max_element(Q1y.begin(),Q1y.end());
int min2x = *min_element(Q2x.begin(),Q2x.end()), max2x = *max_element(Q2x.begin(),Q2x.end());
int min2y = *min_element(Q2y.begin(),Q2y.end()), max2y = *max_element(Q2y.begin(),Q2y.end());
int min3x = *min_element(Q3x.begin(),Q3x.end()), max3x = *max_element(Q3x.begin(),Q3x.end());
int min3y = *min_element(Q3y.begin(),Q3y.end()), max3y = *max_element(Q3y.begin(),Q3y.end());
int min4x = *min_element(Q4x.begin(),Q4x.end()), max4x = *max_element(Q4x.begin(),Q4x.end());
int min4y = *min_element(Q4y.begin(),Q4y.end()), max4y = *max_element(Q4y.begin(),Q4y.end());
if (Q1x.empty() && Q1y.empty() && Q2x.empty() && Q2y.empty() && Q3x.empty() && Q3y.empty() && Q4x.empty() && Q4y.empty()) {
cout << "No points in any quadrant" << endl;
} else {
if (!(Q1x.empty() && Q1y.empty())) {
cout << "Q1: (" << min1x << ", " << min1y << ") (" << max1x << ", " << max1y << ") " << (max1x - min1x) * (max1y - min1y) << endl;
}
if (!(Q2x.empty() && Q2y.empty())) {
cout << "Q2: (" << min2x << ", " << min2y << ") (" << max2x << ", " << max2y << ") " << (max2x - min2x) * (max2y - min2y) << endl;
}
if (!(Q3x.empty() && Q3y.empty())) {
cout << "Q3: (" << min3x << ", " << min3y << ") (" << max3x << ", " << max3y << ") " << (max3x - min3x) * (max3y - min3y) << endl;
}
if (!(Q4x.empty() && Q4y.empty())) {
cout << "Q4: (" << min4x << ", " << min4y << ") (" << max4x << ", " << max4y << ") " << (max4x - min4x) * (max4y - min4y) << endl;
}
}
} | # 2070927, 2024-11-02 13:34:47, PPPPPPPPPP (100%)
#include <iostream>
#include <vector>
#include <set> // who knows
#include <algorithm>
using namespace std;
int main() {
int N;
cin >> N;
int x,y;
set<int> Q1x, Q1y, Q2x, Q2y, Q3x, Q3y, Q4x, Q4y;
for (int i = 0; i < N; i++) {
cin >> x >> y;
if (x != 0 && y != 0) {
if (x > 0 && y > 0) {
Q1x.insert(x); Q1y.insert(y);
} else if (x < 0 && y > 0) {
Q2x.insert(x); Q2y.insert(y);
} else if (x < 0 && y < 0) {
Q3x.insert(x); Q3y.insert(y);
} else if (x > 0 && y < 0) {
Q4x.insert(x); Q4y.insert(y);
}
}
}
int min1x = *min_element(Q1x.begin(),Q1x.end()), max1x = *max_element(Q1x.begin(),Q1x.end());
int min1y = *min_element(Q1y.begin(),Q1y.end()), max1y = *max_element(Q1y.begin(),Q1y.end());
int min2x = *min_element(Q2x.begin(),Q2x.end()), max2x = *max_element(Q2x.begin(),Q2x.end());
int min2y = *min_element(Q2y.begin(),Q2y.end()), max2y = *max_element(Q2y.begin(),Q2y.end());
int min3x = *min_element(Q3x.begin(),Q3x.end()), max3x = *max_element(Q3x.begin(),Q3x.end());
int min3y = *min_element(Q3y.begin(),Q3y.end()), max3y = *max_element(Q3y.begin(),Q3y.end());
int min4x = *min_element(Q4x.begin(),Q4x.end()), max4x = *max_element(Q4x.begin(),Q4x.end());
int min4y = *min_element(Q4y.begin(),Q4y.end()), max4y = *max_element(Q4y.begin(),Q4y.end());
if (Q1x.empty() && Q1y.empty() && Q2x.empty() && Q2y.empty() && Q3x.empty() && Q3y.empty() && Q4x.empty() && Q4y.empty()) {
cout << "No point in any quadrant" << endl;
} else {
if (!(Q1x.empty() && Q1y.empty())) {
cout << "Q1: (" << min1x << ", " << min1y << ") (" << max1x << ", " << max1y << ") " << (max1x - min1x) * (max1y - min1y) << endl;
}
if (!(Q2x.empty() && Q2y.empty())) {
cout << "Q2: (" << min2x << ", " << min2y << ") (" << max2x << ", " << max2y << ") " << (max2x - min2x) * (max2y - min2y) << endl;
}
if (!(Q3x.empty() && Q3y.empty())) {
cout << "Q3: (" << min3x << ", " << min3y << ") (" << max3x << ", " << max3y << ") " << (max3x - min3x) * (max3y - min3y) << endl;
}
if (!(Q4x.empty() && Q4y.empty())) {
cout << "Q4: (" << min4x << ", " << min4y << ") (" << max4x << ", " << max4y << ") " << (max4x - min4x) * (max4y - min4y) << endl;
}
}
} |
# 2071205, 2024-11-02 14:07:32, -----P---- (10%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int num;
map<int,set<int>> q1,q2,q3,q4;
cin >> num;
int x,y;
for(int i = 0; i < num; i++){
cin >> x >> y;
if(x > 0 && y > 0){
if(q1.find(x) == q1.end()) q1[x] = set<int>();
q1[x].insert(y);
}
if(x < 0 && y > 0){
if(q1.find(x) == q1.end()) q2[x] = set<int>();
q2[x].insert(y);
}
if(x < 0 && y < 0){
if(q1.find(x) == q1.end()) q3[x] = set<int>();
q3[x].insert(y);
}
if(x > 0 && y < 0){
if(q1.find(x) == q1.end()) q4[x] = set<int>();
q4[x].insert(y);
}
}
cout << "No point in any quadrant";
} | # 2071587, 2024-11-02 14:51:53, PPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int num;
set<int>q1,q2,q3,q4;
set<int>yq1,yq2,yq3,yq4;
cin >> num;
int x,y;
for(int i = 0; i < num; i++){
cin >> x >> y;
if(x > 0 && y > 0){
q1.insert(x);
yq1.insert(y);
}
if(x < 0 && y > 0){
q2.insert(x);
yq2.insert(y);
}
if(x < 0 && y < 0){
q3.insert(x);
yq3.insert(y);
}
if(x > 0 && y < 0){
q4.insert(x);
yq4.insert(y);
}
}
bool max = true;
if(q1.size() > 0){
max = false;
int area = abs(*(q1.begin()) - *(--q1.end()))* abs(*(yq1.begin()) - *(--yq1.end()));
cout << "Q1: (" << *(q1.begin())<< ", " << *(yq1.begin()) << ") (" << *(--q1.end()) << ", " << *(--yq1.end()) << ") " << area << endl;
}if(q2.size() > 0){
max = false;
int area = abs(*(q2.begin()) - *(--q2.end()))* abs(*(yq2.begin()) - *(--yq2.end()));
cout << "Q2: (" << *(q2.begin())<< ", " << *(yq2.begin()) << ") (" << *(--q2.end()) << ", " << *(--yq2.end()) << ") " << area << endl;
}if(q3.size() > 0){
max = false;
int area = abs(*(q3.begin()) - *(--q3.end()))* abs(*(yq3.begin()) - *(--yq3.end()));
cout << "Q3: (" << *(q3.begin())<< ", " << *(yq3.begin()) << ") (" << *(--q3.end()) << ", " << *(--yq3.end()) << ") " << area << endl;
}if(q4.size() > 0){
max = false;
int area = abs(*(q4.begin()) - *(--q4.end()))* abs(*(yq4.begin()) - *(--yq4.end()));
cout << "Q4: (" << *(q4.begin())<< ", " << *(yq4.begin()) << ") (" << *(--q4.end()) << ", " << *(--yq4.end()) << ") " << area << endl;
}
if(max)
cout << "No point in any quadrant";
} |
# 2069018, 2024-11-02 10:04:13, -----P---- (10%)
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int x ,y;
pair<pair<int,int>,pair<int,int>> Q1,Q2,Q3,Q4;
bool q1=1,q2=1,q3=1,q4=1;
while (n--)
{
cin >> x >> y;
if (x == 0 || y == 0) continue;
}
if(q1 && q2 && q3 && q4) cout << "No point in any quadrant";
else {
if (!q1) cout << "Q1: ";
if (!q2) cout << "Q2: ";
if (!q3) cout << "Q3: ";
if (!q4) cout << "Q4: ";
}
} | # 2069175, 2024-11-02 10:22:12, PPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int x ,y;
pair<pair<int,int>,pair<int,int>> Q1,Q2,Q3,Q4;
bool q1=1,q2=1,q3=1,q4=1;
while (n--)
{
cin >> x >> y;
if (x == 0 || y == 0) continue;
if (x > 0 && y > 0) {
if (q1) {
Q1.first.first = x;
Q1.first.second = y;
Q1.second.first = x;
Q1.second.second = y;
q1 = 0;
}else {
// min
if (x < Q1.first.first) Q1.first.first = x;
if (y < Q1.first.second) Q1.first.second = y;
//max
if (x > Q1.second.first) Q1.second.first = x;
if (y > Q1.second.second) Q1.second.second = y;
}
}
else if (x < 0 && y > 0) {
if (q2) {
Q2.first.first = x;
Q2.first.second = y;
Q2.second.first = x;
Q2.second.second = y;
q2 = 0;
}else {
// min
if (x < Q2.first.first) Q2.first.first = x;
if (y < Q2.first.second) Q2.first.second = y;
//max
if (x > Q2.second.first) Q2.second.first = x;
if (y > Q2.second.second) Q2.second.second = y;
}
}
else if (x < 0 && y < 0) {
if (q3) {
Q3.first.first = x;
Q3.first.second = y;
Q3.second.first = x;
Q3.second.second = y;
q3 = 0;
}else {
// min
if (x < Q3.first.first) Q3.first.first = x;
if (y < Q3.first.second) Q3.first.second = y;
//max
if (x > Q3.second.first) Q3.second.first = x;
if (y > Q3.second.second) Q3.second.second = y;
}
}
else if (x > 0 && y < 0) {
if(q4) {
Q4.first.first = x;
Q4.first.second = y;
Q4.second.first = x;
Q4.second.second = y;
q4 = 0;
}else {
// min
if (x < Q4.first.first) Q4.first.first = x;
if (y < Q4.first.second) Q4.first.second = y;
//max
if (x > Q4.second.first) Q4.second.first = x;
if (y > Q4.second.second) Q4.second.second = y;
}
}
}
if(q1 && q2 && q3 && q4) cout << "No point in any quadrant";
else {
if (!q1) cout << "Q1: (" <<Q1.first.first <<", "<<Q1.first.second <<") ("<<Q1.second.first <<", "<<Q1.second.second <<") " << ((Q1.second.first - Q1.first.first)*(Q1.second.second - Q1.first.second)) << endl;
if (!q2) cout << "Q2: (" <<Q2.first.first <<", "<<Q2.first.second <<") ("<<Q2.second.first <<", "<<Q2.second.second <<") " << ((Q2.second.first - Q2.first.first)*(Q2.second.second - Q2.first.second)) << endl;
if (!q3) cout << "Q3: (" <<Q3.first.first <<", "<<Q3.first.second <<") ("<<Q3.second.first <<", "<<Q3.second.second <<") " << ((Q3.second.first - Q3.first.first)*(Q3.second.second - Q3.first.second)) << endl;
if (!q4) cout << "Q4: (" <<Q4.first.first <<", "<<Q4.first.second <<") ("<<Q4.second.first <<", "<<Q4.second.second <<") " << ((Q4.second.first - Q4.first.first)*(Q4.second.second - Q4.first.second)) << endl;
}
} |
# 2069379, 2024-11-02 10:41:44, PPP--P---- (40%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n; cin >> n;
int q1_min_x = 1000000, q1_min_y = 1000000, q1_max_x = -1000000, q1_max_y = -1000000;
int q2_min_x = 1000000, q2_min_y = 1000000, q2_max_x = -1000000, q2_max_y = -1000000;
int q3_min_x = 1000000, q3_min_y = 1000000, q3_max_x = -1000000, q3_max_y = -1000000;
int q4_min_x = 1000000, q4_min_y = 1000000, q4_max_x = -1000000, q4_max_y = -1000000;
vector<pair<int,int>> q1;
vector<pair<int,int>> q2;
vector<pair<int,int>> q3;
vector<pair<int,int>> q4;
for(int i = 0; i < n; i++){
int x,y; cin >> x >> y;
if(x !=0 && y != 0){
if(x>0){
if(y>0){
if(x<q1_min_x){q1_min_x = x;}
if(x>q1_max_x){q1_max_x = x;}
if(y<q1_min_y){q1_min_y = y;}
if(y>q1_max_y){q1_max_y = y;}
q1.push_back(make_pair(x,y));
}
else{
if(x<q4_min_x){q4_min_x = x;}
if(x>q4_max_x){q4_max_x = x;}
if(y<q4_min_y){q4_min_y = y;}
if(y>q4_max_y){q4_max_y = y;}
q4.push_back(make_pair(x,y));
}
}
else if(x<0){
if(y>0){
if(x<q2_min_x){q2_min_x = x;}
if(x>q2_max_x){q2_max_x = x;}
if(y<q2_min_y){q2_min_y = y;}
if(y>q2_max_y){q2_max_y = y;}
q2.push_back(make_pair(x,y));
}
else{
if(x<q3_min_x){q3_min_x = x;}
if(x>q3_max_x){q3_max_x = x;}
if(y<q3_min_y){q3_min_y = y;}
if(y>q3_max_y){q3_max_y = y;}
q3.push_back(make_pair(x,y));
}
}
}
}
for(auto a: q3){
cout << a.first << " " << a.second << endl;
}
/// Q1
if(q1.size() == 0 && q2.size() == 0 && q3.size()==0 && q4.size() == 0){
cout << "No point in any quadrant";
}
else{
if(q1.size()>=1){
int area = (q1_max_x-q1_min_x) * (q1_max_y-q1_min_y);
cout << "Q1: (" << q1_min_x << ", " << q1_min_y << ") " << "(" << q1_max_x << ", " << q1_max_y << ") " << area << endl;
}
if(q2.size()>=1){
int area2 = (q2_max_x-q2_min_x) * (q2_max_y-q2_min_y);
cout << "Q2: (" << q2_min_x << ", " << q2_min_y << ") " << "(" << q2_max_x << ", " << q2_max_y << ") " << area2 << endl;
}
if(q3.size()>=1){
int area3 = (q3_max_x-q3_min_x) * (q3_max_y-q3_min_y);
cout << "Q3: (" << q3_min_x << ", " << q3_min_y << ") " << "(" << q3_max_x << ", " << q3_max_y << ") " << area3 << endl;
}
if(q4.size()>=1){
int area4 = (q4_max_x-q4_min_x) * (q4_max_y-q4_min_y);
cout << "Q4: (" << q4_min_x << ", " << q4_min_y << ") " << "(" << q4_max_x << ", " << q4_max_y << ") " << area4 << endl;
}
}
return 0;
} | # 2069514, 2024-11-02 10:54:18, PPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n; cin >> n;
int q1_min_x = 1000000, q1_min_y = 1000000, q1_max_x = -1000000, q1_max_y = -1000000;
int q2_min_x = 1000000, q2_min_y = 1000000, q2_max_x = -1000000, q2_max_y = -1000000;
int q3_min_x = 1000000, q3_min_y = 1000000, q3_max_x = -1000000, q3_max_y = -1000000;
int q4_min_x = 1000000, q4_min_y = 1000000, q4_max_x = -1000000, q4_max_y = -1000000;
vector<pair<int,int>> q1;
vector<pair<int,int>> q2;
vector<pair<int,int>> q3;
vector<pair<int,int>> q4;
for(int i = 0; i < n; i++){
int x,y; cin >> x >> y;
if(x !=0 && y != 0){
if(x>0){
if(y>0){
if(x<q1_min_x){q1_min_x = x;}
if(x>q1_max_x){q1_max_x = x;}
if(y<q1_min_y){q1_min_y = y;}
if(y>q1_max_y){q1_max_y = y;}
q1.push_back(make_pair(x,y));
}
else{
if(x<q4_min_x){q4_min_x = x;}
if(x>q4_max_x){q4_max_x = x;}
if(y<q4_min_y){q4_min_y = y;}
if(y>q4_max_y){q4_max_y = y;}
q4.push_back(make_pair(x,y));
}
}
else if(x<0){
if(y>0){
if(x<q2_min_x){q2_min_x = x;}
if(x>q2_max_x){q2_max_x = x;}
if(y<q2_min_y){q2_min_y = y;}
if(y>q2_max_y){q2_max_y = y;}
q2.push_back(make_pair(x,y));
}
else{
if(x<q3_min_x){q3_min_x = x;}
if(x>q3_max_x){q3_max_x = x;}
if(y<q3_min_y){q3_min_y = y;}
if(y>q3_max_y){q3_max_y = y;}
q3.push_back(make_pair(x,y));
}
}
}
}
/// Q1
if(q1.size() == 0 && q2.size() == 0 && q3.size()==0 && q4.size() == 0){
cout << "No point in any quadrant";
}
else{
if(q1.size()>=1){
int area = (q1_max_x-q1_min_x) * (q1_max_y-q1_min_y);
cout << "Q1: (" << q1_min_x << ", " << q1_min_y << ") " << "(" << q1_max_x << ", " << q1_max_y << ") " << area << endl;
}
if(q2.size()>=1){
int area2 = (q2_max_x-q2_min_x) * (q2_max_y-q2_min_y);
cout << "Q2: (" << q2_min_x << ", " << q2_min_y << ") " << "(" << q2_max_x << ", " << q2_max_y << ") " << area2 << endl;
}
if(q3.size()>=1){
int area3 = (q3_max_x-q3_min_x) * (q3_max_y-q3_min_y);
cout << "Q3: (" << q3_min_x << ", " << q3_min_y << ") " << "(" << q3_max_x << ", " << q3_max_y << ") " << area3 << endl;
}
if(q4.size()>=1){
int area4 = (q4_max_x-q4_min_x) * (q4_max_y-q4_min_y);
cout << "Q4: (" << q4_min_x << ", " << q4_min_y << ") " << "(" << q4_max_x << ", " << q4_max_y << ") " << area4 << endl;
}
}
return 0;
} |
# 2069507, 2024-11-02 10:53:51, PPPPPPPPPP (100%)
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int n,x,y;
cin>>n;
vector<pair<int,int>> q1,q2,q3,q4;
while(n--){
cin>>x>>y;
if(x>0 && y>0)
q1.push_back(make_pair(x,y));
else if (x<0 && y>0)
q2.push_back(make_pair(x,y));
else if (x<0 && y<0)
q3.push_back(make_pair(x,y));
else if (x>0 && y<0)
q4.push_back(make_pair(x,y));
}
if(q1.size()+q2.size()+q3.size()+q4.size() == 0){
cout<<"No point in any quadrant";
}else{
if(q1.empty()!=1){
vector<int> x1,y1;
for(auto a:q1){
x1.push_back(a.first);
y1.push_back(a.second);
}
sort(x1.begin(),x1.end());
sort(y1.begin(),y1.end());
int xmax = x1[x1.size()-1];
int ymax = y1[y1.size()-1];
int xmin = x1[0];
int ymin = y1[0];
int s = abs(xmax-xmin)*abs(ymax-ymin);
cout<<"Q1: ("<<xmin<<", "<<ymin<<") ("<<xmax<<", "<<ymax<<") "<<s<<endl;
}
if(q2.empty()!=1){
vector<int> x1,y1;
for(auto a:q2){
x1.push_back(a.first);
y1.push_back(a.second);
}
sort(x1.begin(),x1.end());
sort(y1.begin(),y1.end());
int xmax = x1[x1.size()-1];
int ymax = y1[y1.size()-1];
int xmin = x1[0];
int ymin = y1[0];
int s = abs(xmax-xmin)*abs(ymax-ymin);
cout<<"Q2: ("<<xmin<<", "<<ymin<<") ("<<xmax<<", "<<ymax<<") "<<s<<endl;
}
if(q3.empty()!=1){
vector<int> x1,y1;
for(auto a:q3){
x1.push_back(a.first);
y1.push_back(a.second);
}
sort(x1.begin(),x1.end());
sort(y1.begin(),y1.end());
int xmax = x1[x1.size()-1];
int ymax = y1[y1.size()-1];
int xmin = x1[0];
int ymin = y1[0];
int s = abs(xmax-xmin)*abs(ymax-ymin);
cout<<"Q3: ("<<xmin<<", "<<ymin<<") ("<<xmax<<", "<<ymax<<") "<<s<<endl;
}
if(q4.empty()!=1){
vector<int> x1,y1;
for(auto a:q4){
x1.push_back(a.first);
y1.push_back(a.second);
}
sort(x1.begin(),x1.end());
sort(y1.begin(),y1.end());
int xmax = x1[x1.size()-1];
int ymax = y1[y1.size()-1];
int xmin = x1[0];
int ymin = y1[0];
int s = abs(xmax-xmin)*abs(ymax-ymin);
cout<<"Q4: ("<<xmin<<", "<<ymin<<") ("<<xmax<<", "<<ymax<<") "<<s<<endl;
}
}
} |
# 2069087, 2024-11-02 10:10:42, PPPPPPPPPP (100%)
#include <stdio.h>
#include <iostream>
#include <map>
#include <algorithm>
#include <vector>
#include <set>
#include <cctype>
#include <cmath>
using namespace std;
void printVec(vector<int> vec)
{
for (auto i : vec)
{
cout << i << ' ';
}
cout << endl;
}
void printSet(set<string> st)
{
for (auto i : st)
{
cout << i << ' ';
}
cout << endl;
}
void printMap(vector<pair<int, int>> mp)
{
for (auto i : mp)
{
cout << '[' << i.first << " : " << i.second << ']';
}
cout << endl;
}
void printResult(string str, vector<pair<int, int>> vecPair)
{
vector<int> vec;
vec.resize(4);
vec[0] = vecPair[0].first;
vec[2] = vecPair.back().first;
sort(vecPair.begin(), vecPair.end(), [](const pair<int, int> &a, const pair<int, int> &b)
{ return a.second > b.second; });
vec[1] = vecPair.back().second;
vec[3] = vecPair[0].second;
cout << str << ": (" << vec[0] << ", " << vec[1] << ") (" << vec[2] << ", " << vec[3] << ") " << abs(vec[0] - vec[2]) * abs(vec[1] - vec[3]);
cout << endl;
// printVec(vec);
}
int main()
{
int n;
cin >> n;
vector<string> vec;
vector<pair<int, int>> q1;
vector<pair<int, int>> q2;
vector<pair<int, int>> q3;
vector<pair<int, int>> q4;
vector<pair<int, int>> check;
vector<int> wtf;
int count = 0;
for (int i = 0; i < n; i++)
{
count++;
int s1, s2;
cin >> s1 >> s2;
if (s1 > 0 & s2 > 0)
{
/* code */
q1.push_back(pair<int, int>(s1, s2));
}
else if (s1 < 0 & s2 > 0)
{
/* code */
q2.push_back(pair<int, int>(s1, s2));
}
else if (s1 < 0 & s2 < 0)
{
q3.push_back(pair<int, int>(s1, s2));
}
else if (s1 > 0 & s2 < 0)
{
q4.push_back(pair<int, int>(s1, s2));
}
else if (s1 == 0 | s2 == 0)
{
check.push_back(pair<int, int>(s1, s2));
}
}
sort(q1.begin(), q1.end());
sort(q2.begin(), q2.end());
sort(q3.begin(), q3.end());
sort(q4.begin(), q4.end());
if (check.size() == n)
{
/* code */
cout << "No point in any quadrant" << endl;
}
if (q1.size() != 0)
{
/* code */
printResult("Q1", q1);
}
if (q2.size() != 0)
{
/* code */
printResult("Q2", q2);
}
if (q3.size() != 0)
{
/* code */
printResult("Q3", q3);
}
if (q4.size() != 0)
{
/* code */
printResult("Q4", q4);
}
// printResult("Q2",q2);
// printResult("Q3",q3);
// printResult("Q4",q4);
// vector<int> rq1;
// rq1.resize(4);
// rq1[0] = q1[0].first;
// rq1[2] = q1.back().first;
// printVec(rq1);
// printMap(q1);
// printMap(q2);
// printMap(q3);
// printMap(q4);
}
// 19
// 2 2
// 4 6
// 5 5
// 1 0
// -1 2
// -3 4
// -2 6
// 0 -3
// -5 7
// -4 5
// -6 3
// 0 4
// -2 -2
// -5 -6
// -7 0
// 6 -4
// 4 -6
// 3 -2
// 2 -5 |
# 2069664, 2024-11-02 11:09:32, PPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std;
// vector<pair<int, int>> findlf(vector<pair<int, int>> &v) {
// int xru=v[0].first, yru=v[0].second, xld=v[0].first, yld=v[0].second;
// for (auto c : v) {
// if ((c.first < xld) && (c.second < yld)) {
// xld = c.first;
// yld = c.second;
// }
// if ((c.first > xru) && (c.second < yru)) {
// xru = c.first;
// yru = c.second;
// }
// }
// vector<pair<int, int>> show;
// show.push_back({xld, yld});
// show.push_back({xru, yru});
// return show;
// }
int main() {
int n;
cin >> n;
vector<pair<int, int>> v;
while(n--) {
int x, y;
cin >> x >> y;
v.push_back({x,y});
}
;
map<int, vector<pair<int, int>>> m;
for (auto c: v) {
if (c.first > 0 && c.second > 0) {
m[1].push_back(c);
} else if (c.first < 0 && c.second > 0) {
m[2].push_back(c);
} else if (c.first < 0 && c.second < 0) {
m[3].push_back(c);
} else if (c.first > 0 && c.second < 0) {
m[4].push_back(c);
} else {
m[0].push_back(c);
}
}
// // vector<pair<int, int>> q = findlf(q1);
// sort(m[1].begin(), m[1].end());
// for (auto c : m[1]) {
// cout << c.first << " " << c.second << endl;
// }
// cout << "jrtgbuiehhb";
for(auto c: m) {
sort(m[c.first].begin(), m[c.first].end());
}
bool check = true;
for (int i=1; i<=4; i++) {
if (m[i].size() == 0) continue;
int mx=m[i][0].first, my=m[i][0].second, Mx=m[i][0].first, My=m[i][0].second;
for (auto c : m[i]) {
mx = min(mx, c.first);
my = min(my,c.second);
Mx = max(Mx, c.first);
My = max(My, c.second);
}
int rect = (Mx-mx)*(My-my);
string str = "Q"+to_string(i)+": ("+to_string(mx)+", "+to_string(my)+") ("+to_string(Mx)+", "+to_string(My)+") " + to_string(rect);
cout << str << endl;
check = false;
}
if(check) {
cout << "No point in any quadrant";
}
} |
# 2069187, 2024-11-02 10:24:05, PPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
int max1x = -1e9, max2x = -1e9, max3x = -1e9, max4x = -1e9, min1x = 1e9, min2x = 1e9, min3x = 1e9, min4x = 1e9;
int max1 = -1e9, max2 = -1e9, max3 = -1e9, max4 = -1e9, min1 = 1e9, min2 = 1e9, min3 = 1e9, min4 = 1e9;
cin >> n;
for (int i = 0; i < n; i++)
{
int a, b;
cin >> a >> b;
if (a == 0 || b == 0)
{
continue;
}
if (a > 0 && b > 0)
{
max1x = max(max1x, a);
max1 = max(max1, b);
min1x = min(min1x, a);
min1 = min(min1, b);
}
if (a < 0 && b > 0)
{
max2x = max(max2x, a);
max2 = max(max2, b);
min2x = min(min2x, a);
min2 = min(min2, b);
}
if (a < 0 && b < 0)
{
max3x = max(max3x, a);
max3 = max(max3, b);
min3x = min(min3x, a);
min3 = min(min3, b);
}
if (a > 0 && b < 0)
{
max4x = max(max4x, a);
max4 = max(max4, b);
min4x = min(min4x, a);
min4 = min(min4, b);
}
}
bool check =0;
if (max1x != -1e9 && max1 != -1e9 && min1x != 1e9 && min1 != 1e9)
{
cout << "Q1: (" << min1x << ", " << min1 << ") (" << max1x << ", " << max1 << ") ";
cout << abs(min1x - max1x) * abs(min1 - max1);
check = 1;
cout << endl;
}
if (max2x != -1e9 && max2 != -1e9 && min2x != 1e9 && min2 != 1e9)
{
cout << "Q2: (" << min2x << ", " << min2 << ") (" << max2x << ", " << max2 << ") ";
cout << abs(min2x - max2x) * abs(min2 - max2);
check = 1;
cout << endl;
}
if (max3x != -1e9 && max3 != -1e9 && min3x != 1e9 && min3 != 1e9)
{
cout << "Q3: (" << min3x << ", " << min3 << ") (" << max3x << ", " << max3 << ") ";
cout << abs(min3x - max3x) * abs(min3 - max3);
check = 1;
cout << endl;
}
if (max4x != -1e9 && max4 != -1e9 && min4x != 1e9 && min4 != 1e9)
{
cout << "Q4: (" << min4x << ", " << min4 << ") (" << max4x << ", " << max4 << ") ";
cout << abs(min4x - max4x) * abs(min4 - max4);
check = 1;
}
if(check == 0)
{
cout << "No point in any quadrant";
}
} |
# 2069346, 2024-11-02 10:38:21, PPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std;
vector<int> mnX(5, INT_MAX), mnY(5, INT_MAX);
vector<int> mxX(5, INT_MIN), mxY(5, INT_MIN);
vector<bool> chk(5, false);
int main()
{
int n;
cin >> n;
for (int i = 0; i < n; i++)
{
int x, y, Q;
cin >> x >> y;
if (x > 0 && y > 0)
{
Q = 1;
chk[1] = true;
}
else if (x < 0 && y > 0)
{
Q = 2;
chk[2] = true;
}
else if (x < 0 && y < 0)
{
Q = 3;
chk[3] = true;
}
else if (x > 0 && y < 0)
{
Q = 4;
chk[4] = true;
}
else
{
continue;
}
mnX[Q] = min(mnX[Q], x);
mnY[Q] = min(mnY[Q], y);
mxX[Q] = max(mxX[Q], x);
mxY[Q] = max(mxY[Q], y);
}
if (!chk[1] && !chk[2] && !chk[3] && !chk[4])
{
cout << "No point in any quadrant";
return 0;
}
for (int Q = 1; Q <= 4; Q++)
{
if (chk[Q])
{
int area = (mxX[Q] - mnX[Q]) * (mxY[Q] - mnY[Q]);
printf("Q%d: (%d, %d) (%d, %d) %d\n", Q, mnX[Q], mnY[Q], mxX[Q], mxY[Q], area);
}
}
return 0;
} |
# 2070736, 2024-11-02 13:09:43, PPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std;
int main(){
vector<int> q1x,q2x,q3x,q4x,q1y,q2y,q3y,q4y;
int n,x,y;
int cnt = 0;
cin >> n;
while(n--){
cin >> x >> y;
if(x > 0 && y > 0){//q1
q1x.push_back(x);
q1y.push_back(y);
cnt++;
}
if(x < 0 && y > 0){//q2
q2x.push_back(x);
q2y.push_back(y);
cnt++;
}
if(x < 0 && y < 0){//q3
q3x.push_back(x);
q3y.push_back(y);
cnt++;
}
if(x > 0 && y < 0){//q4
q4x.push_back(x);
q4y.push_back(y);
cnt++;
}
}
sort(q1x.begin(),q1x.end());
sort(q1y.begin(),q1y.end());
sort(q2x.begin(),q2x.end());
sort(q2y.begin(),q2y.end());
sort(q3x.begin(),q3x.end());
sort(q3y.begin(),q3y.end());
sort(q4x.begin(),q4x.end());
sort(q4y.begin(),q4y.end());
if(q1x.size())cout << "Q1: (" << q1x[0] << ", " << q1y[0] << ") (" << q1x[q1x.size()-1] << ", " << q1y[q1y.size()-1] << ") " << abs(q1x[0] - q1x[q1x.size()-1])*(q1y[q1y.size()-1] - q1y[0]) << endl;
if(q2x.size())cout << "Q2: (" << q2x[0] << ", " << q2y[0] << ") (" << q2x[q2x.size()-1] << ", " << q2y[q2y.size()-1] << ") " << abs(q2x[0] - q2x[q2x.size()-1])*(q2y[q2y.size()-1] - q2y[0]) << endl;
if(q3x.size())cout << "Q3: (" << q3x[0] << ", " << q3y[0] << ") (" << q3x[q3x.size()-1] << ", " << q3y[q3y.size()-1] << ") " << abs(q3x[0] - q3x[q3x.size()-1])*(q3y[q3y.size()-1] - q3y[0]) << endl;
if(q4x.size())cout << "Q4: (" << q4x[0] << ", " << q4y[0] << ") (" << q4x[q4x.size()-1] << ", " << q4y[q4y.size()-1] << ") " << abs(q4x[0] - q4x[q4x.size()-1])*(q4y[q4y.size()-1] - q4y[0]) << endl;
if(cnt == 0)cout << "No point in any quadrant";
} |
# 2071061, 2024-11-02 13:50:05, PPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
int t,x,y;
vector<int> Q1x,Q2x,Q3x,Q4x;
vector<int> Q1y,Q2y,Q3y,Q4y;
cin>>t;
while (t--)
{
cin>>x>>y;
if(x == 0 || y ==0 ) continue;
if(x>0 && y > 0) {
Q1x.push_back(x);
Q1y.push_back(y);
continue;
}
if(x<0 && y > 0) {
Q2x.push_back(x);
Q2y.push_back(y);
continue;
}
if(x<0 && y < 0) {
Q3x.push_back(x);
Q3y.push_back(y);
continue;
}
if(x>0 && y < 0) {
Q4x.push_back(x);
Q4y.push_back(y);
continue;
}
}
if(Q1x.size() == 0 && Q2x.size() == 0 && Q3x.size() == 0 && Q4x.size() == 0) {
cout<<"No point in any quadrant";
return 0;
}
if(Q1x.size() != 0) {
int Q1lx = *min_element(Q1x.begin(),Q1x.end());
int Q1ly = *min_element(Q1y.begin(),Q1y.end());
int Q1rx = *max_element(Q1x.begin(),Q1x.end());
int Q1ry = *max_element(Q1y.begin(),Q1y.end());
cout<<"Q1: "<<'('<<Q1lx<<", "<<Q1ly<<") "<<'('<<Q1rx<<", "<<Q1ry<<") "<<abs(Q1lx-Q1rx)*abs(Q1ly-Q1ry)<<'\n';
}
if(Q2x.size() != 0) {
int Q2lx = *min_element(Q2x.begin(),Q2x.end());
int Q2ry = *max_element(Q2y.begin(),Q2y.end());
int Q2rx = *max_element(Q2x.begin(),Q2x.end());
int Q2ly = *min_element(Q2y.begin(),Q2y.end());
cout<<"Q2: "<<'('<<Q2lx<<", "<<Q2ly<<") "<<'('<<Q2rx<<", "<<Q2ry<<") "<<abs(Q2lx-Q2rx)*abs(Q2ly-Q2ry)<<'\n';
}
if(Q3x.size() != 0) {
int Q3rx = *max_element(Q3x.begin(),Q3x.end());
int Q3ry = *max_element(Q3y.begin(),Q3y.end());
int Q3lx = *min_element(Q3x.begin(),Q3x.end());
int Q3ly = *min_element(Q3y.begin(),Q3y.end());
cout<<"Q3: "<<'('<<Q3lx<<", "<<Q3ly<<") "<<'('<<Q3rx<<", "<<Q3ry<<") "<<abs(Q3lx-Q3rx)*abs(Q3ly-Q3ry)<<'\n';
}
if(Q4x.size() != 0) {
int Q4rx = *max_element(Q4x.begin(),Q4x.end());
int Q4ly = *min_element(Q4y.begin(),Q4y.end());
int Q4lx = *min_element(Q4x.begin(),Q4x.end());
int Q4ry = *max_element(Q4y.begin(),Q4y.end());
cout<<"Q4: "<<'('<<Q4lx<<", "<<Q4ly<<") "<<'('<<Q4rx<<", "<<Q4ry<<") "<<abs(Q4lx-Q4rx)*abs(Q4ly-Q4ry)<<'\n';
}
return 0;
} |
# 2071234, 2024-11-02 14:11:22, PPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n, cnt1=0, cnt2=0, cnt3=0, cnt4=0;
cin>>n;
vector<pair<int,int>> q1, q2, q3, q4;
while (n--){
int x, y;
cin>>x>>y;
if (x!=0||y!=0){
if (x>0&&y>0){
q1.push_back(make_pair(x,y));
cnt1++;
}
else if (x<0&&y>0){
q2.push_back(make_pair(x,y));
cnt2++;
}
else if (x<0&&y<0){
q3.push_back(make_pair(x,y));
cnt3++;
}
else if (x>0&&y<0){
q4.push_back(make_pair(x,y));
cnt4++;
}
}
}
int q1xmin=INT_MAX, q1ymin=INT_MAX, q1xmax=INT_MIN, q1ymax=INT_MIN;
int q2xmin=INT_MAX, q2ymin=INT_MAX, q2xmax=INT_MIN, q2ymax=INT_MIN;
int q3xmin=INT_MAX, q3ymin=INT_MAX, q3xmax=INT_MIN, q3ymax=INT_MIN;
int q4xmin=INT_MAX, q4ymin=INT_MAX, q4xmax=INT_MIN, q4ymax=INT_MIN;
for (int i = 0; i < cnt1; i++){
q1xmin=min(q1[i].first,q1xmin);
q1ymin=min(q1[i].second,q1ymin);
q1xmax=max(q1[i].first,q1xmax);
q1ymax=max(q1[i].second,q1ymax);
}
for (int i = 0; i < cnt2; i++){
q2xmin=min(q2[i].first,q2xmin);
q2ymin=min(q2[i].second,q2ymin);
q2xmax=max(q2[i].first,q2xmax);
q2ymax=max(q2[i].second,q2ymax);
}
for (int i = 0; i < cnt3; i++){
q3xmin=min(q3[i].first,q3xmin);
q3ymin=min(q3[i].second,q3ymin);
q3xmax=max(q3[i].first,q3xmax);
q3ymax=max(q3[i].second,q3ymax);
}
for (int i = 0; i < cnt4; i++){
q4xmin=min(q4[i].first,q4xmin);
q4ymin=min(q4[i].second,q4ymin);
q4xmax=max(q4[i].first,q4xmax);
q4ymax=max(q4[i].second,q4ymax);
}
int q1size=(q1xmax-q1xmin)*(q1ymax-q1ymin);
int q2size=(q2xmax-q2xmin)*(q2ymax-q2ymin);
int q3size=(q3xmax-q3xmin)*(q3ymax-q3ymin);
int q4size=(q4xmax-q4xmin)*(q4ymax-q4ymin);
if (!q1.empty()) cout<<"Q1: ("<<q1xmin<<", "<<q1ymin<<") ("<<q1xmax<<", "<<q1ymax<<") "<<q1size<<endl;
if (!q2.empty()) cout<<"Q2: ("<<q2xmin<<", "<<q2ymin<<") ("<<q2xmax<<", "<<q2ymax<<") "<<q2size<<endl;
if (!q3.empty()) cout<<"Q3: ("<<q3xmin<<", "<<q3ymin<<") ("<<q3xmax<<", "<<q3ymax<<") "<<q3size<<endl;
if (!q4.empty()) cout<<"Q4: ("<<q4xmin<<", "<<q4ymin<<") ("<<q4xmax<<", "<<q4ymax<<") "<<q4size<<endl;
if (q1.empty()&&q2.empty()&&q3.empty()&&q4.empty()) cout<<"No point in any quadrant"<<endl;
} |
# 2071039, 2024-11-02 13:48:20, PPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
int nx,ny;
map<string,vector<int>> m;
for(int i=0;i<n;i++){
cin>>nx>>ny;
if(nx>0&&ny>0){
m["q1x"].push_back(nx);
m["q1y"].push_back(ny);
}
else if(nx<0&&ny>0){
m["q2x"].push_back(nx);
m["q2y"].push_back(ny);
}
else if(nx<0&&ny<0){
m["q3x"].push_back(nx);
m["q3y"].push_back(ny);
}
else if(nx>0&&ny<0){
m["q4x"].push_back(nx);
m["q4y"].push_back(ny);
}
}
for(auto& e:m){
sort(e.second.begin(),e.second.end());
}
// for(auto e:m){
// cout<<e.first<<"//";
// for(auto f:e.second){
// cout<<f<<" ";
// }
// cout<<endl;
// }
if(m.empty()) cout<<"No point in any quadrant";
else{
if(m.find("q1x")!=m.end()){
int a,b,c,d;
a=m["q1x"][0];
b=m["q1y"][0];
c=m["q1x"][m["q1x"].size()-1];
d=m["q1y"][m["q1y"].size()-1];
cout<<"Q1: ("<<a<<", "<<b<<") ("<<c<<", "<<d<<") "<<(c-a)*(d-b)<<endl;
}
if(m.find("q2x")!=m.end()){
int a,b,c,d;
a=m["q2x"][0];
b=m["q2y"][0];
c=m["q2x"][m["q2x"].size()-1];
d=m["q2y"][m["q2y"].size()-1];
cout<<"Q2: ("<<a<<", "<<b<<") ("<<c<<", "<<d<<") "<<(c-a)*(d-b)<<endl;
}
if(m.find("q3x")!=m.end()){
int a,b,c,d;
a=m["q3x"][0];
b=m["q3y"][0];
c=m["q3x"][m["q3x"].size()-1];
d=m["q3y"][m["q3y"].size()-1];
cout<<"Q3: ("<<a<<", "<<b<<") ("<<c<<", "<<d<<") "<<(c-a)*(d-b)<<endl;
}
if(m.find("q4x")!=m.end()){
int a,b,c,d;
a=m["q4x"][0];
b=m["q4y"][0];
c=m["q4x"][m["q4x"].size()-1];
d=m["q4y"][m["q4y"].size()-1];
cout<<"Q4: ("<<a<<", "<<b<<") ("<<c<<", "<<d<<") "<<(c-a)*(d-b)<<endl;
}
}
//<<m["q1x"][m["q1x"].size()]
} |
# 2069259, 2024-11-02 10:32:04, PPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
pair<pair<int,int>,pair<int,int>> sq(set<pair<int,int>> &s){
if(s.empty())return(make_pair(make_pair(0,0),make_pair(0,0)));
int minx=1e9,miny=1e9,maxx=-1e9,maxy=-1e9;
for(auto &p:s){
if(p.first<minx)minx=p.first;
if(p.first>maxx)maxx=p.first;
if(p.second<miny)miny=p.second;
if(p.second>maxy)maxy=p.second;
}
return(make_pair(make_pair(minx,miny),make_pair(maxx,maxy)));
}
int main(){
int n;
cin>>n;
set<pair<int,int>>q1;
set<pair<int,int>>q2;
set<pair<int,int>>q3;
set<pair<int,int>>q4;
for(int i=0;i<n;i++){
int x,y;
cin>>x>>y;
pair<int,int> p=make_pair(x,y);
if(x==0||y==0)continue;
else if(x>0&&y>0)q1.insert(p);
else if(x<0&&y>0)q2.insert(p);
else if(x<0&&y<0)q3.insert(p);
else q4.insert(p);
}
if(q1.empty()&&q2.empty()&&q3.empty()&&q4.empty()){
cout<<"No point in any quadrant";
}else{
pair<pair<int,int>,pair<int,int>> s1=sq(q1),s2=sq(q2),s3=sq(q3),s4=sq(q4);
if(!((s1.first).first==0&&(s1.first).second==0&&(s1.second).first==0&&(s1.second).second==0))cout<<"Q1: ("<<(s1.first).first<<", "<<(s1.first).second<<") ("<<(s1.second).first<<", "<<(s1.second).second<<") "<<abs(((s1.second).first-(s1.first).first)*((s1.second).second-(s1.first).second))<<endl;
if(!((s2.first).first==0&&(s2.first).second==0&&(s2.second).first==0&&(s2.second).second==0))cout<<"Q2: ("<<(s2.first).first<<", "<<(s2.first).second<<") ("<<(s2.second).first<<", "<<(s2.second).second<<") "<<abs(((s2.second).first-(s2.first).first)*((s2.second).second-(s2.first).second))<<endl;
if(!((s3.first).first==0&&(s3.first).second==0&&(s3.second).first==0&&(s3.second).second==0))cout<<"Q3: ("<<(s3.first).first<<", "<<(s3.first).second<<") ("<<(s3.second).first<<", "<<(s3.second).second<<") "<<abs(((s3.second).first-(s3.first).first)*((s3.second).second-(s3.first).second))<<endl;
if(!((s4.first).first==0&&(s4.first).second==0&&(s4.second).first==0&&(s4.second).second==0))cout<<"Q4: ("<<(s4.first).first<<", "<<(s4.first).second<<") ("<<(s4.second).first<<", "<<(s4.second).second<<") "<<abs(((s4.second).first-(s4.first).first)*((s4.second).second-(s4.first).second))<<endl;
}
} |
# 2069344, 2024-11-02 10:38:00, PPPPPPPPPP (100%)
#include <iostream>
#include <vector>
#include <cmath>
#include <tuple>
using namespace std;
void findMin(vector<pair<float,float>> Q, float &minX, float &minY) {
minX = Q[0].first, minY = Q[0].second;
for(auto q : Q) {
if(q.first < minX) minX = q.first;
if(q.second < minY) minY = q.second;
}
}
void findMax(vector<pair<float,float>> Q, float &maxX, float &maxY) {
maxX = Q[0].first, maxY = Q[0].second;
for(auto q : Q) {
if(q.first > maxX) maxX = q.first;
if(q.second > maxY) maxY = q.second;
}
}
void calAll(vector<pair<float,float>> Q, vector<tuple<string,float,float,float,float,int>> &ans, string s) {
int area;
float min_x, max_x, min_y, max_y;
min_x = max_x = Q[0].first;
min_y = max_y = Q[0].second;
findMin(Q, min_x, min_y);
findMax(Q, max_x, max_y);
area = abs((max_x-min_x)*(max_y-min_y));
ans.push_back(make_tuple(s,min_x,min_y,max_x,max_y,area));
}
int main() {
int n; cin >> n;
vector<pair<float,float>> Q1,Q2,Q3,Q4;
while(n--) {
float x,y; cin >> x >> y;
if(x > 0 && y > 0) Q1.push_back(make_pair(x,y));
else if(x < 0 && y > 0) Q2.push_back(make_pair(x,y));
else if(x < 0 && y < 0) Q3.push_back(make_pair(x,y));
else if(x > 0 && y < 0) Q4.push_back(make_pair(x,y));
}
vector<tuple<string,float,float,float,float,int>> ans;
if(Q1.size() != 0) {
calAll(Q1,ans,"Q1: ");
}
if(Q2.size() != 0) {
calAll(Q2,ans,"Q2: ");
}
if(Q3.size() != 0) {
calAll(Q3,ans,"Q3: ");
}
if(Q4.size() != 0) {
calAll(Q4,ans,"Q4: ");
}
if(ans.size() == 0) cout << "No point in any quadrant";
else {
for(auto t : ans) {
cout << get<0>(t) << "(" << get<1>(t) << ", " << get<2>(t) << ") " << "(" << get<3>(t) << ", " << get<4>(t) << ") " << get<5>(t) << endl;
}
}
} |
# 2071140, 2024-11-02 14:00:34, PPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
vector<pair<int,int>> Q1,Q2,Q3,Q4;
set<int> s_x,s_y; int n,x,y; bool check=true;
int main(){
int count=0;
cin>>n;
for(int i=0;i<n;i++){
cin>>x>>y;
if(x>0&&y>0) Q1.push_back({x,y});
else if(x<0&&y>0) Q2.push_back({x,y});
else if(x<0&&y<0) Q3.push_back({x,y});
else if(x>0&&y<0) Q4.push_back({x,y});
else count++;
}
/////counting Q1
for(auto itr =Q1.begin();itr!=Q1.end();itr++){
s_x.insert(itr->first);
s_y.insert(itr->second);
}
if(!s_x.empty()){
auto ix=s_x.begin(); auto iy=s_y.begin();
auto lx=s_x.end(); auto ly=s_y.end(); ly--; lx--;
cout<<"Q1: "<<"("<<*ix<<", "<<*iy<<") ("<<*lx<<", "<<*ly<<") ";
cout<<abs(*ix-*lx)*abs(*iy-*ly)<<endl;
}
s_x.clear(); s_y.clear();
/////counting Q2
for(auto itr =Q2.begin();itr!=Q2.end();itr++){
s_x.insert(itr->first);
s_y.insert(itr->second);
}
if(!s_x.empty()){
auto ix=s_x.begin(); auto iy=s_y.begin();
auto lx=s_x.end(); auto ly=s_y.end(); ly--; lx--;
cout<<"Q2: "<<"("<<*ix<<", "<<*iy<<") ("<<*lx<<", "<<*ly<<") ";
cout<<abs(*ix-*lx)*abs(*iy-*ly)<<endl;
}
s_x.clear(); s_y.clear();
/////counting Q3
for(auto itr =Q3.begin();itr!=Q3.end();itr++){
s_x.insert(itr->first);
s_y.insert(itr->second);
}
if(!s_x.empty()){
auto ix=s_x.begin(); auto iy=s_y.begin();
auto lx=s_x.end(); auto ly=s_y.end(); ly--; lx--;
cout<<"Q3: "<<"("<<*ix<<", "<<*iy<<") ("<<*lx<<", "<<*ly<<") ";
cout<<abs(*ix-*lx)*abs(*iy-*ly)<<endl;
}
s_x.clear(); s_y.clear();
/////counting Q4
for(auto itr =Q4.begin();itr!=Q4.end();itr++){
s_x.insert(itr->first);
s_y.insert(itr->second);
}
if(!s_x.empty()){
auto ix=s_x.begin(); auto iy=s_y.begin();
auto lx=s_x.end(); auto ly=s_y.end(); ly--; lx--;
cout<<"Q4: "<<"("<<*ix<<", "<<*iy<<") ("<<*lx<<", "<<*ly<<") ";
cout<<abs(*ix-*lx)*abs(*iy-*ly)<<endl;
}
s_x.clear(); s_y.clear();
if(count==n) cout<<"No point in any quadrant";
return 0;
} |
# 2071010, 2024-11-02 13:44:04, PPPPPPPPPP (100%)
#include <iostream>
#include <vector>
#include <algorithm>
std::pair<std::pair<int, int>, std::pair<int, int>> find_rectangle(const std::vector<std::pair<int, int>> &Q)
{
int up = -1e9;
int down = 1e9;
int left = 1e9;
int right = -1e9;
for (const auto &[x, y] : Q)
{
up = std::max(up, y);
down = std::min(down, y);
right = std::max(right, x);
left = std::min(left, x);
}
return {{left, down}, {right, up}};
}
int main()
{
int n;
std::vector<std::pair<int, int>> Q1, Q2, Q3, Q4;
std::cin >> n;
for (int i = 0; i < n; ++i)
{
int x, y;
std::cin >> x >> y;
if (x == 0 || y == 0)
continue;
if (x > 0 && y > 0)
Q1.push_back(std::make_pair(x, y));
else if (x > 0 && y < 0)
Q4.push_back(std::make_pair(x, y));
else if (x < 0 && y > 0)
Q2.push_back(std::make_pair(x, y));
else if (x < 0 && y < 0)
Q3.push_back(std::make_pair(x, y));
}
if (Q1.empty() && Q2.empty() && Q3.empty() && Q4.empty())
{
std::cout << "No point in any quadrant\n";
return 0;
}
if (!Q1.empty())
{
auto [bottom_left, upper_right] = find_rectangle(Q1);
std::cout << "Q1: "
<< "(" << bottom_left.first << ", " << bottom_left.second << ") ("
<< upper_right.first << ", " << upper_right.second << ") "
<< (upper_right.first - bottom_left.first) * (upper_right.second - bottom_left.second) << "\n";
}
if (!Q2.empty())
{
auto [bottom_left, upper_right] = find_rectangle(Q2);
std::cout << "Q2: "
<< "(" << bottom_left.first << ", " << bottom_left.second << ") ("
<< upper_right.first << ", " << upper_right.second << ") "
<< (upper_right.first - bottom_left.first) * (upper_right.second - bottom_left.second) << "\n";
}
if (!Q3.empty())
{
auto [bottom_left, upper_right] = find_rectangle(Q3);
std::cout << "Q3: "
<< "(" << bottom_left.first << ", " << bottom_left.second << ") ("
<< upper_right.first << ", " << upper_right.second << ") "
<< (upper_right.first - bottom_left.first) * (upper_right.second - bottom_left.second) << "\n";
}
if (!Q4.empty())
{
auto [bottom_left, upper_right] = find_rectangle(Q4);
std::cout << "Q4: "
<< "(" << bottom_left.first << ", " << bottom_left.second << ") ("
<< upper_right.first << ", " << upper_right.second << ") "
<< (upper_right.first - bottom_left.first) * (upper_right.second - bottom_left.second) << "\n";
}
} |
# 2071017, 2024-11-02 13:46:42, PPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>> n;
vector<pair<int, int>> q1, q2, q3, q4, point;
while(n--){
int x, y;
cin>> x>> y;
if(x==0 || y==0) continue;
point.push_back(make_pair(x, y));
if(x>0 && y>0) q1.push_back(make_pair(x, y));
else if(x<0 && y>0) q2.push_back(make_pair(x, y));
else if(x<0 && y<0) q3.push_back(make_pair(x, y));
else if(x>0 && y<0) q4.push_back(make_pair(x, y));
}
if(point.empty()){
cout<< "No point in any quadrant";
return 0;
}
sort(q1.begin(), q1.end());
sort(q2.begin(), q2.end());
sort(q3.begin(), q3.end());
sort(q4.begin(), q4.end());
int mxx, mnx, mxy, mny;
if(!q1.empty()){
mxx=q1[0].first;
mnx=q1[0].first;
mny=q1[0].second;
mxy=q1[0].second;
}
for(auto e:q1){
mny=min(mny, e.second);
mxx=max(mxx, e.first);
mxy=max(mxy, e.second);
}
if(!q1.empty()){
cout<<"Q1: ("<< mnx<<", "<< mny<< ") ("<< mxx<< ", "<< mxy<< ") "<< abs((mxx-mnx)*(mxy-mny));
cout<<endl;
}
if(!q2.empty()){
mxx=q2[0].first;
mnx=q2[0].first;
mny=q2[0].second;
mxy=q2[0].second;
}
for(auto e:q2){
mny=min(mny, e.second);
mxx=max(mxx, e.first);
mxy=max(mxy, e.second);
}
if(!q2.empty()){
cout<<"Q2: ("<< mnx<<", "<< mny<< ") ("<< mxx<< ", "<< mxy<< ") "<< abs((mxx-mnx)*(mxy-mny));
cout<< endl;
}
if(!q3.empty()){
mxx=q3[0].first;
mnx=q3[0].first;
mny=q3[0].second;
mxy=q3[0].second;
}
for(auto e:q3){
mny=min(mny, e.second);
mxx=max(mxx, e.first);
mxy=max(mxy, e.second);
}
if(!q3.empty()){
cout<<"Q3: ("<< mnx<<", "<< mny<< ") ("<< mxx<< ", "<< mxy<< ") "<< abs((mxx-mnx)*(mxy-mny));
cout<< endl;
}
if(!q4.empty()){
mxx=q4[0].first;
mnx=q4[0].first;
mny=q4[0].second;
mxy=q4[0].second;
}
for(auto e:q4){
mny=min(mny, e.second);
mxx=max(mxx, e.first);
mxy=max(mxy, e.second);
}
if(!q4.empty()){
cout<<"Q4: ("<< mnx<<", "<< mny<< ") ("<< mxx<< ", "<< mxy<< ") "<< abs((mxx-mnx)*(mxy-mny));
}
return 0;
} |
# 2069129, 2024-11-02 10:15:47, PPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std;
using point = pair<long long, long long>;
using quadrant = vector<point>;
bool failed = true;
void coverage(quadrant& quad, int ordinal) {
if (quad.size() == 0) return;
failed = false;
point right_top = {INT64_MIN, INT64_MIN};
point left_bottom = {INT64_MAX, INT64_MAX};
// find boundary
for (auto& dot : quad) {
right_top.first = max(right_top.first, dot.first);
right_top.second = max(right_top.second, dot.second);
left_bottom.first = min(left_bottom.first, dot.first);
left_bottom.second = min(left_bottom.second, dot.second);
}
cout << "Q" << ordinal << ": ";
cout << "(" << left_bottom.first << ", " << left_bottom.second << ") ";
cout << "(" << right_top.first << ", " << right_top.second << ") ";
cout << ((right_top.first - left_bottom.first) * (right_top.second - left_bottom.second)) << '\n';
}
int main() {
int n;
cin >> n;
quadrant q1, q2, q3, q4;
long long x, y;
for (int i = 0; i < n; i++) {
cin >> x >> y;
if (x == 0 || y == 0) continue;
if (x > 0 && y > 0) q1.push_back({x, y});
if (x < 0 && y > 0) q2.push_back({x, y});
if (x < 0 && y < 0) q3.push_back({x, y});
if (x > 0 && y < 0) q4.push_back({x, y});
}
coverage(q1, 1);
coverage(q2, 2);
coverage(q3, 3);
coverage(q4, 4);
if (failed) cout << "No point in any quadrant";
return 0;
} |
# 2069141, 2024-11-02 10:17:37, PPPPPPPPPP (100%)
#include <iostream>
#include <map>
#include <set>
#include <algorithm>
#include <vector>
#include <utility>
#include <string>
#include <cmath>
using namespace std;
int main(){
int n,x,y;
int Q2x,Q2xx,Q2y,Q2yy;
int Q3x,Q3xx,Q3y,Q3yy;
int Q4x,Q4xx,Q4y,Q4yy;
int Q1x,Q1xx,Q1y,Q1yy;
bool q1=false,q2=false,q3=false,q4=false;
cin>>n;
for(int i =0;i<n;i++){
cin>>x>>y;
if(x>0&&y>0){
if(!q1){
Q1x=x;
Q1xx=x;
Q1y=y;
Q1yy=y;
q1=true;
}else{
Q1x=min(x,Q1x);
Q1xx=max(x,Q1xx);
Q1y= min(y,Q1y);
Q1yy=max(y,Q1yy);
}
}else if(x<0&&y>0){
if(!q2){
Q2x=x;
Q2xx=x;
Q2y=y;
Q2yy=y;
q2=true;
}else{
Q2x=min(x,Q2x);
Q2xx=max(x,Q2xx);
Q2y= min(y,Q2y);
Q2yy=max(y,Q2yy);
}
}else if(x<0&&y<0){
if(!q3){
Q3x=x;
Q3xx=x;
Q3y=y;
Q3yy=y;
q3=true;
}else{
Q3x=min(x,Q3x);
Q3xx=max(x,Q3xx);
Q3y= min(y,Q3y);
Q3yy=max(y,Q3yy);
}
}else if(x>0&&y<0){
if(!q4){
Q4x=x;
Q4xx=x;
Q4y=y;
Q4yy=y;
q4=true;
}else{
Q4x=min(x,Q4x);
Q4xx=max(x,Q4xx);
Q4y= min(y,Q4y);
Q4yy=max(y,Q4yy);
}
}
}
if(!(q1||q2||q3||q4)){
cout<<"No point in any quadrant";
}else{
if(q1){
cout<<"Q1: ("<<Q1x<<", "<<Q1y<<") ("<<Q1xx<<", "<<Q1yy<<") "
<<(Q1xx-Q1x)*(Q1yy-Q1y)<<endl;
}
if(q2){
cout<<"Q2: ("<<Q2x<<", "<<Q2y<<") ("<<Q2xx<<", "<<Q2yy<<") "
<<(Q2xx-Q2x)*(Q2yy-Q2y)<<endl;
}
if(q3){
cout<<"Q3: ("<<Q3x<<", "<<Q3y<<") ("<<Q3xx<<", "<<Q3yy<<") "
<<(Q3xx-Q3x)*(Q3yy-Q3y)<<endl;
}
if(q4){
cout<<"Q4: ("<<Q4x<<", "<<Q4y<<") ("<<Q4xx<<", "<<Q4yy<<") "
<<(Q4xx-Q4x)*(Q4yy-Q4y)<<endl;
}
}
return 0;
} |
# 2069191, 2024-11-02 10:24:12, PPPPPPPPPP (100%)
#include<iostream>
#include<bits/stdc++.h>
#include<cmath>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
using namespace std;
int main(){
int N;
int x_i,y_i;
cin>>N;
vector<pair<int,int>> q1,q2,q3,q4;
for(int i=0;i<N;i++){
cin>>x_i>>y_i;
if(x_i==0 || y_i ==0 ){continue;}
if(x_i>0 && y_i>0){
q1.push_back({x_i,y_i});
}else if(x_i<0 && y_i>0){
q2.push_back({x_i,y_i});
}else if(x_i<0 && y_i<0){
q3.push_back({x_i,y_i});
}else if(x_i>0 && y_i<0){
q4.push_back({x_i,y_i});
}
}
if(q1.empty()&&q2.empty()&&q3.empty()&&q4.empty()){
cout<<"No point in any quadrant";
return 0;
}
if(!q1.empty()){
set<int> x,y;
for(int i=0;i<q1.size();i++){
x.insert(q1[i].first);
y.insert(q1[i].second);
}
int area=abs(*(x.rbegin())-*(x.begin()))*abs(*(y.rbegin())-*(y.begin()));
cout<<"Q1: ("<<*(x.begin())<<", "<<*(y.begin())<<")"<<" ";
cout<<" ("<<*(x.rbegin())<<", "<<*(y.rbegin())<<")"<<" ";
cout<<area<<endl;
}
if(!q2.empty()){
set<int> x,y;
for(int i=0;i<q2.size();i++){
x.insert(q2[i].first);
y.insert(q2[i].second);
}
int area=abs(*(x.rbegin())-*(x.begin()))*abs(*(y.rbegin())-*(y.begin()));
cout<<"Q2: ("<<*(x.begin())<<", "<<*(y.begin())<<")"<<" ";
cout<<" ("<<*(x.rbegin())<<", "<<*(y.rbegin())<<")"<<" ";
cout<<area<<endl;
}
if(!q3.empty()){
set<int> x,y;
for(int i=0;i<q3.size();i++){
x.insert(q3[i].first);
y.insert(q3[i].second);
}
int area=abs(*(x.rbegin())-*(x.begin()))*abs(*(y.rbegin())-*(y.begin()));
cout<<"Q3: ("<<*(x.begin())<<", "<<*(y.begin())<<")"<<" ";
cout<<" ("<<*(x.rbegin())<<", "<<*(y.rbegin())<<")"<<" ";
cout<<area<<endl;
}
if(!q4.empty()){
set<int> x,y;
for(int i=0;i<q4.size();i++){
x.insert(q4[i].first);
y.insert(q4[i].second);
}
int area=abs(*(x.rbegin())-*(x.begin()))*abs(*(y.rbegin())-*(y.begin()));
cout<<"Q4: ("<<*(x.begin())<<", "<<*(y.begin())<<")"<<" ";
cout<<" ("<<*(x.rbegin())<<", "<<*(y.rbegin())<<")"<<" ";
cout<<area;
}
} |
# 2070756, 2024-11-02 13:12:54, PPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
int main(){
pair<int,int> point;
set<pair<int,int>> q1,q2,q3,q4;
int n;
cin>>n;
int x,y;
for(int i=0;i<n;i++){
cin>>x>>y;
if(x>0&&y>0) q1.insert(make_pair(x,y));
else if(x<0&&y<0)q3.insert(make_pair(x,y));
else if(x<0&&y>0)q2.insert(make_pair(x,y));
else if(x>0&&y<0)q4.insert(make_pair(x,y));
}
if(q1.empty()&&q2.empty()&&q3.empty()&&q4.empty()){cout<<"No point in any quadrant";return 0;}
if(!q1.empty()){
int xmax=INT_MIN,ymax=INT_MIN;
int xmin=INT_MAX,ymin=INT_MAX;
for(auto i:q1){
xmax=max(xmax,i.first);
xmin=min(xmin,i.first);
ymax=max(ymax,i.second);
ymin=min(ymin,i.second);
}
cout<<"Q1: ("<<xmin<<", "<<ymin<<") ("<<xmax<<", "<<ymax<<") ";
cout<<abs(xmax-xmin)*abs(ymax-ymin)<<endl;
}
if(!q2.empty()){
int xmax=INT_MIN,ymax=INT_MIN;
int xmin=INT_MAX,ymin=INT_MAX;
for(auto i:q2){
xmax=max(xmax,i.first);
xmin=min(xmin,i.first);
ymax=max(ymax,i.second);
ymin=min(ymin,i.second);
}
cout<<"Q2: ("<<xmin<<", "<<ymin<<") ("<<xmax<<", "<<ymax<<") ";
cout<<abs(xmax-xmin)*abs(ymax-ymin)<<endl;
}
if(!q3.empty()){
int xmax=INT_MIN,ymax=INT_MIN;
int xmin=INT_MAX,ymin=INT_MAX;
for(auto i:q3){
xmax=max(xmax,i.first);
xmin=min(xmin,i.first);
ymax=max(ymax,i.second);
ymin=min(ymin,i.second);
}
cout<<"Q3: ("<<xmin<<", "<<ymin<<") ("<<xmax<<", "<<ymax<<") ";
cout<<abs(xmax-xmin)*abs(ymax-ymin)<<endl;
}
if(!q4.empty()){
int xmax=INT_MIN,ymax=INT_MIN;
int xmin=INT_MAX,ymin=INT_MAX;
for(auto i:q4){
xmax=max(xmax,i.first);
xmin=min(xmin,i.first);
ymax=max(ymax,i.second);
ymin=min(ymin,i.second);
}
cout<<"Q4: ("<<xmin<<", "<<ymin<<") ("<<xmax<<", "<<ymax<<") ";
cout<<abs(xmax-xmin)*abs(ymax-ymin)<<endl;
}
return 0;
} |
# 2068875, 2024-11-02 09:49:45, PPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
int x, y;
// set
set<int> x_Q1;
set<int> x_Q2;
set<int> x_Q3;
set<int> x_Q4;
set<int> y_Q1;
set<int> y_Q2;
set<int> y_Q3;
set<int> y_Q4;
for (int i = 0; i < n; i++)
{
cin >> x >> y;
if (x > 0)
{
if (y > 0)
{
// Q1
x_Q1.insert(x);
y_Q1.insert(y);
} else if (y < 0)
{
// Q4
x_Q4.insert(x);
y_Q4.insert(y);
}
} else if (x < 0)
{
if (y > 0)
{
// Q2
x_Q2.insert(x);
y_Q2.insert(y);
} else if (y < 0)
{
// Q3
x_Q3.insert(x);
y_Q3.insert(y);
}
}
}
if (x_Q1.size() == 0 && x_Q2.size() == 0 && x_Q3.size() == 0 && x_Q4.size() == 0 && y_Q1.size() == 0 && y_Q2.size() == 0 && y_Q3.size() == 0 && y_Q4.size() == 0)
{
cout << "No point in any quadrant";
} else
{
if (x_Q1.size() != 0)
{
auto a = x_Q1.begin();
auto b = y_Q1.begin();
auto c = --x_Q1.end();
auto d = --y_Q1.end();
int n = (*c-*a) * (*d-*b);
cout << "Q1: ";
cout << '(' << *a << ", " << *b << ") (" << *c << ", " << *d << ") " << n;
cout << endl;
}
if (x_Q2.size() != 0)
{
auto a = x_Q2.begin();
auto b = y_Q2.begin();
auto c = --x_Q2.end();
auto d = --y_Q2.end();
int n = (*c-*a) * (*d-*b);
cout << "Q2: ";
cout << '(' << *a << ", " << *b << ") (" << *c << ", " << *d << ") " << n;
cout << endl;
}
if (x_Q3.size() != 0)
{
auto a = x_Q3.begin();
auto b = y_Q3.begin();
auto c = --x_Q3.end();
auto d = --y_Q3.end();
int n = (*c-*a) * (*d-*b);
cout << "Q3: ";
cout << '(' << *a << ", " << *b << ") (" << *c << ", " << *d << ") " << n;
cout << endl;
}
if (x_Q4.size() != 0)
{
auto a = x_Q4.begin();
auto b = y_Q4.begin();
auto c = --x_Q4.end();
auto d = --y_Q4.end();
int n = (*c-*a) * (*d-*b);
cout << "Q4: ";
cout << '(' << *a << ", " << *b << ") (" << *c << ", " << *d << ") " << n;
cout << endl;
}
}
} |
# 2069063, 2024-11-02 10:08:40, PPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define first F
#define second S
bool check[5]={0,0,0,0,0};
bool chk=0;
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
long long n,x,y;
long long mx_x[5];
long long mn_x[5];
long long mx_y[5];
long long mn_y[5];
cin>>n;
while(n--){
cin>>x>>y;
if(x>0&&y>0){
if(check[1]==0){
check[1]=1;
mx_x[1]= x;
mn_x[1]= x;
mx_y[1]= y;
mn_y[1]= y;
}else{
mx_x[1]= max(mx_x[1],x);
mn_x[1]= min(mn_x[1],x);
mx_y[1]= max(mx_y[1],y);
mn_y[1]= min(mn_y[1],y);
}
}else if(x<0&&y>0){
if(check[2]==0){
check[2]=1;
mx_x[2]= x;
mn_x[2]= x;
mx_y[2]= y;
mn_y[2]= y;
}else{
mx_x[2]= max(mx_x[2],x);
mn_x[2]= min(mn_x[2],x);
mx_y[2]= max(mx_y[2],y);
mn_y[2]= min(mn_y[2],y);
}
}else if(x<0&&y<0){
if(check[3]==0){
check[3]=1;
mx_x[3]= x;
mn_x[3]= x;
mx_y[3]= y;
mn_y[3]= y;
}else{
mx_x[3]= max(mx_x[3],x);
mn_x[3]= min(mn_x[3],x);
mx_y[3]= max(mx_y[3],y);
mn_y[3]= min(mn_y[3],y);
}
}else if(x>0&&y<0){
if(check[4]==0){
check[4]=1;
mx_x[4]= x;
mn_x[4]= x;
mx_y[4]= y;
mn_y[4]= y;
}else{
mx_x[4]= max(mx_x[4],x);
mn_x[4]= min(mn_x[4],x);
mx_y[4]= max(mx_y[4],y);
mn_y[4]= min(mn_y[4],y);
}
}
}
for(int i=1;i<=4;i++){
if(check[i]==0){
continue;
}
chk=1;
cout<<"Q"<<i<<": ("<<mn_x[i]<<", "<<mn_y[i]<<") ("<<mx_x[i]<<", "<<mx_y[i]<<") "<<(mx_x[i]-mn_x[i])*(mx_y[i]-mn_y[i])<<endl;
}
if(chk==0){
cout<<"No point in any quadrant";
}
return 0;
} |
# 2070348, 2024-11-02 12:04:53, PPPPPPPPPP (100%)
#include<iostream>
#include<vector>
using namespace std ;
int main()
{
int n , x , y ; cin >> n ;
vector<pair<int , int>> Q1 , Q2 , Q3 , Q4 ;
vector<int> everydot , dotQ1 , dotQ2 , dotQ3 , dotQ4 ;
while(n--) {
cin >> x >> y ;
if(x > 0 && y > 0) {
Q1.push_back({x , y}) ;
everydot.push_back(x) ;
everydot.push_back(y) ;
dotQ1.push_back(x) ;
}
if(x < 0 && y > 0) {
Q2.push_back({x , y}) ;
everydot.push_back(x) ;
everydot.push_back(y) ;
dotQ2.push_back(x) ;
}
if(x < 0 && y < 0) {
Q3.push_back({x , y}) ;
everydot.push_back(x) ;
everydot.push_back(y) ;
dotQ3.push_back(x) ;
}
if(x > 0 && y < 0) {
Q4.push_back({x , y}) ;
everydot.push_back(x) ;
everydot.push_back(y) ;
dotQ4.push_back(x) ;
}
}
vector<int> square , x_min , x_max , y_min , y_max ;
int xmin = 0 , xmax = 0 , ymin = 0 , ymax = 0 ;
int count = 0 ;
for(auto q : Q1) {
if(count == 0) {
xmin = xmax = q.first ;
ymin = ymax = q.second ;
}
xmin = min(xmin , q.first) ;
xmax = max(xmax , q.first) ;
ymin = min(ymin , q.second) ;
ymax = max(ymax , q.second) ;
count = 1 ;
}
count = 0 ;
x_min.push_back(xmin) ;
x_max.push_back(xmax) ;
y_min.push_back(ymin) ;
y_max.push_back(ymax) ;
int area = 0 ;
area = (xmax - xmin) * (ymax - ymin) ;
square.push_back(area) ;
// ----------------------------------------- //
for(auto q : Q2) {
if(count == 0) {
xmin = xmax = q.first ;
ymin = ymax = q.second ;
}
xmin = min(xmin , q.first) ;
xmax = max(xmax , q.first) ;
ymin = min(ymin , q.second) ;
ymax = max(ymax , q.second) ;
count = 1 ;
}
count = 0 ;
x_min.push_back(xmin) ;
x_max.push_back(xmax) ;
y_min.push_back(ymin) ;
y_max.push_back(ymax) ;
area = 0 ;
area = (xmax - xmin) * (ymax - ymin) ;
square.push_back(area) ;
// ----------------------------------------- //
for(auto q : Q3) {
if(count == 0) {
xmin = xmax = q.first ;
ymin = ymax = q.second ;
}
xmin = min(xmin , q.first) ;
xmax = max(xmax , q.first) ;
ymin = min(ymin , q.second) ;
ymax = max(ymax , q.second) ;
count = 1 ;
}
count = 0 ;
x_min.push_back(xmin) ;
x_max.push_back(xmax) ;
y_min.push_back(ymin) ;
y_max.push_back(ymax) ;
area = 0 ;
area = (xmax - xmin) * (ymax - ymin) ;
square.push_back(area) ;
// ----------------------------------------- //
for(auto q : Q4) {
if(count == 0) {
xmin = xmax = q.first ;
ymin = ymax = q.second ;
}
xmin = min(xmin , q.first) ;
xmax = max(xmax , q.first) ;
ymin = min(ymin , q.second) ;
ymax = max(ymax , q.second) ;
count = 1 ;
}
count = 0 ;
x_min.push_back(xmin) ;
x_max.push_back(xmax) ;
y_min.push_back(ymin) ;
y_max.push_back(ymax) ;
area = 0 ;
area = (xmax - xmin) * (ymax - ymin) ;
square.push_back(area) ;
if(everydot.size() >= 1)
for(auto s : square) {
if (count == 0 && dotQ1.size() >= 1) cout << "Q1: (" << x_min[count] << ", " << y_min[count] << ") (" << x_max[count] << ", " << y_max[count] << ") " << s << endl ;
if (count == 1 && dotQ2.size() >= 1) cout << "Q2: (" << x_min[count] << ", " << y_min[count] << ") (" << x_max[count] << ", " << y_max[count] << ") " << s << endl ;
if (count == 2 && dotQ3.size() >= 1) cout << "Q3: (" << x_min[count] << ", " << y_min[count] << ") (" << x_max[count] << ", " << y_max[count] << ") " << s << endl ;
if (count == 3 && dotQ4.size() >= 1) cout << "Q4: (" << x_min[count] << ", " << y_min[count] << ") (" << x_max[count] << ", " << y_max[count] << ") " << s << endl ;
count ++ ;
}
else cout << "No point in any quadrant" << endl ;
} |
# 2069644, 2024-11-02 11:06:56, PPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
vector<vector<pair<int,int>>> q(5, vector<pair<int,int>>());
for(int i=0; i<n; i++){
int x, y;
cin >> x >> y;
if(x > 0 && y > 0){ q[1].push_back({x,y}); }
else if(x < 0 && y > 0){ q[2].push_back({-x,y}); }
else if(x < 0 && y < 0){ q[3].push_back({-x,-y}); }
else if(x > 0 && y < 0){ q[4].push_back({x,-y}); }
}
bool found = false;
for(int i=1; i<=4; i++){
int maxX = 0, minX = INT_MAX, maxY = 0, minY = INT_MAX;
for(auto [x,y]: q[i]){
maxX = max(maxX, x);
minX = min(minX, x);
maxY = max(maxY, y);
minY = min(minY, y);
}
if(maxX == 0 || minX == INT_MAX || maxY == 0 || minY == INT_MAX){
continue;
}
found = true;
int area = (maxX - minX)*(maxY - minY);
cout << "Q" << i << ":";
if(i == 2){
maxX = -maxX;
minX = -minX;
swap(minX, maxX);
}else if(i == 3){
maxX = -maxX;
minX = -minX;
maxY = -maxY;
minY = -minY;
swap(minX, maxX);
swap(minY, maxY);
}else if(i == 4){
maxY = -maxY;
minY = -minY;
swap(minY, maxY);
}
cout << " ("<<minX << ", " << minY << ")" << " ("<<maxX << ", " << maxY << ") ";
cout << area << "\n";
}
if(!found){ cout << "No point in any quadrant"; }
} |
# 2069513, 2024-11-02 10:54:16, PPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std ;
int main () {
vector<pair<int ,int>> q1 ;
vector<pair<int ,int>> q2 ;
vector<pair<int ,int>> q3 ;
vector<pair<int ,int>> q4 ;
int k ;
int a ,b ;
cin >> k;
while (k--){
cin >> a >> b ;
if (a==0 || b==0){
continue ;
}
if (a<0 && b>0){
q2.push_back(make_pair(a,b)) ;
} else if (a>0 && b>0) {
q1.push_back(make_pair(a,b)) ;
} else if (a<0 && b<0) {
q3.push_back(make_pair(a,b)) ;
} else if (a>0 && b<0) {
q4.push_back(make_pair(a,b)) ;
}
}
bool found1 = false ;
bool found2 = false ;
bool found3 = false ;
bool found4 = false ;
int maxintx = -999999 ;
int maxinty = -999999 ;
int minintx = 999999 ;
int mininty = 999999 ;
if (q1.size() != 0){
found1 = true ;
for (auto e : q1) {
if (e.first >= maxintx) {
maxintx = e.first ;
}
if (e.second >= maxinty) {
maxinty = e.second ;
}
if (e.first <= minintx) {
minintx = e.first ;
}
if (e.second <= mininty) {
mininty = e.second ;
}
}
int o = maxintx - minintx ;
int p = maxinty - mininty ;
int ans = o*p ;
cout << "Q1: (" << minintx << ", " << mininty << ") (" << maxintx << ", " << maxinty << ") " << ans << endl ;
}
// for (auto e : q2) {
// cout << e.first << " " << e.second << endl ;
// }
maxintx = -999999 ;
maxinty = -999999 ;
minintx = 999999 ;
mininty = 999999 ;
if (q2.size() != 0){
found2 = true ;
for (auto e : q2) {
if (e.first >= maxintx) {
maxintx = e.first ;
}
if (e.second >= maxinty) {
maxinty = e.second ;
}
if (e.first <= minintx) {
minintx = e.first ;
}
if (e.second <= mininty) {
mininty = e.second ;
}
}
int o = maxintx - minintx ;
int p = maxinty - mininty ;
int ans = o*p ;
cout << "Q2: (" << minintx << ", " << mininty << ") (" << maxintx << ", " << maxinty << ") " << ans << endl ;
}
maxintx = -999999 ;
maxinty = -999999 ;
minintx = 999999 ;
mininty = 999999 ;
if (q3.size() != 0){
found3 = true ;
for (auto e : q3) {
if (e.first >= maxintx) {
maxintx = e.first ;
}
if (e.second >= maxinty) {
maxinty = e.second ;
}
if (e.first <= minintx) {
minintx = e.first ;
}
if (e.second <= mininty) {
mininty = e.second ;
}
}
int o = maxintx - minintx ;
int p = maxinty - mininty ;
int ans = o*p ;
cout << "Q3: (" << minintx << ", " << mininty << ") (" << maxintx << ", " << maxinty << ") " << ans << endl ;
}
maxintx = -999999 ;
maxinty = -999999 ;
minintx = 999999 ;
mininty = 999999 ;
if (q4.size() != 0){
found4 = true ;
for (auto e : q4) {
if (e.first >= maxintx) {
maxintx = e.first ;
}
if (e.second >= maxinty) {
maxinty = e.second ;
}
if (e.first <= minintx) {
minintx = e.first ;
}
if (e.second <= mininty) {
mininty = e.second ;
}
}
int o = maxintx - minintx ;
int p = maxinty - mininty ;
int ans = o*p ;
cout << "Q4: (" << minintx << ", " << mininty << ") (" << maxintx << ", " << maxinty << ") " << ans << endl ;
}
if (found1 == false && found2 == false && found3 == false && found4 == false) {
cout << "No point in any quadrant" ;
}
} |
# 2070973, 2024-11-02 13:40:18, PPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std;
vector<pair<int,int>> Q1;
vector<pair<int,int>> Q2;
vector<pair<int,int>> Q3;
vector<pair<int,int>> Q4;
int main(){
int num;
cin >> num;
while (num--)
{
int x,y;
cin >> x >> y;
if ((x==0) || (y==0) )
{
//not in any Q
}
else if ((x > 0) && (y > 0)){ //Q1
Q1.emplace_back(x,y);
}
else if ((x < 0) && (y > 0)){ //Q2
Q2.emplace_back(x,y);
}
else if ((x < 0) && (y < 0)){ //Q3
Q3.emplace_back(x,y);
}
else if ((x > 0) && (y < 0)){ //Q4
Q4.emplace_back(x,y);
}
}
if (Q1.size()!=0){
int Leftmost = INT_MAX;
int Rightmost = 0;
int Highest = 0;
int Lowest = INT_MAX;
for (auto c : Q1)
{
Rightmost = max(Rightmost,c.first);
Highest = max(Highest,c.second);
Leftmost = min(Leftmost,c.first);
Lowest = min(Lowest,c.second);
}
int space = (abs(Rightmost-Leftmost)*abs(Highest-Lowest));
cout << "Q1: " << "(" << Leftmost << ", "<< Lowest << ") (" <<Rightmost<< ", " << Highest << ") " << space << endl;
}
if (Q2.size()!=0){
int Leftmost = INT_MAX;
int Rightmost = INT_MIN;
int Highest = 0;
int Lowest = INT_MAX;
for (auto c : Q2)
{
Rightmost = max(Rightmost,c.first);
Highest = max(Highest,c.second);
Leftmost = min(Leftmost,c.first);
Lowest = min(Lowest,c.second);
}
int space = (abs(Rightmost-Leftmost)*abs(Highest-Lowest));
cout << "Q2: " << "(" << Leftmost << ", "<< Lowest << ") (" <<Rightmost<< ", " << Highest << ") " << space << endl;
}
if (Q3.size()!=0){
int Leftmost = INT_MAX;
int Rightmost = INT_MIN;
int Highest = INT_MIN;
int Lowest = INT_MAX;
for (auto c : Q3)
{
Rightmost = max(Rightmost,c.first);
Highest = max(Highest,c.second);
Leftmost = min(Leftmost,c.first);
Lowest = min(Lowest,c.second);
}
int space = (abs(Rightmost-Leftmost)*abs(Highest-Lowest));
cout << "Q3: " << "(" << Leftmost << ", "<< Lowest << ") (" <<Rightmost<< ", " << Highest << ") " << space << endl;
}
if (Q4.size()!=0){
int Leftmost = INT_MAX;
int Rightmost = INT_MIN;
int Highest = INT_MIN;
int Lowest = INT_MAX;
for (auto c : Q4)
{
Rightmost = max(Rightmost,c.first);
Highest = max(Highest,c.second);
Leftmost = min(Leftmost,c.first);
Lowest = min(Lowest,c.second);
}
int space = (abs(Rightmost-Leftmost)*abs(Highest-Lowest));
cout << "Q4: " << "(" << Leftmost << ", "<< Lowest << ") (" <<Rightmost<< ", " << Highest << ") " << space << endl;
}
if ((Q1.size() == 0)&&(Q2.size() == 0)&&(Q3.size() == 0)&&(Q4.size() == 0)){
cout << "No point in any quadrant";
}
} |
# 2070856, 2024-11-02 13:25:40, PPPPPPPPPP (100%)
#include<bits/stdc++.h>
#define endl "\n"
using namespace std;
int main(){
vector<pair<int,int>> Q1,Q2,Q3,Q4;
int n,x,y,maxX=-1000000,maxY=-1000000,minX=1e9,minY=1e9,area;
cin >> n;
for(int i=0;i<n;i++){
cin >> x >> y;
if(x>0&& y>0){
Q1.push_back(make_pair(x,y));
}
else if(x<0&& y>0){
Q2.push_back(make_pair(x,y));
}
else if(x<0&& y<0){
Q3.push_back(make_pair(x,y));
}
else if(x>0&& y<0){
Q4.push_back(make_pair(x,y));
}
}
if(Q1.empty()&&Q2.empty()&&Q3.empty()&&Q4.empty()){
cout << "No point in any quadrant" << endl;
return 0;
}
for(auto x:Q1){
if(x.first>maxX){
maxX=x.first;
}
if(x.first<minX){
minX=x.first;
}
if(x.second>maxY){
maxY=x.second;
}
if(x.second<minY){
minY=x.second;
}
}
if(!Q1.empty()){
cout << "Q1: " << "(" << minX << ", " << minY << ") " << "(" << maxX << ", " << maxY << ") " << abs(minX-maxX)*abs(minY-maxY) << endl;
}
maxX=-1000000,maxY=-1000000,minX=1e9,minY=1e9;
for(auto x:Q2){
if(x.first>maxX){
maxX=x.first;
}
if(x.first<minX){
minX=x.first;
}
if(x.second>maxY){
maxY=x.second;
}
if(x.second<minY){
minY=x.second;
}
}
if(!Q2.empty()){
cout << "Q2: " << "(" << minX << ", " << minY << ") " << "(" << maxX << ", " << maxY << ") " << abs(minX-maxX)*abs(minY-maxY) << endl;
}
maxX=-100000,maxY=-100000,minX=0,minY=0;
for(auto x:Q3){
if(x.first>maxX){
maxX=x.first;
}
if(x.first<minX){
minX=x.first;
}
if(x.second>maxY){
maxY=x.second;
}
if(x.second<minY){
minY=x.second;
}
}
if(!Q3.empty()){
cout << "Q3: " << "(" << minX << ", " << minY << ") " << "(" << maxX << ", " << maxY << ") " << abs(minX-maxX)*abs(minY-maxY) << endl;
}
maxX=-1000000,maxY=-1000000,minX=1e9,minY=1e9;
for(auto x:Q4){
if(x.first>maxX){
maxX=x.first;
}
if(x.first<minX){
minX=x.first;
}
if(x.second>maxY){
maxY=x.second;
}
if(x.second<minY){
minY=x.second;
}
}
if(!Q4.empty()){
cout << "Q4: " << "(" << minX << ", " << minY << ") " << "(" << maxX << ", " << maxY << ") " << abs(minX-maxX)*abs(minY-maxY) << endl;
}
return 0;
} |
# 2069323, 2024-11-02 10:36:27, PPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std;
int main()
{
vector<int> q1x;
vector<int> q2x;
vector<int> q3x;
vector<int> q4x;
vector<int> q1y;
vector<int> q2y;
vector<int> q3y;
vector<int> q4y;
int check[10],ch=0;
int n;
cin >> n;
for(int i = 1;i<=n;i++)
{
int x,y;
cin >> x >> y;
if(x>0&&y>0)
{
q1x.push_back(x);
q1y.push_back(y);
check[1]=1;
}
if(x<0&&y>0)
{
q2x.push_back(x);
q2y.push_back(y);
check[2]=1;
}
if(x<0&&y<0)
{
q3x.push_back(x);
q3y.push_back(y);
check[3]=1;
}
if(x>0&&y<0)
{
q4x.push_back(x);
q4y.push_back(y);
check[4]=1;
}
}
for(int i = 1;i<=4;i++)
{
if(check[i]==1)
{
if(i==1)
{
sort(q1x.begin(),q1x.end());
sort(q1y.begin(),q1y.end());
cout << "Q1: (" << q1x[0] << ", "<< q1y[0] << ")";
cout << " (" << q1x[q1x.size()-1] << ", " << q1y[q1y.size()-1] << ")";
cout << " " << (q1x[q1x.size()-1]-q1x[0])*(q1y[q1y.size()-1]-q1y[0]);
}
if(i==2)
{
sort(q2x.begin(),q2x.end());
sort(q2y.begin(),q2y.end());
cout << "Q2: (" << q2x[0] << ", "<< q2y[0] << ")";
cout << " (" << q2x[q2x.size()-1] << ", " << q2y[q2y.size()-1] << ")";
cout << " " << abs(q2x[q2x.size()-1]-q2x[0])*(q2y[q2y.size()-1]-q2y[0]);
}
if(i==3)
{
sort(q3x.begin(),q3x.end());
sort(q3y.begin(),q3y.end());
cout << "Q3: (" << q3x[0] << ", "<< q3y[0] << ")";
cout << " (" << q3x[q3x.size()-1] << ", " << q3y[q3y.size()-1] << ")";
cout << " " << abs(q3x[q3x.size()-1]-q3x[0])*(q3y[q3y.size()-1]-q3y[0]);
}
if(i==4)
{
sort(q4x.begin(),q4x.end());
sort(q4y.begin(),q4y.end());
cout << "Q4: (" << q4x[0] << ", "<< q4y[0] << ")";
cout << " (" << q4x[q4x.size()-1] << ", " << q4y[q4y.size()-1] << ")";
cout << " " << abs(q4x[q4x.size()-1]-q4x[0])*(q4y[q4y.size()-1]-q4y[0]);
}
cout << "\n";ch++;
}
}
if(ch==0) cout << "No point in any quadrant";
return 0;
} |
# 2069171, 2024-11-02 10:21:32, PPPPPPPPPP (100%)
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
int main() {
int n; cin >> n;
vector<pair<int, int>> Q[5];
bool exist[5] = {false};
string input;
int x, y;
for (int i = 0; i < n; i++){
cin >> x >> y;
if (x > 0 && y > 0) {
Q[1].push_back({x,y});
exist[1] = true;
}
else if (x < 0 && y > 0) {
Q[2].push_back({x,y});
exist[2] = true;
}
else if (x < 0 && y < 0) {
Q[3].push_back({x,y});
exist[3] = true;
}
else if (x > 0 && y < 0) {
Q[4].push_back({x,y});
exist[4] = true;
}
}
// find max x;
bool emp = true;
for (auto a: exist) if (a) emp = false;
if (emp) {
cout << "No point in any quadrant" << endl;
}
for (int i=1; i <= 4; i++) {
if (exist[i]){
int rx = max_element(Q[i].begin(), Q[i].end(),
[](pair<int, int> a, pair<int, int> b){
return a.first < b.first; })->first;
int ry = max_element(Q[i].begin(), Q[i].end(),
[](pair<int, int> a, pair<int, int> b){
return a.second < b.second; })->second;
int lx = max_element(Q[i].begin(), Q[i].end(),
[](pair<int, int> a, pair<int, int> b){
return a.first > b.first; })->first;
int ly = max_element(Q[i].begin(), Q[i].end(),
[](pair<int, int> a, pair<int, int> b){
return a.second > b.second; })->second;
cout << "Q" << i << ": (" <<
lx << ", " <<
ly << ") (" <<
rx << ", " << ry << ") " << abs(ry-ly)*abs(rx-lx) << endl;
}
}
} |
# 2069896, 2024-11-02 11:34:17, PPPPPPPPPP (100%)
#include <iostream>
#include <vector>
#include <tuple>
using namespace std;
int maxx(vector<pair<int,int>>q){
int m=q[0].first;
for(int i=1;i<q.size();i++){
if(q[i].first>m)
m=q[i].first;
}
return m;
}
int minx(vector<pair<int,int>>q){
int m=q[0].first;
for(int i=1;i<q.size();i++){
if(q[i].first<m)
m=q[i].first;
}
return m;
}
int maxy(vector<pair<int,int>>q){
int m=q[0].second;
for(int i=1;i<q.size();i++){
if(q[i].second>m)
m=q[i].second;
}
return m;
}
int miny(vector<pair<int,int>>q){
int m=q[0].second;
for(int i=1;i<q.size();i++){
if(q[i].second<m)
m=q[i].second;
}
return m;
}
int main(){
vector<pair<int,int>>point;
int n;cin>>n;
for(int i=0;i<n;i++){
int a,b;
cin>>a>>b;
point.push_back(make_pair(a,b));
}
vector<pair<int,int>>q1,q2,q3,q4;
for(auto e:point){
if(e.first>0&&e.second>0)
q1.push_back(make_pair(e.first,e.second));
else if(e.first<0&&e.second>0)
q2.push_back(make_pair(e.first,e.second));
else if(e.first<0&&e.second<0)
q3.push_back(make_pair(e.first,e.second));
else if(e.first>0&&e.second<0)
q4.push_back(make_pair(e.first,e.second));
}
if(!q1.empty()){
cout <<"Q1: ";
cout <<"("<<minx(q1)<<", "<<miny(q1)<<")"<<" ";
cout <<"("<<maxx(q1)<<", "<<maxy(q1)<<")"<<" ";
cout <<(maxx(q1)-minx(q1))*(maxy(q1)-miny(q1))<<endl;
}
if(!q2.empty()){
cout <<"Q2: ";
cout <<"("<<minx(q2)<<", "<<miny(q2)<<")"<<" ";
cout <<"("<<maxx(q2)<<", "<<maxy(q2)<<")"<<" ";
cout <<(maxx(q2)-minx(q2))*(maxy(q2)-miny(q2))<<endl;
}
if(!q3.empty()){
cout <<"Q3: ";
cout <<"("<<minx(q3)<<", "<<miny(q3)<<")"<<" ";
cout <<"("<<maxx(q3)<<", "<<maxy(q3)<<")"<<" ";
cout <<(maxx(q3)-minx(q3))*(maxy(q3)-miny(q3))<<endl;
}
if(!q4.empty()){
cout <<"Q4: ";
cout <<"("<<minx(q4)<<", "<<miny(q4)<<")"<<" ";
cout <<"("<<maxx(q4)<<", "<<maxy(q4)<<")"<<" ";
cout <<(maxx(q4)-minx(q4))*(maxy(q4)-miny(q4))<<endl;
}
if(q1.empty()&&q2.empty()&&q3.empty()&&q4.empty())
cout <<"No point in any quadrant";
} |
# 2070750, 2024-11-02 13:11:55, PPPPPPPPPP (100%)
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
int n;
cin >> n;
vector<int> q1x,q2x,q3x,q4x;
vector<int> q1y,q2y,q3y,q4y;
for (int i = 0; i < n; i++)
{
int x,y;
cin >> x >>y;
if (x>0&&y>0)
{
q1x.push_back(x);
q1y.push_back(y);
}
else if (x<0&&y>0)
{
q2x.push_back(x);
q2y.push_back(y);
}
else if (x<0&&y<0)
{
q3x.push_back(x);
q3y.push_back(y);
}
else if (x>0&&y<0)
{
q4x.push_back(x);
q4y.push_back(y);
}
}
sort(q1x.begin(),q1x.end());
sort(q1y.begin(),q1y.end());
sort(q2x.begin(),q2x.end());
sort(q2y.begin(),q2y.end());
sort(q3x.begin(),q3x.end());
sort(q3y.begin(),q3y.end());
sort(q4x.begin(),q4x.end());
sort(q4y.begin(),q4y.end());
/*
for (int i = 0; i < q1x.size(); i++)
{
cout<<q1x[i]<<" ";
}
cout<< endl;
for (int i = 0; i < q1y.size(); i++)
{
cout<<q1y[i]<<" ";
}
*/
bool f = false;
if (q1x.size() != 0 && q1y.size() != 0)
{
f = true;
cout<<"Q1: ";
cout<<"("<<*q1x.begin()<<", "<<*q1y.begin()<<")";
cout<<" ";
cout<<"("<<q1x[q1x.size() - 1]<<", "<<q1y[q1y.size() - 1]<<") ";
cout<<(q1x[q1x.size() - 1] - *q1x.begin()) * (q1y[q1y.size() - 1] - *q1y.begin())<<endl;
}
if (q2x.size() != 0 && q2y.size() != 0)
{
f = true;
cout<<"Q2: ";
cout<<"("<<*q2x.begin()<<", "<<*q2y.begin()<<")";
cout<<" ";
cout<<"("<<q2x[q2x.size() - 1]<<", "<<q2y[q2y.size() - 1]<<") ";
cout<<(q2x[q2x.size() - 1] - *q2x.begin()) * (q2y[q2y.size() - 1] - *q2y.begin())<<endl;
}
if (q3x.size() != 0 && q3y.size() != 0)
{
f = true;
cout<<"Q3: ";
cout<<"("<<*q3x.begin()<<", "<<*q3y.begin()<<")";
cout<<" ";
cout<<"("<<q3x[q3x.size() - 1]<<", "<<q3y[q3y.size() - 1]<<") ";
cout<<(q3x[q3x.size() - 1] - *q3x.begin()) * (q3y[q3y.size() - 1] - *q3y.begin())<<endl;
}
if (q4x.size() != 0 && q4y.size() != 0)
{
f = true;
cout<<"Q4: ";
cout<<"("<<*q4x.begin()<<", "<<*q4y.begin()<<")";
cout<<" ";
cout<<"("<<q4x[q4x.size() - 1]<<", "<<q4y[q4y.size() - 1]<<") ";
cout<<(q4x[q4x.size() - 1] - *q4x.begin()) * (q4y[q4y.size() - 1] - *q4y.begin())<<endl;
}
if (!f)
{
cout<<"No point in any quadrant";
}
} |
# 2071481, 2024-11-02 14:40:32, PPPPPPPPPP (100%)
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
using namespace std;
int main(){
int num ;
int square1 , square2 , square3 , square4 ;
set<string> ss;
vector<int> Q1_x;
vector<int> Q1_y;
vector<int> Q2_x;
vector<int> Q2_y;
vector<int> Q3_x;
vector<int> Q3_y;
vector<int> Q4_x;
vector<int> Q4_y;
int x,y;
cin >> num;
while(num--){
cin >> x >> y;
if(x > 0 && y > 0){
Q1_x.push_back(x);
Q1_y.push_back(y);
sort(Q1_x.begin() , Q1_x.end() );
sort(Q1_y.begin() , Q1_y.end() );
ss.insert("Q1");
}
if(x < 0 && y > 0){
Q2_x.push_back(x);
Q2_y.push_back(y);
sort(Q2_x.begin() , Q2_x.end() );
sort(Q2_y.begin() , Q2_y.end() );
ss.insert("Q2");
}
if(x < 0 && y < 0){
Q3_x.push_back(x);
Q3_y.push_back(y);
sort(Q3_x.begin() , Q3_x.end() );
sort(Q3_y.begin() , Q3_y.end() );
ss.insert("Q3");
}
if(x > 0 && y < 0){
Q4_x.push_back(x);
Q4_y.push_back(y);
sort(Q4_x.begin() , Q4_x.end() );
sort(Q4_y.begin() , Q4_y.end() );
ss.insert("Q4");
}
}
auto Q1_xmax = Q1_x.end() - 1 ;
auto Q1_xmin = Q1_x.begin() ;
auto Q1_ymax = Q1_y.end() - 1 ;
auto Q1_ymin = Q1_y.begin() ;
auto Q2_xmax = Q2_x.end() - 1 ;
auto Q2_xmin = Q2_x.begin() ;
auto Q2_ymax = Q2_y.end() - 1 ;
auto Q2_ymin = Q2_y.begin() ;
auto Q3_xmax = Q3_x.end() - 1 ;
auto Q3_xmin = Q3_x.begin() ;
auto Q3_ymax = Q3_y.end() - 1 ;
auto Q3_ymin = Q3_y.begin() ;
auto Q4_xmax = Q4_x.end() - 1 ;
auto Q4_xmin = Q4_x.begin() ;
auto Q4_ymax = Q4_y.end() - 1 ;
auto Q4_ymin = Q4_y.begin() ;
for(auto g : ss){
if(g == "Q1"){
square1 = ((*Q1_xmax)-(*Q1_xmin)) * ((*Q1_ymax)-(*Q1_ymin));
cout << g <<": "<< "(" << *Q1_xmin <<", "<<*Q1_ymin<<")" <<" "<<"(" << *Q1_xmax <<", "<<*Q1_ymax<<")" <<" " <<square1<<endl;
}
if(g == "Q2"){
square2 = ((*Q2_xmax)-(*Q2_xmin)) * ((*Q2_ymax)-(*Q2_ymin));
cout << g <<": "<< "(" << *Q2_xmin <<", "<<*Q2_ymin<<")" <<" "<<"(" << *Q2_xmax <<", "<<*Q2_ymax<<")" <<" " <<square2<<endl;
}
if(g == "Q3"){
square3 = ((*Q3_xmax)-(*Q3_xmin)) * ((*Q3_ymax)-(*Q3_ymin));
cout << g <<": "<< "(" << *Q3_xmin <<", "<<*Q3_ymin<<")" <<" "<<"(" << *Q3_xmax <<", "<<*Q3_ymax<<")" <<" " <<square3<<endl;
}
if(g == "Q4"){
square4 = ((*Q4_xmax)-(*Q4_xmin)) * ((*Q4_ymax)-(*Q4_ymin));
cout << g <<": "<< "(" << *Q4_xmin <<", "<<*Q4_ymin<<")" <<" "<<"(" << *Q4_xmax <<", "<<*Q4_ymax<<")" <<" " <<square4<<endl;
}
}
if(ss.empty() == 1){
cout << "No point in any quadrant";
}
// square2 = ((*Q2_xmax)-(*Q2_xmin)) * ((*Q2_ymax)-(*Q2_ymin));
// square3 = ((*Q3_xmax)-(*Q3_xmin)) * ((*Q3_ymax)-(*Q3_ymin));
// square4 = ((*Q4_xmax)-(*Q4_xmin)) * ((*Q4_ymax)-(*Q4_ymin));
} |
# 2069306, 2024-11-02 10:35:19, PPPPPPPPPP (100%)
#include <iostream>
#include <vector>
#include <set>
#include <cmath>
using namespace std;
int area(set<pair<int,int>> findsq){
set<int> x;
set<int> y;
for (auto r : findsq)
{
x.insert(r.first);
y.insert(r.second);
}
int minx = (*x.begin());
int miny = (*y.begin());
int maxx = (*(--x.end()));
int maxy = (*(--y.end()));
int area = abs(maxx-minx)*abs(maxy-miny);
return area;
}
void minmaxpoint(set<pair<int,int>> show){
set<int> x;
set<int> y;
for (auto r : show)
{
x.insert(r.first);
y.insert(r.second);
}
int minx = (*x.begin());
int miny = (*y.begin());
int maxx = (*(--x.end()));
int maxy = (*(--y.end()));
cout << "(" << minx << ", " << miny << ") " << "(" << maxx << ", " << maxy << ") ";
}
int main() {
int n; cin >>n;
vector<pair<int,int>> plotjud;
for (int i = 0; i < n; i++)
{
int x, y;
cin >> x >> y;
plotjud.push_back({x,y});
}
set<pair<int,int>> Q1;
set<pair<int,int>> Q2;
set<pair<int,int>> Q3;
set<pair<int,int>> Q4;
for (auto j : plotjud)
{
if (j.first>0&&j.second>0)Q1.insert(j);
if (j.first<0&&j.second>0)Q2.insert(j);
if (j.first<0&&j.second<0)Q3.insert(j);
if (j.first>0&&j.second<0)Q4.insert(j);
}
if (Q1.empty()&&Q2.empty()&&Q3.empty()&&Q4.empty())
{
cout << "No point in any quadrant" << endl;
return 0;
}
if (!Q1.empty())
{
cout << "Q1: ";
minmaxpoint(Q1);
cout << area(Q1) << endl;
}
if (!Q2.empty())
{
cout << "Q2: ";
minmaxpoint(Q2);
cout << area(Q2) << endl;
}
if (!Q3.empty())
{
cout << "Q3: ";
minmaxpoint(Q3);
cout << area(Q3) << endl;
}
if (!Q4.empty())
{
cout << "Q4: ";
minmaxpoint(Q4);
cout << area(Q4) << endl;
}
} |
# 2069196, 2024-11-02 10:24:28, PPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,x,y;
vector<pair<int,int>> q1,q2,q3,q4;
bool found = false,f1=false,f2=false,f3=false,f4=false;
cin >> n;
while(n--){
cin >> x >> y;
if(x==0||y==0) continue;
if(x>0&&y>0){
f1 = true;
found = true;
q1.push_back(make_pair(x,y));
}else if(x<0&&y>0){
f2 = true;
found = true;
q2.push_back(make_pair(x,y));
}else if(x<0&&y<0){
f3 = true;
found = true;
q3.push_back(make_pair(x,y));
}else if(x>0&&y<0){
f4 = true;
found = true;
q4.push_back(make_pair(x,y));
}
}
if(found){
if(f1){
auto it = q1.begin();
int xmax = it->first,ymax = it->second,xmin = it->first,ymin = it->second;
for(auto e : q1){
if(e.first<xmin){
xmin = e.first;
}
if(e.second < ymin){
ymin = e.second;
}
if(e.first>xmax){
xmax = e.first;
}
if(e.second>ymax){
ymax = e.second;
}
}
int sumq1 = (xmax-xmin)*(ymax-ymin);
cout << "Q1: (" << xmin << ", " << ymin << ") (" << xmax << ", " << ymax << ") " << sumq1 << endl;
}
if(f2){
auto it = q2.begin();
int xmax = it->first,ymax = it->second,xmin = it->first,ymin = it->second;
for(auto e : q2){
if(e.first<xmin){
xmin = e.first;
}
if(e.second < ymin){
ymin = e.second;
}
if(e.first>xmax){
xmax = e.first;
}
if(e.second>ymax){
ymax = e.second;
}
}
int sumq2 = (xmax-xmin)*(ymax-ymin);
cout << "Q2: (" << xmin << ", " << ymin << ") (" << xmax << ", " << ymax << ") " << sumq2 << endl;
}
if(f3){
auto it = q3.begin();
int xmax = it->first,ymax = it->second,xmin = it->first,ymin = it->second;
for(auto e : q3){
if(e.first<xmin){
xmin = e.first;
}
if(e.second < ymin){
ymin = e.second;
}
if(e.first>xmax){
xmax = e.first;
}
if(e.second>ymax){
ymax = e.second;
}
}
int sumq3 = (xmax-xmin)*(ymax-ymin);
cout << "Q3: (" << xmin << ", " << ymin << ") (" << xmax << ", " << ymax << ") " << sumq3 << endl;
}
if(f4){
auto it = q4.begin();
int xmax = it->first,ymax = it->second,xmin = it->first,ymin = it->second;
for(auto e : q4){
if(e.first<xmin){
xmin = e.first;
}
if(e.second < ymin){
ymin = e.second;
}
if(e.first>xmax){
xmax = e.first;
}
if(e.second>ymax){
ymax = e.second;
}
}
int sumq4 = (xmax-xmin)*(ymax-ymin);
cout << "Q4: (" << xmin << ", " << ymin << ") (" << xmax << ", " << ymax << ") " << sumq4 << endl;
}
}else{
cout << "No point in any quadrant" << endl;
}
} |
# 2071302, 2024-11-02 14:20:25, PPPPPPPPPP (100%)
#include <iostream>
#include <vector>
#include <utility>
using namespace std;
pair<int,int> findMin (vector<pair<int, int>> s) {
pair<int,int> x;
pair<int,int> y;
pair<int,int> result;
long long temp_x = 10000000;
long long temp_y = 10000000;
for (auto v : s) {
//test
// cout << v.first << endl;
// cout << v.second << endl;
if (temp_x > v.first) {
//cout << v.first << endl;
temp_x = v.first;
x = v;
}
if (temp_y > v.second) {
//cout << v.second << endl;
temp_y = v.second;
y = v;
}
}
//test
// cout << x.first << x.second << endl;
// cout << y.first << y.second << endl;
if (x == y) {
result = x;
} else {
result = make_pair(x.first, y.second);
}
//test
// cout << result.first << result.second << endl;
return result;
}
pair<int,int> findMax (vector<pair<int, int>> s) {
pair<int,int> x;
pair<int,int> y;
pair<int,int> result;
int temp_x = -100000;
int temp_y = -100000;
for (auto v : s) {
//test
// cout << v.first << endl;
// cout << v.second << endl;
if (temp_x < v.first) {
//cout << v.first << endl;
temp_x = v.first;
x = v;
}
if (temp_y < v.second) {
//cout << v.second << endl;
temp_y = v.second;
y = v;
}
}
//test
// cout << x.first << x.second << endl;
// cout << y.first << y.second << endl;
if (x == y) {
result = x;
} else {
result = make_pair(x.first, y.second);
}
//test
// cout << result.first << result.second << endl;
return result;
}
int calculateSquare (pair<int,int> max, pair<int,int> min) {
int cal_w = abs(max.first - min.first);
int cal_l = abs(max.second - min.second);
return cal_l * cal_w;
}
int main() {
vector<pair<int, int>> q1, q2, q3, q4;
int a;
cin >> a;
for (int i=0; i < a; ++i) {
int x = 0;
int y = 0;
cin >> x >> y;
if (x != 0 && y != 0) {
if (y > 0 && x < 0) { q2.push_back({x,y});}
else if (y < 0 && x > 0) {q4.push_back({x,y});}
else if (x < 0 && y < 0) {q3.push_back({x,y});}
else {q1.push_back({x,y});}
}
}
if (q1.empty() && q2.empty() && q3.empty() && q4.empty()) {
cout << "No point in any quadrant" << endl;
} else {
if (!q1.empty()) {
pair<int,int> min_q1 = findMin(q1);
pair<int,int> max_q1 = findMax(q1);
int area_q1 = calculateSquare(max_q1, min_q1);
cout << "Q1: " << "(" << min_q1.first << ", " << min_q1.second << ") ";
cout << "(" << max_q1.first << ", " << max_q1.second << ") ";
cout << area_q1 << endl;
}
if (!q2.empty()) {
pair<int,int> min_q2 = findMin(q2);
pair<int,int> max_q2 = findMax(q2);
int area_q2 = calculateSquare(max_q2, min_q2);
cout << "Q2: " << "(" << min_q2.first << ", " << min_q2.second << ") ";
cout << "(" << max_q2.first << ", " << max_q2.second << ") ";
cout << area_q2 << endl;
}
if (!q3.empty()) {
pair<int,int> min_q3 = findMin(q3);
pair<int,int> max_q3 = findMax(q3);
int area_q3 = calculateSquare(max_q3, min_q3);
cout << "Q3: " << "(" << min_q3.first << ", " << min_q3.second << ") ";
cout << "(" << max_q3.first << ", " << max_q3.second << ") ";
cout << area_q3 << endl;
}
if (!q4.empty()) {
pair<int,int> min_q4 = findMin(q4);
pair<int,int> max_q4 = findMax(q4);
int area_q4 = calculateSquare(max_q4, min_q4);
cout << "Q4: " << "(" << min_q4.first << ", " << min_q4.second << ") ";
cout << "(" << max_q4.first << ", " << max_q4.second << ") ";
cout << area_q4 << endl;
}
}
} |
# 2071440, 2024-11-02 14:35:32, PPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n,x,y;
cin >> n;
int A1=0,A2=0,A3=0,A4=0;
int mxQF1 = INT_MIN,mxQS1 = INT_MIN,mxQF2 = INT_MIN,mxQS2 = INT_MIN,mxQF3 = INT_MIN,mxQS3 = INT_MIN,mxQF4 = INT_MIN,mxQS4 = INT_MIN;
int miQF1 = INT_MAX,miQS1 = INT_MAX,miQF2 = INT_MAX,miQS2 = INT_MAX,miQF3 = INT_MAX,miQS3 = INT_MAX,miQF4 = INT_MAX,miQS4 = INT_MAX;
vector<int> QF1,QF2,QF3,QF4;
vector<int> QS1,QS2,QS3,QS4;
while(n--){
cin >> x >> y;
if(x>0&&y>0){//Q1
QF1.push_back(x);
QS1.push_back(y);
}
else if(x<0&&y>0){//Q2
QF2.push_back(x);
QS2.push_back(y);
}
else if(x<0&&y<0){//Q3
QF3.push_back(x);
QS3.push_back(y);
}
else if(x>0&&y<0){//Q4
QF4.push_back(x);
QS4.push_back(y);
}
}
for(auto i:QF1){
if(i>=mxQF1)mxQF1=i;
if(i<=miQF1)miQF1=i;
}
for(auto i:QS1){
if(i>=mxQS1)mxQS1=i;
if(i<=miQS1)miQS1=i;
}
for(auto i:QF2){
if(i>=mxQF2)mxQF2=i;
if(i<=miQF2)miQF2=i;
}
for(auto i:QS2){
if(i>=mxQS2)mxQS2=i;
if(i<=miQS2)miQS2=i;
}
for(auto i:QF3){
if(i>=mxQF3)mxQF3=i;
if(i<=miQF3)miQF3=i;
}
for(auto i:QS3){
if(i>=mxQS3)mxQS3=i;
if(i<=miQS3)miQS3=i;
}
for(auto i:QF4){
if(i>=mxQF4)mxQF4=i;
if(i<=miQF4)miQF4=i;
}
for(auto i:QS4){
if(i>=mxQS4)mxQS4=i;
if(i<=miQS4)miQS4=i;
}
A1 = (mxQF1-miQF1)*(mxQS1-miQS1);
A2 = (mxQF2-miQF2)*(mxQS2-miQS2);
A3 = (mxQF3-miQF3)*(mxQS3-miQS3);
A4 = (mxQF4-miQF4)*(mxQS4-miQS4);
if(QF1.empty()&&QS1.empty()&&QF2.empty()&&QS2.empty()&&QF3.empty()&&QS3.empty()&&QF4.empty()&&QS4.empty()){
cout << "No point in any quadrant";
}
else{
if(QF1.empty()&&QS1.empty()){
}
else{
cout << "Q1: (" << miQF1 << ", " << miQS1 << ") (" << mxQF1 << ", " << mxQS1 << ") " << A1 << endl;
}
if(QF2.empty()&&QS2.empty()){
}
else{
cout << "Q2: (" << miQF2 << ", " << miQS2 << ") (" << mxQF2 << ", " << mxQS2 << ") " << A2 << endl;
}
if(QF3.empty()&&QS3.empty()){
}
else{
cout << "Q3: (" << miQF3 << ", " << miQS3 << ") (" << mxQF3 << ", " << mxQS3 << ") " << A3 << endl;
}
if(QF4.empty()&&QS4.empty()){
}
else{
cout << "Q4: (" << miQF4 << ", " << miQS4 << ") (" << mxQF4 << ", " << mxQS4 << ") " << A4 << endl;
}
}
} |
# 2069209, 2024-11-02 10:26:12, PPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std;
bool sortQ2(pair<int, int> &a, pair<int, int> &b) {
if (a.first != b.first) {
return a.first > b.first;
}
else {
return a.second < b.second;
}
}
bool sortQ3(pair<int, int> &a, pair<int, int> &b) {
if (a.first != b.first) {
return a.first > b.first;
}
else {
return a.second > b.second;
}
}
bool sortQ4(pair<int, int> &a, pair<int, int> &b) {
if (a.first != b.first) {
return a.first < b.first;
}
else {
return a.second > b.second;
}
}
int main() {
vector <pair<int, int>> vec;
int N, x, y;
// Collect x,y and put in vec
cin >> N;
for (int i = 0; i < N; ++i) {
cin >> x >> y;
vec.push_back({x, y});
}
// Seperate each points into Q
vector <pair<int, int>> Q1, Q2, Q3, Q4;
for (auto i : vec) {
if (i.first == 0 || i.second == 0) {
continue;
}
else if (i.first > 0 && i.second > 0) {
Q1.push_back({i.first, i.second});
}
else if (i.first < 0 && i.second > 0) {
Q2.push_back({i.first, i.second});
}
else if (i.first < 0 && i.second < 0) {
Q3.push_back({i.first, i.second});
}
else if (i.first > 0 && i.second < 0) {
Q4.push_back({i.first, i.second});
}
}
// Sort each Q
sort(Q1.begin(), Q1.end());
sort(Q2.begin(), Q2.end(), sortQ2);
sort(Q3.begin(), Q3.end(), sortQ3);
sort(Q4.begin(), Q4.end(), sortQ4);
// Find the coners of each Q
int min_x = INT_MAX, max_x = INT_MIN, min_y = INT_MAX, max_y = INT_MIN;
vector <pair<int, int>> Q1_box, Q2_box, Q3_box, Q4_box;
for (auto i : Q1) {
if (i.first < min_x) {
min_x = i.first;
}
if (i.first > max_x) {
max_x = i.first;
}
if (i.second < min_y) {
min_y = i.second;
}
if (i.second > max_y) {
max_y = i.second;
}
}
Q1_box.push_back({min_x, min_y}); Q1_box.push_back({max_x, max_y});
min_x = INT_MAX; max_x = INT_MIN; min_y = INT_MAX; max_y = INT_MIN;
for (auto i : Q2) {
if (i.first < min_x) {
min_x = i.first;
}
if (i.first > max_x) {
max_x = i.first;
}
if (i.second < min_y) {
min_y = i.second;
}
if (i.second > max_y) {
max_y = i.second;
}
}
Q2_box.push_back({min_x, min_y}); Q2_box.push_back({max_x, max_y});
min_x = INT_MAX; max_x = INT_MIN; min_y = INT_MAX; max_y = INT_MIN;
for (auto i : Q3) {
if (i.first < min_x) {
min_x = i.first;
}
if (i.first > max_x) {
max_x = i.first;
}
if (i.second < min_y) {
min_y = i.second;
}
if (i.second > max_y) {
max_y = i.second;
}
}
Q3_box.push_back({min_x, min_y}); Q3_box.push_back({max_x, max_y});
min_x = INT_MAX; max_x = INT_MIN; min_y = INT_MAX; max_y = INT_MIN;
for (auto i : Q4) {
if (i.first < min_x) {
min_x = i.first;
}
if (i.first > max_x) {
max_x = i.first;
}
if (i.second < min_y) {
min_y = i.second;
}
if (i.second > max_y) {
max_y = i.second;
}
}
Q4_box.push_back({min_x, min_y}); Q4_box.push_back({max_x, max_y});
min_x = INT_MAX; max_x = INT_MIN; min_y = INT_MAX; max_y = INT_MIN;
if (Q1.empty() && Q2.empty() && Q3.empty() && Q4.empty()) {
cout << "No point in any quadrant";
}
else {
if (!Q1.empty()) {
cout << "Q1: (" << Q1_box[0].first << ", " << Q1_box[0].second << ") (" << Q1_box[1].first << ", " << Q1_box[1].second << ") " << ((Q1_box[1].first - Q1_box[0].first) * (Q1_box[1].second - Q1_box[0].second)) << endl;
}
if (!Q2.empty()) {
cout << "Q2: (" << Q2_box[0].first << ", " << Q2_box[0].second << ") (" << Q2_box[1].first << ", " << Q2_box[1].second << ") " << ((Q2_box[1].first - Q2_box[0].first) * (Q2_box[1].second - Q2_box[0].second)) << endl;
}
if (!Q3.empty()) {
cout << "Q3: (" << Q3_box[0].first << ", " << Q3_box[0].second << ") (" << Q3_box[1].first << ", " << Q3_box[1].second << ") " << ((Q3_box[1].first - Q3_box[0].first) * (Q3_box[1].second - Q3_box[0].second)) << endl;
}
if (!Q4.empty()) {
cout << "Q4: (" << Q4_box[0].first << ", " << Q4_box[0].second << ") (" << Q4_box[1].first << ", " << Q4_box[1].second << ") " << ((Q4_box[1].first - Q4_box[0].first) * (Q4_box[1].second - Q4_box[0].second)) << endl;
}
}
} |
# 2070917, 2024-11-02 13:32:59, PPPPPPPPPP (100%)
#include<iostream>
#include<vector>
#include<tuple>
using namespace std;
int main(){
int n; cin>>n;
int x,y;
vector<pair<int,int>> v;
while(n--){
cin>> x >> y ;
v.push_back({x,y});
}
int c1,c2,c3,c4=0;
c1=c2=c3=0;
int left[5],right[5],upper[5],lower[5];
bool Q1empty=1, Q2empty=1,Q3empty=1 , Q4empty=1;
for(auto e : v){
if(e.first>0 & e.second>0){
c1++;
if(Q1empty==1) {
left[1] = right[1] = e.first;
upper[1] = lower[1] = e.second;
}else{
if(e.first < left[1]) left[1] = e.first;
else if (e.first>right[1]) right[1] = e.first;
if(e.second < lower[1]) lower[1]=e.second;
else if(e.second>upper[1] ) upper[1] =e.second;
}
Q1empty=0;
}
if(e.first>0 & e.second<0)
{
c4++;
if(Q4empty==1) {
left[4] = right[4] = e.first;
upper[4] = lower[4] = e.second;
}else{
if(e.first< left[4]) left[4] = e.first;
else if (e.first>right[4]) right[4] = e.first;
if(e.second < lower[4]) lower[4]=e.second;
else if(e.second > upper[4] ) upper[4] =e.second;
}
Q4empty=0;
}
if(e.first<0 & e.second>0){
c2++;
if(Q2empty==1) {
left[2] = right[2] = e.first;
upper[2] = lower[2] = e.second;
}else{
if(e.first< left[2]) left[2] = e.first;
else if (e.first>right[2]) right[2] = e.first;
if(e.second < lower[2]) lower[2]=e.second;
else if(e.second > upper[2] ) upper[2] =e.second;
}
Q2empty=0;
}
if(e.first<0 & e.second<0){
c3++;
if(Q3empty==1) {
left[3] = right[3] = e.first;
upper[3] = lower[3] = e.second;
}else{
if(e.first< left[3]) left[3] = e.first;
else if (e.first>right[3]) right[3] = e.first;
if(e.second < lower[3]) lower[3]=e.second;
else if(e.second > upper[3] ) upper[3] =e.second;
}
Q3empty=0;
}
}
if(c1!=0) {
cout<<"Q1: ("<<left[1]<<", "<<lower[1]<<") ("<< right[1]<<", "<<upper[1]<<") "<<(right[1]-left[1])*(upper[1]-lower[1])<<endl;
}
if(c2!=0) {
cout<<"Q2: ("<<left[2]<<", "<<lower[2]<<") ("<< right[2]<<", "<<upper[2]<<") "<<(right[2]-left[2])*(upper[2]-lower[2])<<endl;
}
if(c3!=0) {
cout<<"Q3: ("<<left[3]<<", "<<lower[3]<<") ("<< right[3]<<", "<<upper[3]<<") "<<(right[3]-left[3])*(upper[3]-lower[3])<<endl;
}
if(c4!=0) {
cout<<"Q4: ("<<left[4]<<", "<<lower[4]<<") ("<< right[4]<<", "<<upper[4]<<") "<<(right[4]-left[4])*(upper[4]-lower[4])<<endl;
}
if(c1==0 &c2==0 & c3==0 & c4==0)
cout<<"No point in any quadrant"<<endl;
} |
# 2069215, 2024-11-02 10:26:47, PPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n,x,y,Q1=1,Q2=1,Q3=1,Q4=1;
vector<int> q1x,q1y,q2x,q2y,q3x,q3y,q4x,q4y;
cin>>n;
for(int i=0;i<n;i++){
cin>>x>>y;
if(x>0 && y>0){
q1x.push_back(x);
q1y.push_back(y);
}else if(x<0 && y>0){
q2x.push_back(x);
q2y.push_back(y);
}else if(x<0 && y<0){
q3x.push_back(x);
q3y.push_back(y);
}else if(x>0 && y<0){
q4x.push_back(x);
q4y.push_back(y);
}
}
if(q1x.empty()||q1y.empty())Q1=0;
if(q2x.empty()||q2y.empty())Q2=0;
if(q3x.empty()||q3y.empty())Q3=0;
if(q4x.empty()||q4y.empty())Q4=0;
sort(q1x.begin(),q1x.end());
sort(q2x.begin(),q2x.end());
sort(q3x.begin(),q3x.end());
sort(q4x.begin(),q4x.end());
sort(q1y.begin(),q1y.end());
sort(q2y.begin(),q2y.end());
sort(q3y.begin(),q3y.end());
sort(q4y.begin(),q4y.end());
if(!Q1 && !Q2 && !Q3 && !Q4)cout<<"No point in any quadrant";
else{
int a1,a2,b1,b2;
if(!(q1x.empty()) && !(q1y.empty())){
a1=q1x[0];b1=q1y[0];
a2=q1x[q1x.size()-1];b2=q1y[q1y.size()-1];
cout<<"Q1: "<<"("<<a1<<", "<<b1<<") ("<<a2<<", "<<b2<<") "<<(b2-b1)*(a2-a1)<<endl;
}
if(!(q2x.empty()) && !(q2y.empty())){
a1=q2x[0];b1=q2y[0];
a2=q2x[q2x.size()-1];b2=q2y[q2y.size()-1];
cout<<"Q2: "<<"("<<a1<<", "<<b1<<") ("<<a2<<", "<<b2<<") "<<(b2-b1)*(a2-a1)<<endl;
}
if(!(q3x.empty()) && !(q3y.empty())){
a1=q3x[0];b1=q3y[0];
a2=q3x[q3x.size()-1];b2=q3y[q3y.size()-1];
cout<<"Q3: "<<"("<<a1<<", "<<b1<<") ("<<a2<<", "<<b2<<") "<<(b2-b1)*(a2-a1)<<endl;
}
if(!(q4x.empty()) && !(q4y.empty())){
a1=q4x[0];b1=q4y[0];
a2=q4x[q4x.size()-1];b2=q4y[q4y.size()-1];
cout<<"Q4: "<<"("<<a1<<", "<<b1<<") ("<<a2<<", "<<b2<<") "<<(b2-b1)*(a2-a1);
}
}
} |
# 2069030, 2024-11-02 10:05:17, PPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n,x,y,mxx=INT_MIN,mnx=INT_MAX,mxy=INT_MIN,mny=INT_MAX,ar,f=0;
vector<pair<int,int>> q1,q2,q3,q4;
scanf("%d",&n);
for(int i=0;i<n;i++){
scanf("%d %d",&x,&y);
if(x>0&&y>0) q1.push_back(make_pair(x,y));
else if(x<0&&y>0) q2.push_back(make_pair(x,y));
else if(x<0&&y<0) q3.push_back(make_pair(x,y));
else if(x>0&&y<0) q4.push_back(make_pair(x,y));
}
for(int i=0;i<q1.size();i++){
mnx = min(q1[i].first,mnx);
mxx = max(q1[i].first,mxx);
mny = min(q1[i].second,mny);
mxy = max(q1[i].second,mxy);
}
ar = (mxx-mnx)*(mxy-mny);
if(mxx!=INT_MIN||mnx!=INT_MAX||mny!=INT_MAX||mxy!=INT_MIN) {
printf("Q1: (%d, %d) (%d, %d) %d\n",mnx,mny,mxx,mxy,ar);
f++;
mxx=INT_MIN;mnx=INT_MAX;mxy=INT_MIN;mny=INT_MAX;
}
for(int i=0;i<q2.size();i++){
mnx = min(q2[i].first,mnx);
mxx = max(q2[i].first,mxx);
mny = min(q2[i].second,mny);
mxy = max(q2[i].second,mxy);
}
ar = (mxx-mnx)*(mxy-mny);
if(mxx!=INT_MIN||mnx!=INT_MAX||mny!=INT_MAX||mxy!=INT_MIN) {
printf("Q2: (%d, %d) (%d, %d) %d\n",mnx,mny,mxx,mxy,ar);
f++;
mxx=INT_MIN;mnx=INT_MAX;mxy=INT_MIN;mny=INT_MAX;
}
for(int i=0;i<q3.size();i++){
mnx = min(q3[i].first,mnx);
mxx = max(q3[i].first,mxx);
mny = min(q3[i].second,mny);
mxy = max(q3[i].second,mxy);
}
ar = (mxx-mnx)*(mxy-mny);
if(mxx!=INT_MIN||mnx!=INT_MAX||mny!=INT_MAX||mxy!=INT_MIN) {
printf("Q3: (%d, %d) (%d, %d) %d\n",mnx,mny,mxx,mxy,ar);
f++;
mxx=INT_MIN;mnx=INT_MAX;mxy=INT_MIN;mny=INT_MAX;
}
for(int i=0;i<q4.size();i++){
mnx = min(q4[i].first,mnx);
mxx = max(q4[i].first,mxx);
mny = min(q4[i].second,mny);
mxy = max(q4[i].second,mxy);
}
ar = (mxx-mnx)*(mxy-mny);
if(mxx!=INT_MIN||mnx!=INT_MAX||mny!=INT_MAX||mxy!=INT_MIN) {
printf("Q4: (%d, %d) (%d, %d) %d\n",mnx,mny,mxx,mxy,ar);
f++;
mxx=INT_MIN;mnx=INT_MAX;mxy=INT_MIN;mny=INT_MAX;
}
if(f==0) printf("No point in any quadrant");
return 0;
} |
# 2070682, 2024-11-02 13:00:23, PPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
int main() {
vector<pair<int, int>> Q1, Q2, Q3, Q4;
int maxQ1x = INT_MIN, maxQ2x = INT_MIN, maxQ3x = INT_MIN, maxQ4x = INT_MIN;
int maxQ1y = INT_MIN, maxQ2y = INT_MIN, maxQ3y = INT_MIN, maxQ4y = INT_MIN;
int minQ1x = INT_MAX, minQ2x = INT_MAX, minQ3x = INT_MAX, minQ4x = INT_MAX;
int minQ1y = INT_MAX, minQ2y = INT_MAX, minQ3y = INT_MAX, minQ4y = INT_MAX;
int N, M, P; cin >> P;
while(P--) {
cin >> M >> N;
if(M > 0 && N > 0) {
Q1.push_back(make_pair(M, N));
}
else if(M > 0 && N < 0) {
Q4.push_back(make_pair(M, N));
}
else if(M < 0 && N > 0) {
Q2.push_back(make_pair(M, N));
}
else if(M < 0 && N < 0) {
Q3.push_back(make_pair(M, N));
}
}
for(int i = 0; i < Q1.size(); i++) {
maxQ1x = max(maxQ1x, Q1[i].first);
maxQ1y = max(maxQ1y, Q1[i].second);
minQ1x = min(minQ1x, Q1[i].first);
minQ1y = min(minQ1y, Q1[i].second);
}
for(int i = 0; i < Q2.size(); i++) {
maxQ2x = max(maxQ2x, Q2[i].first);
maxQ2y = max(maxQ2y, Q2[i].second);
minQ2x = min(minQ2x, Q2[i].first);
minQ2y = min(minQ2y, Q2[i].second);
}
for(int i = 0; i < Q3.size(); i++) {
maxQ3x = max(maxQ3x, Q3[i].first);
maxQ3y = max(maxQ3y, Q3[i].second);
minQ3x = min(minQ3x, Q3[i].first);
minQ3y = min(minQ3y, Q3[i].second);
}
for(int i = 0; i < Q4.size(); i++) {
maxQ4x = max(maxQ4x, Q4[i].first);
maxQ4y = max(maxQ4y, Q4[i].second);
minQ4x = min(minQ4x, Q4[i].first);
minQ4y = min(minQ4y, Q4[i].second);
}
if(Q1.size() != 0) {
int area = (maxQ1x - minQ1x)*(maxQ1y - minQ1y);
cout << "Q1: (" << minQ1x << ", " << minQ1y << ") (" << maxQ1x << ", " << maxQ1y << ") " << area << endl;
}
if(Q2.size() != 0) {
int area = (maxQ2x - minQ2x)*(maxQ2y - minQ2y);
cout << "Q2: (" << minQ2x << ", " << minQ2y << ") (" << maxQ2x << ", " << maxQ2y << ") " << area << endl;
}
if(Q3.size() != 0) {
int area = (maxQ3x - minQ3x)*(maxQ3y - minQ3y);
cout << "Q3: (" << minQ3x << ", " << minQ3y << ") (" << maxQ3x << ", " << maxQ3y << ") " << area << endl;
}
if(Q4.size() != 0) {
int area = (maxQ4x - minQ4x)*(maxQ4y - minQ4y);
cout << "Q4: (" << minQ4x << ", " << minQ4y << ") (" << maxQ4x << ", " << maxQ4y << ") " << area << endl;
}
if(Q1.size() == 0 && Q2.size() == 0 && Q3.size() == 0 && Q4.size() == 0) {
cout << "No point in any quadrant" << endl;
}
return 0;
} |
# 2071151, 2024-11-02 14:02:03, PPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std;
pair<int,int> mx1 = {-1e9,-1e9}, mx2 = {-1e9,-1e9}, mx3 = {-1e9,-1e9}, mx4 = {-1e9,-1e9};
pair<int,int> mn1 = {1e9,1e9}, mn2 = {1e9,1e9}, mn3 = {1e9,1e9}, mn4 = {1e9,1e9};
bool q1, q2, q3, q4;
void findmax(pair<int,int> &q,int x,int y) {
q.first = max(q.first,x);
q.second = max(q.second,y);
}
void findmin(pair<int,int> &q,int x,int y) {
q.first = min(q.first,x);
q.second = min(q.second,y);
}
int main() {
int n;
cin >> n;
int x, y;
q1 = q2 = q3 = q4 = false;
for(int i = 0; i < n; i++) {
cin >> x >> y;
if(x == 0 || y == 0) continue;
if(x > 0) {
if(y > 0) {
findmax(mx1,x,y);
findmin(mn1,x,y);
q1 = true;
// cout << "q1 ";
// cout << mx1.first << " " << mx1.second << '\n';
// cout << mn1.first << " " << mn1.second << '\n';
} else if(y < 0) {
findmax(mx4,x,y);
findmin(mn4,x,y);
q4 = true;
}
} else {
if(y > 0) {
findmax(mx2,x,y);
findmin(mn2,x,y);
q2 = true;
} else if(y < 0) {
findmax(mx3,x,y);
findmin(mn3,x,y);
q3 = true;
}
}
}
if(!q1 && !q2 && !q3 && !q4) {
cout << "No point in any quadrant";
return 0;
}
if(q1) {
cout << "Q1: (" << mn1.first << ", " << mn1.second << ")";
cout << " (" << mx1.first << ", " << mx1.second << ") ";
cout << abs(mn1.first-mx1.first) * abs(mn1.second-mx1.second);
cout << '\n';
}
if(q2) {
cout << "Q2: (" << mn2.first << ", " << mn2.second << ")";
cout << " (" << mx2.first << ", " << mx2.second << ") ";
cout << abs(mn2.first-mx2.first) * abs(mn2.second-mx2.second);
cout << '\n';
}
if(q3) {
cout << "Q3: (" << mn3.first << ", " << mn3.second << ")";
cout << " (" << mx3.first << ", " << mx3.second << ") ";
cout << abs(mn3.first-mx3.first) * abs(mn3.second-mx3.second);
cout << '\n';
}
if(q4) {
cout << "Q4: (" << mn4.first << ", " << mn4.second << ")";
cout << " (" << mx4.first << ", " << mx4.second << ") ";
cout << abs(mn4.first-mx4.first) * abs(mn4.second-mx4.second);
cout << '\n';
}
} |
# 2070711, 2024-11-02 13:05:44, PPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std;
int main(){
bool found[] = {0, 0, 0, 0, 0};
int n;
int q_max_x[] = {-INT_MAX, -INT_MAX, -INT_MAX, -INT_MAX, -INT_MAX};
int q_max_y[] = {-INT_MAX, -INT_MAX, -INT_MAX, -INT_MAX, -INT_MAX};
int q_min_x[] = {INT_MAX, INT_MAX, INT_MAX, INT_MAX, INT_MAX};
int q_min_y[] = {INT_MAX, INT_MAX, INT_MAX, INT_MAX, INT_MAX};
cin >> n;
for(int i=0; i<n; i++){
int x, y;
cin >> x >> y;
if(x == 0 || y == 0){
continue;
}
else if(x > 0 && y > 0){ //Q1
// cout << " " << x << " " << y << endl;
if(q_min_x[1] > x) q_min_x[1] = x;
if(q_min_y[1] > y) q_min_y[1] = y;
if(q_max_x[1] < x) q_max_x[1] = x;
if(q_max_y[1] < y) q_max_y[1] = y;
found[1] = 1;
}
else if(x < 0 && y > 0){ //Q2
if(q_min_x[2] > x) q_min_x[2] = x;
if(q_min_y[2] > y) q_min_y[2] = y;
if(q_max_x[2] < x) q_max_x[2] = x;
if(q_max_y[2] < y) q_max_y[2] = y;
found[2] = 1;
}
else if(x < 0 && y < 0){ //Q3
if(q_min_x[3] > x) q_min_x[3] = x;
if(q_min_y[3] > y) q_min_y[3] = y;
if(q_max_x[3] < x) q_max_x[3] = x;
if(q_max_y[3] < y) q_max_y[3] = y;
found[3] = 1;
}
else if(x > 0 && y < 0){ //Q4
if(q_min_x[4] > x) q_min_x[4] = x;
if(q_min_y[4] > y) q_min_y[4] = y;
if(q_max_x[4] < x) q_max_x[4] = x;
if(q_max_y[4] < y) q_max_y[4] = y;
found[4] = 1;
}
}
for(int i=1; i<=4; i++){
if(found[i] == 1){
cout << "Q" <<i<< ": (" << q_min_x[i] << ", " << q_min_y[i] << ") ("
<< q_max_x[i] << ", " << q_max_y[i] << ") "
<< abs((q_max_x[i] - q_min_x[i]) * (q_max_y[i] - q_min_y[i])) << endl;
}
}
if(found[1] == 0 && found[2] == 0 && found[3] == 0&& found[4] == 0){
cout << "No point in any quadrant";
}
} |
# 2071223, 2024-11-02 14:10:18, PPPPPPPPPP (100%)
#include <iostream>
#include <vector>
using namespace std;
int main () {
vector<pair<int,int>> Q1,Q2,Q3,Q4;
int n;
cin >> n;
int x,y;
for (int i=0;i<n;i++) {
cin >> x >> y;
if (x==0||y==0) continue;
if (x>0&&y>0) Q1.push_back(make_pair(x,y));
else if (x<0&&y>0) Q2.push_back(make_pair(x,y));
else if (x<0&&y<0) Q3.push_back(make_pair(x,y));
else Q4.push_back(make_pair(x,y));
}
int minx,miny,maxx,maxy;
if (!Q1.empty()) {
minx=Q1[0].first,maxx=Q1[0].first,miny=Q1[0].second,maxy=Q1[0].second;
for (auto p:Q1) {
if (p.first<minx) minx=p.first;
if (p.first>maxx) maxx=p.first;
if (p.second<miny) miny=p.second;
if (p.second>maxy) maxy=p.second;
}
int rec=(maxx-minx)*(maxy-miny);
cout << "Q1: (" << minx << ", " << miny << ") (" << maxx << ", " << maxy << ") " << rec << endl;
}
if (!Q2.empty()) {
minx=Q2[0].first,maxx=Q2[0].first,miny=Q2[0].second,maxy=Q2[0].second;
for (auto p:Q2) {
if (p.first<minx) minx=p.first;
if (p.first>maxx) maxx=p.first;
if (p.second<miny) miny=p.second;
if (p.second>maxy) maxy=p.second;
}
int rec=(maxx-minx)*(maxy-miny);
cout << "Q2: (" << minx << ", " << miny << ") (" << maxx << ", " << maxy << ") " << rec << endl;
}
if (!Q3.empty()) {
minx=Q3[0].first,maxx=Q3[0].first,miny=Q3[0].second,maxy=Q3[0].second;
for (auto p:Q3) {
if (p.first<minx) minx=p.first;
if (p.first>maxx) maxx=p.first;
if (p.second<miny) miny=p.second;
if (p.second>maxy) maxy=p.second;
}
int rec=(maxx-minx)*(maxy-miny);
cout << "Q3: (" << minx << ", " << miny << ") (" << maxx << ", " << maxy << ") " << rec << endl;
}
if (!Q4.empty()) {
minx=Q4[0].first,maxx=Q4[0].first,miny=Q4[0].second,maxy=Q4[0].second;
for (auto p:Q4) {
if (p.first<minx) minx=p.first;
if (p.first>maxx) maxx=p.first;
if (p.second<miny) miny=p.second;
if (p.second>maxy) maxy=p.second;
}
int rec=(maxx-minx)*(maxy-miny);
cout << "Q4: (" << minx << ", " << miny << ") (" << maxx << ", " << maxy << ") " << rec << endl;
}
if (Q1.empty()&&Q2.empty()&&Q3.empty()&&Q4.empty()) cout << "No point in any quadrant" << endl;
} |
# 2071175, 2024-11-02 14:04:34, PPPPPPPPPP (100%)
#include <iostream>
#include <map>
#include <set>
#include <cmath>
using namespace std;
int area(map<int,set<int> > Q){
int A,W,H;
W = abs((*Q.begin()).first - (*Q.rbegin()).first);
int minp = 1e10 , maxp = *((Q.begin())->second).begin();
for(auto P:Q){
for(auto Y:P.second){
minp = min(minp,Y);
maxp = max(maxp,Y);
}
}
H = abs(maxp-minp);
A = W*H;
return A;
}
int main(){
int n;cin >>n;
map<int,set<int> > Q1,Q2,Q3,Q4;
for(int i = 0;i<n;i++){
int p1,p2;
cin >> p1 >> p2;
if(p1>0&&p2>0){
auto pos = Q1.find(p1);
if(pos==Q1.end()){
set<int> temp;
temp.insert(p2);
Q1[p1] = temp;
}
else pos->second.insert(p2);
}
else if(p1<0&&p2>0){
auto pos = Q2.find(p1);
if(pos==Q2.end()){
set<int> temp;
temp.insert(p2);
Q2[p1] = temp;
}
else pos->second.insert(p2);
}
else if(p1<0&&p2<0){
auto pos = Q3.find(p1);
if(pos==Q3.end()){
set<int> temp;
temp.insert(p2);
Q3[p1] = temp;
}
else pos->second.insert(p2);
}
else if(p1>0 && p2<0){
auto pos = Q4.find(p1);
if(pos==Q4.end()){
set<int> temp;
temp.insert(p2);
Q4[p1] = temp;
}
else pos->second.insert(p2);
}
}
int Q1xmin ,Q1ymin ,Q1xmax,Q1ymax,aq1,Q2xmin ,Q2ymin ,Q2xmax,Q2ymax,aq2,Q3xmin ,Q3ymin ,Q3xmax,Q3ymax,aq3,Q4xmin ,Q4ymin ,Q4xmax,Q4ymax,aq4;
if(Q1.size()!=0){ aq1 = area(Q1);
Q1xmin = (*Q1.begin()).first;
Q1xmax = (*Q1.rbegin()).first;
Q1ymin =1e10, Q1ymax = *((Q1.begin())->second).begin();
for(auto P:Q1){
for(auto Y:P.second){
Q1ymin = min(Q1ymin,Y);
Q1ymax = max(Q1ymax,Y);
}
}}
if(Q2.size()!=0){ aq2 = area(Q2);
Q2xmin = (*Q2.begin()).first;
Q2xmax = (*Q2.rbegin()).first;
Q2ymin = 1e10 , Q2ymax = *((Q2.begin())->second).begin();
for(auto P:Q2){
for(auto Y:P.second){
Q2ymin = min(Q2ymin,Y);
Q2ymax = max(Q2ymax,Y);
}
}}
if(Q3.size()!=0){ aq3 = area(Q3);
Q3xmin = (*Q3.begin()).first;
Q3xmax = (*Q3.rbegin()).first;
Q3ymin = 1e10, Q3ymax=*((Q3.begin())->second).begin();
for(auto P:Q3){
for(auto Y:P.second){
Q3ymin = min(Q3ymin,Y);
Q3ymax = max(Q3ymax,Y);
}
}}
if(Q4.size()!=0){ Q4xmin = (*Q4.begin()).first;
aq4 = area(Q4);
Q4xmax = (*Q4.rbegin()).first;
Q4ymin =1e10 ,Q4ymax = *((Q4.begin())->second).begin() ;
for(auto P:Q4){
for(auto Y:P.second){
Q4ymin = min(Q4ymin,Y);
Q4ymax = max(Q4ymax,Y);
}
}}
if(Q1.size()==0&&Q2.size()==0&&Q3.size()==0&&Q4.size()==0)cout << "No point in any quadrant";
if(Q1.size()!=0)cout << "Q1: ("<< Q1xmin << ", " << Q1ymin << ") (" << Q1xmax << ", " << Q1ymax << ") " << aq1 << endl;
if(Q2.size()!=0)cout << "Q2: ("<< Q2xmin << ", " << Q2ymin << ") (" << Q2xmax << ", " << Q2ymax << ") " << aq2 << endl;
if(Q3.size()!=0)cout << "Q3: ("<< Q3xmin << ", " << Q3ymin << ") (" << Q3xmax << ", " << Q3ymax << ") " << aq3 << endl;
if(Q4.size()!=0)cout << "Q4: ("<< Q4xmin << ", " << Q4ymin << ") (" << Q4xmax << ", " << Q4ymax << ") " << aq4 << endl;
} |
# 2069908, 2024-11-02 11:35:59, PPPPPPPPPP (100%)
#include <iostream>
#include <cmath>
#include <bits/stdc++.h>
using namespace std;
void expand(vector<pair<int, int>> &q, int x, int y){
if(q.empty()){
q.push_back({x, x});
q.push_back({y, y});
return;
}
bool xBetween = false, yBetween = false;
xBetween = (x >= q[0].first && x <= q[0].second);
yBetween = (y >= q[1].first && y <= q[1].second);
if(abs(q[0].first - x) < abs(q[0].second - x) && !xBetween) q[0].first = x;
else if(!xBetween) q[0].second = x;
if(q[0].first > q[0].second) swap(q[0].first, q[0].second);
if(abs(q[1].first - y) < abs(q[1].second - y) && !yBetween) q[1].first = y;
else if(!yBetween) q[1].second = y;
if(q[1].first > q[1].second) swap(q[1].first, q[1].second);
return;
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
int n, x, y;
cin >> n;
bool have_point = false;
//q1 q2 q3 q4 (x1, x2) : (y1, y2)
//x1 < x2
vector<vector<pair<int, int>>> q(4);
for(int i = 0; i < n ; i++){
cin >> x >> y;
if(x != 0 && y != 0) have_point = true;
if(x > 0 && y > 0) expand(q[0], x, y);
else if(x > 0 && y < 0) expand(q[3], x, y);
else if(x < 0 && y > 0) expand(q[1], x, y);
else if(x < 0 && y < 0) expand(q[2], x, y);
}
int area;
for(int i = 0; i < 4 ;i++){
if(!have_point){
cout << "No point in any quadrant" ;
break;
}
if(!q[i].empty()){
cout << "Q" << i + 1<< ": " << "(" << q[i][0].first << ", " << q[i][1].first << ") (";
cout << q[i][0].second << ", " << q[i][1].second << ") ";
area = abs(q[i][0].second - q[i][0].first) * abs(q[i][1].second - q[i][1].first);
cout << area << endl;
}
}
return 0;
} |
# 2069017, 2024-11-02 10:04:07, PPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,x,y;
cin>>n;
vector<pair<int,int>> q1,q2,q3,q4;
for(int i=0;i<n;i++){
cin>>x>>y;
pair p = make_pair(x,y);
if(x>0 && y>0) q1.push_back(p);
if(x>0 && y<0) q4.push_back(p);
if(x<0 && y<0) q3.push_back(p);
if(x<0 && y>0) q2.push_back(p);
}
int xmin=1e7,ymin=1e7,xmax=-1e7,ymax=-1e7;
if(q1.empty() && q2.empty() && q3.empty() && q4.empty()){
cout<<"No point in any quadrant";
return 0;
}
for(int i=0;i<q1.size();i++){
if(q1[i].first >xmax) xmax=q1[i].first;
if(q1[i].first <xmin) xmin=q1[i].first;
if(q1[i].second >ymax) ymax=q1[i].second;
if(q1[i].second <ymin) ymin=q1[i].second;
}
if(q1.empty()){
}
else{
cout<<"Q1: ("<<xmin<<", "<<ymin<<") ("<<xmax<<", "<<ymax<<") "<<(xmax-xmin)*(ymax-ymin)<<endl;
}
xmin=1e7;
ymin=1e7;
xmax=-1e7;
ymax=-1e7;
for(int i=0;i<q2.size();i++){
if(q2[i].first >xmax) xmax=q2[i].first;
if(q2[i].first <xmin) xmin=q2[i].first;
if(q2[i].second >ymax) ymax=q2[i].second;
if(q2[i].second <ymin) ymin=q2[i].second;
}
if(q2.empty()){
}
else{
cout<<"Q2: ("<<xmin<<", "<<ymin<<") ("<<xmax<<", "<<ymax<<") "<<(xmax-xmin)*(ymax-ymin)<<endl;
}
xmin=1e7;
ymin=1e7;
xmax=-1e7;
ymax=-1e7;
for(int i=0;i<q3.size();i++){
if(q3[i].first >xmax) xmax=q3[i].first;
if(q3[i].first <xmin) xmin=q3[i].first;
if(q3[i].second >ymax) ymax=q3[i].second;
if(q3[i].second <ymin) ymin=q3[i].second;
}
if(q3.empty()){
}
else{
cout<<"Q3: ("<<xmin<<", "<<ymin<<") ("<<xmax<<", "<<ymax<<") "<<(xmax-xmin)*(ymax-ymin)<<endl;
}
xmin=1e7;
ymin=1e7;
xmax=-1e7;
ymax=-1e7;
for(int i=0;i<q4.size();i++){
if(q4[i].first >xmax) xmax=q4[i].first;
if(q4[i].first <xmin) xmin=q4[i].first;
if(q4[i].second >ymax) ymax=q4[i].second;
if(q4[i].second <ymin) ymin=q4[i].second;
}
if(q4.empty()){
}
else{
cout<<"Q4: ("<<xmin<<", "<<ymin<<") ("<<xmax<<", "<<ymax<<") "<<(xmax-xmin)*(ymax-ymin)<<endl;
}
return 0;
} |
# 2070797, 2024-11-02 13:17:44, PPPPPPPPPP (100%)
#include<iostream>
#include<cmath>
#include<set>
#include<utility>
using namespace std;
int main(){
int n;cin>>n;
set<pair<int,int>> q[4]; //0=1
int x,y;
bool hasone=false;
for(int i=0;i<n;i++){
cin>>x>>y;
if(x>0&&y>0) {
q[0].insert({x,y});
hasone=true;
}
else if(y>0&&x<0){
q[1].insert({x,y});
hasone=true;
}
else if(y<0&&x<0){
q[2].insert({x,y});
hasone=true;
}
else if(y<0&&x>0){
q[3].insert({x,y});
hasone=true;
}
}
if(!hasone) {
cout<<"No point in any quadrant";
return 0;
}
for(int i=0;i<4;i++){
if(q[i].empty()) continue;
int maxX=-1000,maxY=-10000,minx=100000,miny=10000;
for(auto &b:q[i]){
if(b.first>maxX) maxX =b.first;
if(b.first<minx) minx =b.first;
if(b.second>maxY) maxY =b.second;
if(b.second<miny) miny =b.second;
}
int area=(maxX-minx)*(maxY-miny);
cout<<'Q'<<i+1<<": ("<<minx<<", "<<miny<<") ("<<maxX<<", "<<maxY<<") "<<area<<"\n";
}
} |
# 2071723, 2024-11-02 15:08:25, PPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
void printtes(vector<pair<ll,ll>> v){
for(auto e: v){
cout << e.first << " , " << e.second << endl;
}
}
int main(){
int n;
cin >> n;
vector<pair<ll,ll>> q1;
vector<pair<ll,ll>> q2;
vector<pair<ll,ll>> q3;
vector<pair<ll,ll>> q4;
while(n--){
ll x,y;
cin >> x >> y;
if(x > 0 && y > 0){
q1.push_back({x,y});
}else if(x < 0 && y > 0){
q2.push_back({x,y});
}else if(x < 0 && y < 0){
q3.push_back({x,y});
}else if(x > 0 && y < 0){
q4.push_back({x,y});
}
}
//Q1
ll minx = INT64_MAX ;
ll miny = INT64_MAX;
ll maxx = INT64_MIN;
ll maxy = INT64_MIN;
ll difx, dify;
ll area;
for(auto e : q1){
if(e.first > maxx){
maxx = e.first;
}
if(e.second > maxy){
maxy = e.second;
}
if(e.first < minx){
minx = e.first;
}
if(e.second < miny){
miny = e.second;
}
}
difx = abs(maxx-minx);
dify = abs(maxy-miny);
area = difx * dify;
if(q1.size() > 0){
cout << "Q1: " << "(" << minx << ", " << miny << ")" << " " << "(" << maxx << ", " << maxy << ") " << area << endl;
}
//cout << difx << " " << dify;
//Q2
ll minx2 = INT64_MAX ;
ll miny2 = INT64_MAX;
ll maxx2 = INT64_MIN;
ll maxy2 = INT64_MIN;
ll difx2, dify2;
ll area2;
for(auto e : q2){
if(e.first > maxx2){
maxx2 = e.first;
}
if(e.second > maxy2){
maxy2 = e.second;
}
if(e.first < minx2){
minx2 = e.first;
}
if(e.second < miny2){
miny2 = e.second;
}
}
difx2 = abs(maxx2-minx2);
dify2 = abs(maxy2-miny2);
area2 = difx2 * dify2;
if(q2.size() > 0){
cout << "Q2: " << "(" << minx2 << ", " << miny2 << ")" << " " << "(" << maxx2 << ", " << maxy2 << ") " << area2 << endl;
}
//Q3
ll minx3 = INT64_MAX ;
ll miny3 = INT64_MAX;
ll maxx3 = INT64_MIN;
ll maxy3 = INT64_MIN;
ll difx3, dify3;
ll area3;
for(auto e : q3){
if(e.first > maxx3){
maxx3 = e.first;
}
if(e.second > maxy3){
maxy3 = e.second;
}
if(e.first < minx3){
minx3 = e.first;
}
if(e.second < miny3){
miny3 = e.second;
}
}
difx3 = abs(maxx3-minx3);
dify3 = abs(maxy3-miny3);
area3 = difx3 * dify3;
if(q3.size() > 0){
cout << "Q3: " << "(" << minx3 << ", " << miny3 << ")" << " " << "(" << maxx3 << ", " << maxy3 << ") " << area3 << endl;
}
//Q4
ll minx4 = INT64_MAX ;
ll miny4 = INT64_MAX;
ll maxx4 = INT64_MIN;
ll maxy4 = INT64_MIN;
ll difx4, dify4;
ll area4;
for(auto e : q4){
if(e.first > maxx4){
maxx4 = e.first;
}
if(e.second > maxy4){
maxy4 = e.second;
}
if(e.first < minx4){
minx4 = e.first;
}
if(e.second < miny4){
miny4 = e.second;
}
}
difx4 = abs(maxx4-minx4);
dify4 = abs(maxy4-miny4);
area4 = difx4 * dify4;
if(q4.size() > 0){
cout << "Q4: " << "(" << minx4 << ", " << miny4 << ")" << " " << "(" << maxx4 << ", " << maxy4 << ") " << area4 << endl;
}
if(q1.size() == 0 && q2.size() == 0 && q3.size() == 0 && q4.size() == 0 ){
cout << "No point in any quadrant" << endl;
}
} |
# 2069538, 2024-11-02 10:56:25, PPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
int main(){
vector<pair<int,int>> q1,q2,q3,q4;
int x1m=-99999,y1m=-99999,x2m=-99999,y2m=-99999,x3m=-99999,y3m=-99999,x4m=-99999,y4m=-99999; //max
int x1n=99999,y1n=99999,x2n=99999,y2n=99999,x3n=99999,y3n=99999,x4n=99999,y4n=99999; //less
int n; cin >> n;
for(int i{0} ; i<n ; i++){
int x,y;
cin >> x >> y;
if(x>0 && y>0) q1.push_back({x,y});
else if(x<0 && y>0) q2.push_back({x,y});
else if(x<0 && y<0) q3.push_back({x,y});
else if(x>0 && y<0) q4.push_back({x,y});
}
for(int i{0} ; i<q1.size() ; i++){
x1m = max(q1[i].first,x1m);
y1m = max(q1[i].second,y1m);
x1n = min(q1[i].first,x1n);
y1n = min(q1[i].second,y1n);
}
for(int i{0} ; i<q2.size() ; i++){
x2m = max(q2[i].first,x2m);
y2m = max(q2[i].second,y2m);
x2n = min(q2[i].first,x2n);
y2n = min(q2[i].second,y2n);
}
for(int i{0} ; i<q3.size() ; i++){
x3m = max(q3[i].first,x3m);
y3m = max(q3[i].second,y3m);
x3n = min(q3[i].first,x3n);
y3n = min(q3[i].second,y3n);
}
for(int i{0} ; i<q4.size() ; i++){
x4m = max(q4[i].first,x4m);
y4m = max(q4[i].second,y4m);
x4n = min(q4[i].first,x4n);
y4n = min(q4[i].second,y4n);
}
if(!(x1m == -99999 && x1n == 99999)){
cout << "Q1: (" << x1n << ", " << y1n << ") (" << x1m << ", " << y1m << ") ";
cout << (abs(x1m-x1n)*abs(y1m-y1n)) << endl;
}
if(!(x2m == -99999 && x2n == 99999)){
cout << "Q2: (" << x2n << ", " << y2n << ") (" << x2m << ", " << y2m << ") ";
cout << (abs(x2m-x2n)*abs(y2m-y2n)) << endl;
}
if(!(x3m == -99999 && x3n == 99999)){
cout << "Q3: (" << x3n << ", " << y3n << ") (" << x3m << ", " << y3m << ") ";
cout << (abs(x3m-x3n)*abs(y3m-y3n)) << endl;
}
if(!(x4m == -99999 && x4n == 99999)){
cout << "Q4: (" << x4n << ", " << y4n << ") (" << x4m << ", " << y4m << ") ";
cout << (abs(x4m-x4n)*abs(y4m-y4n)) << endl;
}
else if(q1.size()==0 && q2.size()==0 && q3.size()==0 && q4.size()==0) cout << "No point in any quadrant";
} |
# 2069757, 2024-11-02 11:22:04, PPPPPPPPPP (100%)
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
using namespace std;
int main() {
int n,n1;
pair<vector<int>,vector<int>> q[4];
cin >> n;
n1=n;
while (n1--)
{
int x,y;
cin >> x >> y;
if (x==0 || y==0) continue;
if (x>0 && y>0){
q[0].first.push_back(x);
q[0].second.push_back(y);
}
if (x<0 && y > 0){
q[1].first.push_back(x);
q[1].second.push_back(y);
}
if (x<0&&y<0){
q[2].first.push_back(x);
q[2].second.push_back(y);
}
if (x>0&&y<0){
q[3].first.push_back(x);
q[3].second.push_back(y);
}
}
if (q[0].first.size()==0 && q[0].second.size()==0
&& q[1].first.size()==0 && q[1].second.size()==0
&& q[2].first.size()==0 && q[2].second.size()==0
&& q[3].first.size()==0 && q[3].second.size()==0
){
cout << "No point in any quadrant";
}
else{
for (int i=0;i<4;i++){
sort(q[i].first.begin(),q[i].first.end());
sort(q[i].second.begin(),q[i].second.end());
}
//cout << *q[0].first.begin() << " " << q[0].first.back() << " " << *q[0].second.begin() << " " << (q[0].second.back());
for (int i=0;i<4;i++){
if(q[i].first.size()==0 && q[i].second.size()==0) continue;
int max_x = q[i].first.back();
int min_x = *q[i].first.begin();
int max_y = q[i].second.back();
int min_y = *q[i].second.begin();
cout << "Q"<<i+1<< ": "<< "(" << min_x <<", "<<min_y<<") "<<"("<<max_x<<", "<<max_y<<") " << ((max_x-min_x)*(max_y-min_y))<<endl;
}
}
} |
# 2068994, 2024-11-02 10:01:19, PPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,x,y,c=0;
vector<int> vx1,vy1,vx2,vy2,vx3,vy3,vx4,vy4;
cin>>n;
for(int i=0;i<n;i++){
cin>>x>>y;
if(x!=0&&y!=0){
if(x>0&&y>0){
vx1.push_back(x);
vy1.push_back(y);
}if(x<0&&y>0){
vx2.push_back(x);
vy2.push_back(y);
}if(x<0&&y<0){
vx3.push_back(x);
vy3.push_back(y);
}if(x>0&&y<0){
vx4.push_back(x);
vy4.push_back(y);
}
}
}
if(vx1.size()!=0){
sort(vx1.begin(),vx1.end());
sort(vy1.begin(),vy1.end());
n=(*(vx1.end()-1)-*vx1.begin())*(*(vy1.end()-1)-*vy1.begin());
cout<<"Q1: ("<<*vx1.begin()<<", "<<*vy1.begin()<<") ("<<*(vx1.end()-1)<<", "<<*(vy1.end()-1)<<") "<<n<<endl;
}else c++;
if(vx2.size()!=0){
sort(vx2.begin(),vx2.end());
sort(vy2.begin(),vy2.end());
n=(*(vx2.end()-1)-*vx2.begin())*(*(vy2.end()-1)-*vy2.begin());
cout<<"Q2: ("<<*vx2.begin()<<", "<<*vy2.begin()<<") ("<<*(vx2.end()-1)<<", "<<*(vy2.end()-1)<<") "<<n<<endl;
}else c++;if(vx3.size()!=0){
sort(vx3.begin(),vx3.end());
sort(vy3.begin(),vy3.end());
n=(*(vx3.end()-1)-*vx3.begin())*(*(vy3.end()-1)-*vy3.begin());
cout<<"Q3: ("<<*vx3.begin()<<", "<<*vy3.begin()<<") ("<<*(vx3.end()-1)<<", "<<*(vy3.end()-1)<<") "<<n<<endl;
}else c++;if(vx4.size()!=0){
sort(vx4.begin(),vx4.end());
sort(vy4.begin(),vy4.end());
n=(*(vx4.end()-1)-*vx4.begin())*(*(vy4.end()-1)-*vy4.begin());
cout<<"Q4: ("<<*vx4.begin()<<", "<<*vy4.begin()<<") ("<<*(vx4.end()-1)<<", "<<*(vy4.end()-1)<<") "<<n<<endl;
}else c++;
if(c==4)cout<<"No point in any quadrant";
} |
# 2069180, 2024-11-02 10:23:14, PPPPPPPPPP (100%)
#include<bits/stdc++.h>
#include <cmath>
using namespace std;
int main(){
int n;
cin >> n;
int x,y,bl1x{0},ur1x{0},bl2x{0},ur2x{0},bl3x{0},ur3x{0},bl4x{0},ur4x{0},bl1y{0},ur1y{0},bl2y{0},ur2y{0},bl3y{0},ur3y{0},bl4y{0},ur4y{0};
while(n--){
cin >> x >> y;
if(x>0&&y>0){
if(bl1x==0){
bl1x = ur1x = x;
bl1y = ur1y = y;
}else{
if(x<bl1x) bl1x = x;
if(y<bl1y) bl1y = y;
if(x>ur1x) ur1x = x;
if(y>ur1y) ur1y = y;
}
}
else if(x<0&&y>0){
if(bl2x==0){
bl2x = ur2x = x;
bl2y = ur2y = y;
}else{
if(x<bl2x) bl2x = x;
if(y<bl2y) bl2y = y;
if(x>ur2x) ur2x = x;
if(y>ur2y) ur2y = y;
}
}
else if(x<0&&y<0){
if(bl3x==0){
bl3x = ur3x = x;
bl3y = ur3y = y;
}else{
if(x<bl3x) bl3x = x;
if(y<bl3y) bl3y = y;
if(x>ur3x) ur3x = x;
if(y>ur3y) ur3y = y;
}
}
else if(x>0&&y<0){
if(bl4x==0){
bl4x = ur4x = x;
bl4y = ur4y = y;
}else{
if(x<bl4x) bl4x = x;
if(y<bl4y) bl4y = y;
if(x>ur4x) ur4x = x;
if(y>ur4y) ur4y = y;
}
}
}
if(bl1x==0&&bl2x==0&&bl3x==0&&bl4x==0){
cout << "No point in any quadrant";
return 0;
}
if(bl1x!=0) cout<<"Q1: ("<<bl1x<<", "<<bl1y<<") ("<<ur1x<<", "<<ur1y<<") "<<abs((bl1x-ur1x)*(bl1y-ur1y))<<"\n";
if(bl2x!=0) cout<<"Q2: ("<<bl2x<<", "<<bl2y<<") ("<<ur2x<<", "<<ur2y<<") "<<abs((bl2x-ur2x)*(bl2y-ur2y))<<"\n";
if(bl3x!=0) cout<<"Q3: ("<<bl3x<<", "<<bl3y<<") ("<<ur3x<<", "<<ur3y<<") "<<abs((bl3x-ur3x)*(bl3y-ur3y))<<"\n";
if(bl4x!=0) cout<<"Q4: ("<<bl4x<<", "<<bl4y<<") ("<<ur4x<<", "<<ur4y<<") "<<abs((bl4x-ur4x)*(bl4y-ur4y))<<"\n";
} |
# 2070872, 2024-11-02 13:27:34, PPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n,q1=0,q2=0,q3=0,q4=0;
cin>>n;
map <string,set<pair<int,int>>> m;
set<pair<int,int>> s;
pair<int,int> p,rl,ru;
while (n--){
int x,y;
cin>>x>>y;
p=make_pair(x,y);
if(x>0&&y>0){
m["Q1"].insert(p);
q1++;
}
if(x<0&&y>0){
m["Q2"].insert(p);
q2++;
}
if(x<0&&y<0){
m["Q3"].insert(p);
q3++;
}
if(x>0&&y<0){
m["Q4"].insert(p);
q4++;
}
}/*
for (auto it : m["Q1"]){
cout<<it.first;
}*/
//------------------------------------q1
if(q1){
int mnx1=100000,mxx2=-100000,mny1=100000,mxy2=-100000;
int sum=0;
for(auto it : m["Q1"]){
mnx1=min(it.first,mnx1);
mxx2=max(it.first,mxx2);
mny1=min(it.second,mny1);
mxy2=max(it.second,mxy2);
}
if(mnx1!=mxx2&&mny1!=mxy2){
sum=(mxx2-mnx1)*(mxy2-mny1);
}
cout<<"Q1: ("<<mnx1<<", "<<mny1<<") ("<<mxx2<<", "<<mxy2<<") "<<sum<<endl;
}
//------------------------------------------q2
if(q2){
int mnx1=100000,mxx2=-100000,mny1=100000,mxy2=-100000;
int sum=0;
for(auto it : m["Q2"]){
mnx1=min(it.first,mnx1);
mxx2=max(it.first,mxx2);
mny1=min(it.second,mny1);
mxy2=max(it.second,mxy2);
}
if(mnx1!=mxx2&&mny1!=mxy2){
sum=(mxx2-mnx1)*(mxy2-mny1);
}
cout<<"Q2: ("<<mnx1<<", "<<mny1<<") ("<<mxx2<<", "<<mxy2<<") "<<sum<<endl;
}
//-------------------------------------------------------q3
if(q3){
int mnx1=100000,mxx2=-100000,mny1=100000,mxy2=-100000;
int sum=0;
for(auto it : m["Q3"]){
mnx1=min(it.first,mnx1);
mxx2=max(it.first,mxx2);
mny1=min(it.second,mny1);
mxy2=max(it.second,mxy2);
}
if(mnx1!=mxx2&&mny1!=mxy2){
sum=(mxx2-mnx1)*(mxy2-mny1);
}
cout<<"Q3: ("<<mnx1<<", "<<mny1<<") ("<<mxx2<<", "<<mxy2<<") "<<sum<<endl;
}
if(q4){
int mnx1=100000,mxx2=-100000,mny1=100000,mxy2=-100000;
int sum=0;
for(auto it : m["Q4"]){
mnx1=min(it.first,mnx1);
mxx2=max(it.first,mxx2);
mny1=min(it.second,mny1);
mxy2=max(it.second,mxy2);
}
if(mnx1!=mxx2&&mny1!=mxy2){
sum=(mxx2-mnx1)*(mxy2-mny1);
}
cout<<"Q4: ("<<mnx1<<", "<<mny1<<") ("<<mxx2<<", "<<mxy2<<") "<<sum<<endl;
}
if(q1+q2+q3+q4==0){
cout<<"No point in any quadrant";
}
} |
# 2070768, 2024-11-02 13:14:10, PPPPPPPPPP (100%)
#include <iostream>
#include <vector>
#include <map>
struct XY
{
long long x = 0;
long long y = 0;
bool eqZero()
{
return (x == 0 && y == 0);
}
void assign(long long asX, long long asY)
{
x = asX;
y = asY;
}
};
struct Area
{
XY min;
XY max;
long long calcArea()
{
long long x = max.x - min.x;
long long y = max.y - min.y;
return (x * y);
}
};
int main()
{
long long amt;
std::cin >> amt;
std::string type;
std::map<std::string, std::vector<XY>> pairs;
std::map<std::string, bool> found;
for (int i = 0; i < amt; ++i)
{
XY tmp;
std::cin >> tmp.x >> tmp.y;
if (tmp.x == 0 || tmp.y == 0)
continue;
if (tmp.x > 0 && tmp.y > 0)
{
pairs["Q1"].push_back(tmp);
found["Q1"] = true;
}
else if (tmp.x < 0 && tmp.y > 0)
{
pairs["Q2"].push_back(tmp);
found["Q2"] = true;
}
else if (tmp.x < 0 && tmp.y < 0)
{
pairs["Q3"].push_back(tmp);
found["Q3"] = true;
}
else if (tmp.x > 0 && tmp.y < 0)
{
pairs["Q4"].push_back(tmp);
found["Q4"] = true;
}
}
if (!found["Q1"] && !found["Q2"] && !found["Q3"] && !found["Q4"])
{
std::cout << "No point in any quadrant";
return 0;
}
std::map<std::string, Area> area;
for (auto i : pairs)
{
if (!found[i.first])
continue;
for (auto j : i.second)
{
if (area[i.first].min.eqZero() && area[i.first].max.eqZero())
{
area[i.first].min.assign(j.x, j.y);
area[i.first].max.assign(j.x, j.y);
}
else
{
if (area[i.first].min.x > j.x)
area[i.first].min.x = j.x;
if (area[i.first].min.y > j.y)
area[i.first].min.y = j.y;
if (area[i.first].max.x < j.x)
area[i.first].max.x = j.x;
if (area[i.first].max.y < j.y)
area[i.first].max.y = j.y;
}
}
}
for (auto i : area)
{
if (!found[i.first])
continue;
std::cout << i.first << ": ";
std::cout << "(" << i.second.min.x << ", " << i.second.min.y << ") ";
std::cout << "(" << i.second.max.x << ", " << i.second.max.y << ") ";
std::cout << i.second.calcArea() << std::endl;
}
} |
# 2069009, 2024-11-02 10:02:45, PPPPPPPPPP (100%)
#include <iostream>
#include <vector>
#include <utility>
#include <cmath>
using namespace std;
pair <int,int> minpair (vector <pair <int,int>> q) {
int minx = q[0].first, miny =q[0].second;
for (auto each : q) {
if (minx > each.first) minx = each.first;
if (miny > each.second) miny = each.second;
}
return make_pair(minx,miny);
}
pair <int,int> maxpair (vector <pair <int,int>> q) {
int maxx = q[0].first, maxy =q[0].second;
for (auto each : q) {
if (maxx < each.first) maxx = each.first;
if (maxy < each.second) maxy = each.second;
}
return make_pair(maxx,maxy);
}
int main () {
int n;
cin >> n;
vector <pair <int,int>> q1, q2, q3, q4;
for (int i=0;i<n;i++) {
int x,y;
cin >> x >> y;
if (x==0 || y==0) continue;
if (x>0) {
if (y>0) q1.push_back(make_pair(x,y));
else q4.push_back(make_pair(x,y));
}
else {
if (y>0) q2.push_back(make_pair(x,y));
else q3.push_back(make_pair(x,y));
}
}
if (q1.size() == 0 && q2.size() == 0 && q3.size() == 0 && q4.size() == 0) {
cout << "No point in any quadrant";
return 0;
}
if (q1.size() != 0) {
int maxx = maxpair(q1).first;
int maxy = maxpair(q1).second;
int minx = minpair(q1).first;
int miny = minpair(q1).second;
int area = (maxx - minx) * (maxy - miny);
cout << "Q1: (" << minx << ", " << miny << ") ";
cout << "(" << maxx << ", " << maxy << ") " << area << endl;
}
if (q2.size() != 0) {
int maxx = maxpair(q2).first;
int maxy = maxpair(q2).second;
int minx = minpair(q2).first;
int miny = minpair(q2).second;
int area = (maxx - minx) * (maxy - miny);
cout << "Q2: (" << minx << ", " << miny << ") ";
cout << "(" << maxx << ", " << maxy << ") " << area << endl;
}
if (q3.size() != 0) {
int maxx = maxpair(q3).first;
int maxy = maxpair(q3).second;
int minx = minpair(q3).first;
int miny = minpair(q3).second;
int area = (maxx - minx) * (maxy - miny);
cout << "Q3: (" << minx << ", " << miny << ") ";
cout << "(" << maxx << ", " << maxy << ") " << area << endl;
}
if (q4.size() != 0) {
int maxx = maxpair(q4).first;
int maxy = maxpair(q4).second;
int minx = minpair(q4).first;
int miny = minpair(q4).second;
int area = (maxx - minx) * (maxy - miny);
cout << "Q4: (" << minx << ", " << miny << ") ";
cout << "(" << maxx << ", " << maxy << ") " << area << endl;
}
} |
# 2069229, 2024-11-02 10:28:28, PPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
int main()
{
vector<pair<int,int>> Q1;
vector<pair<int,int>> Q2;
vector<pair<int,int>> Q3;
vector<pair<int,int>> Q4;
int n,nn,m,mm,x,y;
cin>>n;
for(int i=0;i<n;i++){
cin>>x>>y;
if(x>0 && y>0){
Q1.push_back(make_pair(x,y));
}
else if(x<0 && y>0){
Q2.push_back(make_pair(x,y));
}
else if(x<0 && y<0){
Q3.push_back(make_pair(x,y));
}
else if(x>0 && y<0){
Q4.push_back(make_pair(x,y));
}
}
int low1=10000000;
int low2=10000000;
int up1=-10000000;
int up2=-10000000;
for(auto q1:Q1){
low1 = min(q1.first,low1);
low2 = min(q1.second,low2);
up1 = max(q1.first,up1);
up2 = max(q1.second,up2);
//cout<<low1<<low2<<up1<<up2<<endl;
}
if(!Q1.empty()){
cout<<"Q1: "<<"("<<low1<<", "<<low2<<")"<<" "<<"("<<up1<<", "<<up2<<") "<<abs(up1-low1)*abs(up2-low2)<<endl;
}
low1=10000000;
low2=10000000;
up1=-10000000;
up2=-10000000;
for(auto q2:Q2){
low1 = min(q2.first,low1);
low2 = min(q2.second,low2);
up1 = max(q2.first,up1);
up2 = max(q2.second,up2);
//cout<<low1<<low2<<up1<<up2<<endl;
}
if(!Q2.empty()){
cout<<"Q2: "<<"("<<low1<<", "<<low2<<")"<<" "<<"("<<up1<<", "<<up2<<") "<<abs(up1-low1)*abs(up2-low2)<<endl;
}
low1=10000000;
low2=10000000;
up1=-10000000;
up2=-10000000;
for(auto q3:Q3){
low1 = min(q3.first,low1);
low2 = min(q3.second,low2);
up1 = max(q3.first,up1);
up2 = max(q3.second,up2);
//cout<<low1<<low2<<up1<<up2<<endl;
}
if(!Q3.empty()){
cout<<"Q3: "<<"("<<low1<<", "<<low2<<")"<<" "<<"("<<up1<<", "<<up2<<") "<<abs(up1-low1)*abs(up2-low2)<<endl;
}
low1=10000000;
low2=10000000;
up1=-10000000;
up2=-10000000;
for(auto q4:Q4){
low1 = min(q4.first,low1);
low2 = min(q4.second,low2);
up1 = max(q4.first,up1);
up2 = max(q4.second,up2);
//cout<<low1<<low2<<up1<<up2<<endl;
}
if(!Q4.empty()){
cout<<"Q4: "<<"("<<low1<<", "<<low2<<")"<<" "<<"("<<up1<<", "<<up2<<") "<<abs(up1-low1)*abs(up2-low2)<<endl;
}
if(Q4.empty() && Q3.empty() && Q2.empty() && Q1.empty()){
cout<<"No point in any quadrant";
}
// int 2low1=10000000;
// int 2low2=10000000;
// int 2up1=-10000000;
// int 2up2=-10000000;
// for(auto q2:Q2){
// 2low1 = min(q2.first,2low1);
// 2low2 = min(q2.second,2low2);
// 2up1 = max(q2.first,2up1);
// 2up2 = max(q2.second,2up2);
// //cout<<low1<<low2<<up1<<up2<<endl;
// }
// if(!Q2.empty()){
// cout<<"Q1: "<<"("<<2low1<<", "<<2low2<<")"<<" "<<"("<<2up1<<", "<<2up2<<") "<<abs(2up1-2low1)*abs(2up2-2low2)<<endl;
// }
}
// 19
// 2 2
// 4 6
// 5 5
// 1 0
// -1 2
// -3 4
// -2 6
// 0 -3
// -5 7
// -4 5
// -6 3
// 0 4
// -2 -2
// -5 -6
// -7 0
// 6 -4
// 4 -6
// 3 -2
// 2 -5 |
# 2069158, 2024-11-02 10:19:38, PPPPPPPPPP (100%)
#include <iostream>
#include <set>
#include <vector>
#include <math.h>
using namespace std;
int area(set<pair<int,int>> & s){
int left=0,right=0,bottom=0,top=0,leftp=0,rightp=0,bottomp=0,topp=0;
bool start=1;
for(auto i : s){
if(start){
left=right=abs(i.first);
bottom=top=abs(i.second);
leftp=rightp=i.first;
bottomp=topp=i.second;
start=0;
}
if(abs(i.first)<left){
left=abs(i.first);
leftp=i.first;
}else if(abs(i.first)>right){
right=abs(i.first);
rightp=i.first;
}
if(abs(i.second)>top){
top=abs(i.second);
topp=i.second;
}else if(abs(i.second)<bottom){
bottom=abs(i.second);
bottomp=i.second;
}
}
s.clear();
if((leftp<0&&bottomp>0)||(leftp>0&&bottomp<0)){
s.insert(make_pair(leftp,topp));
s.insert(make_pair(rightp,bottomp));
}else{
s.insert(make_pair(leftp,bottomp));
s.insert(make_pair(rightp,topp));
}
return abs(top-bottom)*abs(right-left);
}
int main(){
int i,n,xi,yi;
cin >> n;
set<pair<int,int>> q1;
set<pair<int,int>> q2;
set<pair<int,int>> q3;
set<pair<int,int>> q4;
for(i=0;i<n;++i){
cin >> xi >> yi;
if(xi>0&&yi>0){
q1.insert(make_pair(xi,yi));
}else if(xi>0&&yi<0){
q4.insert(make_pair(xi,yi));
}else if(xi<0&&yi>0){
q2.insert(make_pair(xi,yi));
}else if(xi<0&& yi<0){
q3.insert(make_pair(xi,yi));
}
}
if(q1.size()==0&&q2.size()==0&&q3.size()==0&&q4.size()==0){
cout << "No point in any quadrant";
}else{
int ar;
if(q1.size()!=0){
ar=area(q1) ;
cout << "Q1: ";
for(auto j : q1){
cout << "(" << j.first << ", " << j.second << ") ";
if(q1.size()==1){
cout << "(" << j.first << ", " << j.second << ") ";
}
}
cout << ar<< endl;
}
if(q2.size()!=0){
ar=area(q2);
cout << "Q2: ";
for(auto j : q2){
cout << "(" << j.first << ", " << j.second << ") ";
if(q2.size()==1){
cout << "(" << j.first << ", " << j.second << ") ";
}
}
cout << ar << endl;
}
if(q3.size()!=0){
ar=area(q3);
cout << "Q3: ";
for(auto j : q3){
cout << "(" << j.first << ", " << j.second << ") ";
if(q3.size()==1){
cout << "(" << j.first << ", " << j.second << ") ";
}
}
cout << ar << endl;
}
if(q4.size()!=0){
ar=area(q4);
cout << "Q4: ";
for(auto j : q4){
cout << "(" << j.first << ", " << j.second << ") ";
if(q4.size()==1){
cout << "(" << j.first << ", " << j.second << ") ";
}
}
cout << ar << endl;
}
}
} |
# 2071261, 2024-11-02 14:14:22, PPPPPPPPPP (100%)
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
vector<pair<int,int>> Q1,Q2,Q3,Q4 ;
int main(){
int a;
cin >> a;
for(int i=0; i<a; i++){
int x,y;
cin >> x >> y;
if(x==0 || y==0) continue;
else{
pair<int, int> p={x,y};
if(x>0 && y>0) Q1.push_back(p);
if(x>0 && y<0) Q4.push_back(p);
if(x<0 && y>0) Q2.push_back(p);
if(x<0 && y<0) Q3.push_back(p);
}
}
int Q1_xmin=1e7, Q1_ymin=1e7, Q1_xmax=0, Q1_ymax=0;
for(int i=0; i<Q1.size(); i++){
if(Q1[i].first > Q1_xmax) Q1_xmax = Q1[i].first;
if(Q1[i].first < Q1_xmin) Q1_xmin = Q1[i].first;
if(Q1[i].second > Q1_ymax) Q1_ymax = Q1[i].second;
if(Q1[i].second < Q1_ymin) Q1_ymin = Q1[i].second;
}
int Q2_xmin=1e7, Q2_ymin=1e7, Q2_xmax=-1e7, Q2_ymax=-1e7;
for(int i=0; i<Q2.size(); i++){
if(Q2[i].first > Q2_xmax) Q2_xmax = Q2[i].first;
if(Q2[i].first < Q2_xmin) Q2_xmin = Q2[i].first;
if(Q2[i].second > Q2_ymax) Q2_ymax = Q2[i].second;
if(Q2[i].second < Q2_ymin) Q2_ymin = Q2[i].second;
}
int Q3_xmin=0, Q3_ymin=0, Q3_xmax=-1e7, Q3_ymax=-1e7;
for(int i=0; i<Q3.size(); i++){
if(Q3[i].first > Q3_xmax) Q3_xmax = Q3[i].first;
if(Q3[i].first < Q3_xmin) Q3_xmin = Q3[i].first;
if(Q3[i].second > Q3_ymax) Q3_ymax = Q3[i].second;
if(Q3[i].second < Q3_ymin) Q3_ymin = Q3[i].second;
}
int Q4_xmin=1e7, Q4_ymin=1e7, Q4_xmax=-1e7, Q4_ymax=-1e7;
for(int i=0; i<Q4.size(); i++){
if(Q4[i].first > Q4_xmax) Q4_xmax = Q4[i].first;
if(Q4[i].first < Q4_xmin) Q4_xmin = Q4[i].first;
if(Q4[i].second > Q4_ymax) Q4_ymax = Q4[i].second;
if(Q4[i].second < Q4_ymin) Q4_ymin = Q4[i].second;
}
if(Q1.empty() && Q2.empty() && Q3.empty() && Q4.empty()){
cout << "No point in any quadrant";
return 0;
}
if(!Q1.empty()){
if(Q1.size()==1){
cout << "Q1: (" << Q1[0].first << ", " << Q1[0].second << ") " <<
"(" << Q1[0].first << ", " << Q1[0].second << ") " << 0 << '\n';
}else{
cout << "Q1: (" << Q1_xmin << ", " << Q1_ymin << ") (" <<
Q1_xmax << ", " << Q1_ymax << ") " << (Q1_xmax-Q1_xmin)*(Q1_ymax-Q1_ymin) << '\n';
}
}
if(!Q2.empty()){
if(Q2.size()==1){
cout << "Q2: (" << Q2[0].first << ", " << Q2[0].second << ") " <<
"(" << Q2[0].first << ", " << Q2[0].second << ") " << 0 << '\n';
}else{
cout << "Q2: (" << Q2_xmin << ", " << Q2_ymin << ") (" <<
Q2_xmax << ", " << Q2_ymax << ") " << (Q2_xmax-Q2_xmin)*(Q2_ymax-Q2_ymin) << '\n';
}
}
if(!Q3.empty()){
if(Q3.size()==1){
cout << "Q3: (" << Q3[0].first << ", " << Q3[0].second << ") " <<
"(" << Q3[0].first << ", " << Q3[0].second << ") " << 0 << '\n';
}else{
cout << "Q3: (" << Q3_xmin << ", " << Q3_ymin << ") (" <<
Q3_xmax << ", " << Q3_ymax << ") " << (Q3_xmax-Q3_xmin)*(Q3_ymax-Q3_ymin) << '\n';
}
}
if(!Q4.empty()){
if(Q4.size()==1){
cout << "Q4: (" << Q4[0].first << ", " << Q4[0].second << ") " <<
"(" << Q4[0].first << ", " << Q4[0].second << ") " << 0 << '\n';
}else{
cout << "Q4: (" << Q4_xmin << ", " << Q4_ymin << ") (" <<
Q4_xmax << ", " << Q4_ymax << ") " << (Q4_xmax-Q4_xmin)*(Q4_ymax-Q4_ymin) << '\n';
}
}
// //1 point
// cout << "Q1: (" << Q1[0].first << ", " << Q1[0].second << ")" << 1 << '\n';
// //2 point up
// cout << "Q1: (" << Q1_xmin << ", " << Q1_ymin << ") (" <<
// Q1_xmax << ", " << Q1_ymax << ") " << (Q1_xmax-Q1_xmin)*(Q1_ymax-Q1_ymin) << '\n';
// cout << "Q2: (" << Q2_xmin << ", " << Q2_ymin << ") (" <<
// Q2_xmax << ", " << Q2_ymax << ") " << (Q2_xmax-Q2_xmin)*(Q2_ymax-Q2_ymin) << '\n';
// cout << "Q3: (" << Q3_xmin << ", " << Q3_ymin << ") (" <<
// Q3_xmax << ", " << Q3_ymax << ") " << (Q3_xmax-Q3_xmin)*(Q3_ymax-Q3_ymin) << '\n';
// cout << "Q4: (" << Q4_xmin << ", " << Q4_ymin << ") (" <<
// Q4_xmax << ", " << Q4_ymax << ") " << (Q4_xmax-Q4_xmin)*(Q4_ymax-Q4_ymin) << '\n';
}
/*
19
2 2
4 6
5 5
1 0
-1 2
-3 4
-2 6
0 -3
-5 7
-4 5
-6 3
0 4
-2 -2
-5 -6
-7 0
6 -4
4 -6
3 -2
2 -5
*/ |
# 2069211, 2024-11-02 10:26:14, PPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
int main() {
int in;
int x,y;
set<int> xq1,xq2,xq3,xq4,yq1,yq2,yq3,yq4;
cin >> in;
for(int i =0;i<in;i++){
cin >> x >> y;
if(x<0){
if(y<0){
xq3.insert(x);
yq3.insert(y);}
else if(y>0){
xq2.insert(x);
yq2.insert(y);}
}
else if(x>0){
if(y<0){
xq4.insert(x);
yq4.insert(y);}
else if(y>0){
xq1.insert(x);
yq1.insert(y);}
}
}
if(xq1.empty()&&xq2.empty()&&xq3.empty()&&xq4.empty()) cout << "No point in any quadrant";
if(!xq1.empty()) cout << "Q1: ("<<*xq1.begin() << ", " << *yq1.begin()<<") (" <<*(--xq1.end()) <<", " << *(--yq1.end()) <<") " <<(*xq1.begin() - *--xq1.end())*(*yq1.begin() - *--yq1.end()) << endl;
if(!xq2.empty()) cout << "Q2: ("<<*xq2.begin() << ", " << *yq2.begin()<<") (" <<*(--xq2.end()) <<", " << *(--yq2.end()) <<") " <<(*xq2.begin() - *--xq2.end())*(*yq2.begin() - *--yq2.end()) << endl;
if(!xq3.empty()) cout << "Q3: ("<<*xq3.begin() << ", " << *yq3.begin()<<") (" <<*(--xq3.end()) <<", " << *(--yq3.end()) <<") " <<(*xq3.begin() - *--xq3.end())*(*yq3.begin() - *--yq3.end()) << endl;
if(!xq4.empty()) cout << "Q4: ("<<*xq4.begin() << ", " << *yq4.begin()<<") (" <<*(--xq4.end()) <<", " << *(--yq4.end()) <<") " <<(*xq4.begin() - *--xq4.end())*(*yq4.begin() - *--yq4.end()) << endl;
} |
# 2071126, 2024-11-02 13:58:21, PPPPPPPPPP (100%)
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
using namespace std;
int main()
{
int n;
vector<pair<int, int>> Q1;
vector<pair<int, int>> Q2;
vector<pair<int, int>> Q3;
vector<pair<int, int>> Q4;
cin >> n;
for(int i = 0; i < n; ++i)
{
int a, b;
cin >> a >> b;
if(a == 0 || b == 0)
continue;
if(a > 0 && b > 0)
Q1.push_back(make_pair(a,b));
else if(a < 0 && b > 0)
Q2.push_back(make_pair(a,b));
else if(a < 0 && b < 0)
Q3.push_back(make_pair(a,b));
else if(a > 0 && b < 0)
Q4.push_back(make_pair(a,b));
}
if(Q1.empty() && Q2.empty() && Q3.empty() &&Q4.empty())
cout << "No point in any quadrant" << endl;
else
{
if(!Q1.empty())
{
cout << "Q1: ";
//sort(Q1.begin(), Q1.end());
int min_x = 999999, max_x = -99999999, min_y = 9999999, max_y = -99999999;
for(auto q1 : Q1)
{
//cout << q1.first << ' ' << q1.second;
if(q1.first > max_x)
max_x = q1.first;
if(q1.first < min_x)
min_x = q1.first;
if(q1.second > max_y)
max_y = q1.second;
if(q1.second < min_y)
min_y = q1.second;
}
int area = (max_x - min_x)*(max_y - min_y);
cout << "(" << min_x << ", " << min_y << ")" << " " << "(" << max_x << ", " << max_y << ") " << area << endl;
//cout << min_x << ' ' << max_x << ' ' << min_y << ' ' << max_y;
}
if(!Q2.empty())
{
cout << "Q2: ";
int min_x = 999999, max_x = -9999999999, min_y = 9999999, max_y = -999999999;
for(auto q2 : Q2)
{
if(q2.first > max_x)
max_x = q2.first;
if(q2.first < min_x)
min_x = q2.first;
if(q2.second > max_y)
max_y = q2.second;
if(q2.second < min_y)
min_y = q2.second;
}
int area = (max_x - min_x)*(max_y - min_y);
cout << "(" << min_x << ", " << min_y << ")" << " " << "(" << max_x << ", " << max_y << ") " << area << endl;
//cout << min_x << ' ' << max_x << ' ' << min_y << ' ' << max_y;
}
if(!Q3.empty())
{
cout << "Q3: ";
int min_x = 999999, max_x = -9999999999, min_y = 9999999, max_y = -999999999;
for(auto q3 : Q3)
{
if(q3.first > max_x)
max_x = q3.first;
if(q3.first < min_x)
min_x = q3.first;
if(q3.second > max_y)
max_y = q3.second;
if(q3.second < min_y)
min_y = q3.second;
}
int area = (max_x - min_x)*(max_y - min_y);
cout << "(" << min_x << ", " << min_y << ")" << " " << "(" << max_x << ", " << max_y << ") " << area << endl;
//cout << min_x << ' ' << max_x << ' ' << min_y << ' ' << max_y;
}
if(!Q4.empty())
{
cout << "Q4: ";
int min_x = 999999, max_x = -9999999999, min_y = 9999999, max_y = -999999999;
for(auto q4 : Q4)
{
if(q4.first > max_x)
max_x = q4.first;
if(q4.first < min_x)
min_x = q4.first;
if(q4.second > max_y)
max_y = q4.second;
if(q4.second < min_y)
min_y = q4.second;
}
int area = (max_x - min_x)*(max_y - min_y);
cout << "(" << min_x << ", " << min_y << ")" << " " << "(" << max_x << ", " << max_y << ") " << area << endl;
//cout << min_x << ' ' << max_x << ' ' << min_y << ' ' << max_y;
}
}
} |
# 2069629, 2024-11-02 11:05:22, PPPPPPPPPP (100%)
#include<iostream>
#include<utility>
#include<vector>
using namespace std;
int main(){
int n,a,b;
// int left1 = 0, rig1 = 10000, top1 = 10000, bot1 = 0;
// int left2 = -10000, rig2 = 0, top2 = 10000, bot2 = 0;
// int left3 = -10000, rig3 = 0, top3 = 0, bot3 = -10000;
// int left4 = 0, rig4 = 10000, top4 = 0, bot4 = -10000;
// pair<int, int> p1, p2, p3, p4;
vector<pair<int,int>> v1, v2, v3, v4;
cin >> n;
for(int i=0;i<n;i++){
bool posx = true, posy = true;
cin >> a >> b;
if(a==0||b==0){
continue;
}
if(a<0){
posx = false;
}
if(b<0){
posy = false;
}
if(posx && posy){
// p1 = make_pair(a, b);
v1.push_back(make_pair(a,b));
}
if(!posx && posy){
// p2 = make_pair(a, b);
v2.push_back(make_pair(a,b));
}
if(posx && !posy){
// p3 = make_pair(a, b);
v4.push_back(make_pair(a,b));
}
if(!posx && !posy){
// p4 = make_pair(a, b);
v3.push_back(make_pair(a,b));
}
}
if(v1.empty()&&v2.empty()&&v3.empty()&&v4.empty()){
cout << "No point in any quadrant";
return 0;
}
if(!v1.empty()){
int left1 = v1[0].first, rig1 = v1[0].first, top1 = v1[0].second, bot1 = v1[0].second;
cout << "Q1: (";
for(int i=0;i<v1.size();i++){
if(v1[i].first<left1){
left1 = v1[i].first;
}
if(v1[i].first>rig1){
rig1 = v1[i].first;
}
if(v1[i].second<bot1){
bot1 = v1[i].second;
}
if(v1[i].second>top1){
top1 = v1[i].second;
}
}
cout << left1 << ", " << bot1 << ") (" << rig1 << ", " << top1 << ") " << ((rig1-left1)*(top1-bot1)) << endl;
}
if(!v2.empty()){
int left2 = v2[0].first, rig2 = v2[0].first, top2 = v2[0].second, bot2 = v2[0].second;
cout << "Q2: (";
for(int i=0;i<v2.size();i++){
if(v2[i].first<left2){
left2 = v2[i].first;
}
if(v2[i].first>rig2){
rig2 = v2[i].first;
}
if(v2[i].second<bot2){
bot2 = v2[i].second;
}
if(v2[i].second>top2){
top2 = v2[i].second;
}
}
cout << left2 << ", " << bot2 << ") (" << rig2 << ", " << top2 << ") " << ((rig2-left2)*(top2-bot2)) << endl;
}
if(!v3.empty()){
int left3 = v3[0].first, rig3 = v3[0].first, top3 = v3[0].second, bot3 = v3[0].second;
cout << "Q3: (";
for(int i=0;i<v3.size();i++){
if(v3[i].first<left3){
left3 = v3[i].first;
}
if(v3[i].first>rig3){
rig3 = v3[i].first;
}
if(v3[i].second<bot3){
bot3 = v3[i].second;
}
if(v3[i].second>top3){
top3 = v3[i].second;
}
}
cout << left3 << ", " << bot3 << ") (" << rig3 << ", " << top3 << ") " << ((rig3-left3)*(top3-bot3)) << endl;
}
if(!v4.empty()){
int left4 = v4[0].first, rig4 = v4[0].first, top4 = v4[0].second, bot4 = v4[0].second;
cout << "Q4: (";
for(int i=0;i<v4.size();i++){
if(v4[i].first<left4){
left4 = v4[i].first;
}
if(v4[i].first>rig4){
rig4 = v4[i].first;
}
if(v4[i].second<bot4){
bot4 = v4[i].second;
}
if(v4[i].second>top4){
top4 = v4[i].second;
}
}
cout << left4 << ", " << bot4 << ") (" << rig4 << ", " << top4 << ") " << ((rig4-left4)*(top4-bot4)) << endl;
}
} |
# 2069060, 2024-11-02 10:08:23, PPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
vector <pair<int,int>> q1,q2,q3,q4;
while(n--){
int x, y;
cin >> x >> y;
if(x!=0 && y!=0){
if(x>0 && y>0) q1.push_back(make_pair(x,y));
else if(x<0&&y>0) q2.push_back(make_pair(x,y));
else if(x<0&&y<0)q3.push_back(make_pair(x,y));
else if(x>0&&y<0)q4.push_back(make_pair(x,y));
}
}
//sort(q1.begin(), q1.end());
//sort(q2.begin(), q2.end());
//sort(q3.begin(), q3.end());
//sort(q4.begin(), q4.end());
//cout << "\n**********\n";
//for(auto i : q4) cout << i.first << ' ' << i.second << ' ';
//cout << "\n**********\n";
int minx = 1e9, miny = 1e9;
int maxx = -1e9, maxy = -1e9;
for(auto i : q1){
if(minx > i.first) minx = i.first;
if(miny > i.second) miny= i.second;
if(maxx < i.first) maxx = i.first;
if(maxy < i.second) maxy= i.second;
}
int minxq1 = minx;
int minyq1 =miny;
int maxxq1 = maxx;
int maxyq1 = maxy;
int sq1;
sq1 = (maxx-minx)*(maxy-miny);
minx = 1e9, miny = 1e9;
maxx = -1e9, maxy = -1e9;
for(auto i : q2){
if(minx > i.first) minx = i.first;
if(miny > i.second) miny= i.second;
if(maxx < i.first) maxx = i.first;
if(maxy < i.second) maxy= i.second;
}
int minxq2 = minx;
int minyq2 =miny;
int maxxq2 = maxx;
int maxyq2 = maxy;
int sq2;
sq2 = (maxx-minx)*(maxy-miny);
minx = 1e9, miny = 1e9;
maxx = -1e9, maxy = -1e9;
for(auto i : q3){
if(minx > i.first) minx = i.first;
if(miny > i.second) miny= i.second;
if(maxx < i.first) maxx = i.first;
if(maxy < i.second) maxy= i.second;
}
int minxq3 = minx;
int minyq3 =miny;
int maxxq3 = maxx;
int maxyq3 = maxy;
int sq3;
sq3= (maxx-minx)*(maxy-miny);
minx = 1e9, miny = 1e9;
maxx = -1e9, maxy = -1e9;
for(auto i : q4){
if(minx > i.first) minx = i.first;
if(miny > i.second) miny= i.second;
if(maxx < i.first) maxx = i.first;
if(maxy < i.second) maxy= i.second;
}
int minxq4 = minx;
int minyq4 =miny;
int maxxq4 = maxx;
int maxyq4 = maxy;
int sq4;
sq4 = (maxx-minx)*(maxy-miny);
if(q1.size() != 0){
cout << "Q1: ";
cout << "(" << minxq1 << ", " << minyq1<<") ";
cout << "(" << maxxq1 << ", " << maxyq1<<") ";
cout << sq1 << endl;
}
if(q2.size() != 0){
cout << "Q2: ";
cout << "(" << minxq2 << ", " << minyq2<<") ";
cout << "(" << maxxq2 << ", " << maxyq2<<") ";
cout << sq2 << endl;
}
if(q3.size() != 0){
cout << "Q3: ";
cout << "(" << minxq3 << ", " << minyq3<<") ";
cout << "(" << maxxq3 << ", " << maxyq3<<") ";
cout << sq3 << endl;
}
if(q4.size() != 0){
cout << "Q4: ";
cout << "(" << minxq4 << ", " << minyq4<<") ";
cout << "(" << maxxq4 << ", " << maxyq4<<") ";
cout << sq4 << endl;
}
if(q1.size() == 0 && q2.size() == 0 && q3.size() == 0 && q4.size() == 0)
cout << "No point in any quadrant";
return 0;
} |
# 2071051, 2024-11-02 13:49:02, PPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
int main() {
int n, x, y;
cin >> n;
set<pair<int, int>> q1;
set<pair<int, int>> q2;
set<pair<int, int>> q3;
set<pair<int, int>> q4;
for (int i=0;i<n;i++) {
cin >> x >> y;
if (x>0&&y>0) q1.insert(make_pair(x, y));
if (x<0&&y>0) q2.insert(make_pair(x, y));
if (x<0&&y<0) q3.insert(make_pair(x, y));
if (x>0&&y<0) q4.insert(make_pair(x, y));
}
//Q1
if (q1.size()!=0) {
int maxx=-1000000000, maxy=-1000000000;
int minx=1000000000, miny=1000000000;
for (auto p:q1) {
if (p.first>maxx) maxx=p.first;
if (p.first<minx) minx=p.first;
if (p.second>maxy) maxy=p.second;
if (p.second<miny) miny=p.second;
}
cout << "Q1: (" << minx << ", " << miny << ") (" << maxx << ", " << maxy << ") " << (maxx-minx)*(maxy-miny) << endl;
}
//Q2
if (q2.size()!=0) {
int maxx=-1000000000, maxy=-1000000000;
int minx=1000000000, miny=1000000000;
for (auto p:q2) {
if (p.first>maxx) maxx=p.first;
if (p.first<minx) minx=p.first;
if (p.second>maxy) maxy=p.second;
if (p.second<miny) miny=p.second;
}
cout << "Q2: (" << minx << ", " << miny << ") (" << maxx << ", " << maxy << ") " << (maxx-minx)*(maxy-miny) << endl;
}
//Q3
if (q3.size()!=0) {
int maxx=-1000000000, maxy=-1000000000;
int minx=1000000000, miny=1000000000;
for (auto p:q3) {
if (p.first>maxx) maxx=p.first;
if (p.first<minx) minx=p.first;
if (p.second>maxy) maxy=p.second;
if (p.second<miny) miny=p.second;
}
cout << "Q3: (" << minx << ", " << miny << ") (" << maxx << ", " << maxy << ") " << (maxx-minx)*(maxy-miny) << endl;
}
//Q4
if (q4.size()!=0) {
int maxx=-1000000000, maxy=-1000000000;
int minx=1000000000, miny=1000000000;
for (auto p:q4) {
if (p.first>maxx) maxx=p.first;
if (p.first<minx) minx=p.first;
if (p.second>maxy) maxy=p.second;
if (p.second<miny) miny=p.second;
}
cout << "Q4: (" << minx << ", " << miny << ") (" << maxx << ", " << maxy << ") " << (maxx-minx)*(maxy-miny) << endl;
}
if (q1.size()==0&&q2.size()==0&&q3.size()==0&&q4.size()==0) {
cout << "No point in any quadrant";
}
} |
# 2069116, 2024-11-02 10:13:52, PPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n; cin >> n;
int x,y;
set<pair<int,int>> q1;
set<pair<int,int>> q2;
set<pair<int,int>> q3;
set<pair<int,int>> q4;
int q1minx = INT_MAX, q1miny = INT_MAX, q1maxx = 0, q1maxy = 0;
int q2minx = 0, q2miny = INT_MAX, q2maxx = INT_MIN, q2maxy = 0;
int q3minx = 0, q3miny = 0, q3maxx = INT_MIN, q3maxy = INT_MIN;
int q4minx = INT_MAX, q4miny = 0, q4maxx = 0, q4maxy = INT_MIN;
while(n--){
cin >> x >> y;
if(x>0 && y>0){
q1.insert(make_pair(x,y));
if(x>q1maxx) q1maxx = x;
if(x<q1minx) q1minx = x;
if(y<q1miny) q1miny = y;
if(y>q1maxy) q1maxy = y;
}
else if(x<0 && y>0){
q2.insert(make_pair(x,y));
if(x>q2maxx) q2maxx = x;
if(x<q2minx) q2minx = x;
if(y<q2miny) q2miny = y;
if(y>q2maxy) q2maxy = y;
}
else if(x<0 && y<0){
q3.insert(make_pair(x,y));
if(x>q3maxx) q3maxx = x;
if(x<q3minx) q3minx = x;
if(y<q3miny) q3miny = y;
if(y>q3maxy) q3maxy = y;
}
else if(x>0 && y<0){
q4.insert(make_pair(x,y));
if(x>q4maxx) q4maxx = x;
if(x<q4minx) q4minx = x;
if(y<q4miny) q4miny = y;
if(y>q4maxy) q4maxy = y;
}
}
int s;
if(q1.size()==0 && q2.size()==0 && q3.size()==0 && q4.size()==0){
cout << "No point in any quadrant";
}
else {
if(q1.size()!=0){
s = (q1maxx-q1minx) * (q1maxy-q1miny);
cout << "Q1: (" << q1minx << ", " << q1miny << ") (" << q1maxx << ", " << q1maxy << ") " << s << endl;
}
if(q2.size()!=0){
s = (q2maxx-q2minx) * (q2maxy-q2miny);
cout << "Q2: (" << q2minx << ", " << q2miny << ") (" << q2maxx << ", " << q2maxy << ") " << s << endl;
}
if(q3.size()!=0){
s = (q3maxx-q3minx) * (q3maxy-q3miny);
cout << "Q3: (" << q3minx << ", " << q3miny << ") (" << q3maxx << ", " << q3maxy << ") " << s << endl;
}
if(q4.size()!=0){
s = (q4maxx-q4minx) * (q4maxy-q4miny);
cout << "Q4: (" << q4minx << ", " << q4miny << ") (" << q4maxx << ", " << q4maxy << ") " << s << endl;
}
}
} |
# 2069616, 2024-11-02 11:04:13, PPPPPPPPPP (100%)
#include<iostream>
#include<vector>
#include<cmath>
using namespace std;
int main(){
int n;
cin >> n;
vector<pair<int, int>> q1;
vector<pair<int, int>> q2;
vector<pair<int, int>> q3;
vector<pair<int, int>> q4;
pair<int, int> ca = make_pair(0, 0);
vector<pair<int, int>> cMax(4, ca);
vector<pair<int, int>> cMin(4, ca);
for(int i = 0; i< n; i++){
pair<int, int> tP;
cin >> tP.first >> tP.second;
if(tP.first > 0 && tP.second > 0){
if(q1.empty()){
cMax[0] = tP;
cMin[0] = tP;
}
else{
if(tP.first > cMax[0].first){
cMax[0].first = tP.first;
}
if(tP.second > cMax[0].second){
cMax[0].second = tP.second;
}
if(tP.first < cMin[0].first){
cMin[0].first = tP.first;
}
if(tP.second < cMin[0].second){
cMin[0].second = tP.second;
}
}
q1.push_back(tP);
}
else if(tP.first < 0 && tP.second > 0){
if(q2.empty()){
cMax[1] = tP;
cMin[1] = tP;
}
else{
if(tP.first > cMax[1].first){
cMax[1].first = tP.first;
}
if(tP.second > cMax[1].second){
cMax[1].second = tP.second;
}
if(tP.first < cMin[1].first){
cMin[1].first = tP.first;
}
if(tP.second < cMin[1].second){
cMin[1].second = tP.second;
}
}
q2.push_back(tP);
}
else if(tP.first < 0 && tP.second < 0){
if(q3.empty()){
cMax[2] = tP;
cMin[2] = tP;
}
else{
if(tP.first > cMax[2].first){
cMax[2].first = tP.first;
}
if(tP.second > cMax[2].second){
cMax[2].second = tP.second;
}
if(tP.first < cMin[2].first){
cMin[2].first = tP.first;
}
if(tP.second < cMin[2].second){
cMin[2].second = tP.second;
}
}
q3.push_back(tP);
}
else if(tP.first > 0 && tP.second < 0){
if(q4.empty()){
cMax[3] = tP;
cMin[3] = tP;
}
else{
if(tP.first > cMax[3].first){
cMax[3].first = tP.first;
}
if(tP.second > cMax[3].second){
cMax[3].second = tP.second;
}
if(tP.first < cMin[3].first){
cMin[3].first = tP.first;
}
if(tP.second < cMin[3].second){
cMin[3].second = tP.second;
}
}
q4.push_back(tP);
}
}
// for(auto a : cMax){
// cout << "test: " << a.first << " " << a.second << endl;
// }
// for(auto a : cMax){
// cout << "test: " << a.first << " " << a.second << endl;
// }
if(q1.empty() && q2.empty() && q3.empty() && q4.empty()){
cout << "No point in any quadrant" << endl;
}
else{
if(!q1.empty()){
cout << "Q1: ";
cout << "(" << cMin[0].first << ", " << cMin[0].second << ")";
cout << " ";
cout << "(" << cMax[0].first << ", " << cMax[0].second << ")";
cout << " ";
cout << abs((cMax[0].first-cMin[0].first) * (cMax[0].second-cMin[0].second));
cout << endl;
}
if(!q2.empty()){
cout << "Q2: ";
cout << "(" << cMin[1].first << ", " << cMin[1].second << ")";
cout << " ";
cout << "(" << cMax[1].first << ", " << cMax[1].second << ")";
cout << " ";
cout << abs((cMax[1].first-cMin[1].first) * (cMax[1].second-cMin[1].second));
cout << endl;
}
if(!q3.empty()){
cout << "Q3: ";
cout << "(" << cMin[2].first << ", " << cMin[2].second << ")";
cout << " ";
cout << "(" << cMax[2].first << ", " << cMax[2].second << ")";
cout << " ";
cout << abs((cMax[2].first-cMin[2].first) * (cMax[2].second-cMin[2].second));
cout << endl;
}
if(!q4.empty()){
cout << "Q4: ";
cout << "(" << cMin[3].first << ", " << cMin[3].second << ")";
cout << " ";
cout << "(" << cMax[3].first << ", " << cMax[3].second << ")";
cout << " ";
cout << abs((cMax[3].first-cMin[3].first) * (cMax[3].second-cMin[3].second));
cout << endl;
}
}
return 0;
} |
# 2070819, 2024-11-02 13:20:52, PPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector <int> q1x;
vector <int> q2x;
vector <int> q3x;
vector <int> q4x;
vector <int> q1y;
vector <int> q2y;
vector <int> q3y;
vector <int> q4y;
while (n--) {
int x, y;
cin >> x >> y;
if (x == 0 || y == 0) {
continue;
}
else if (x > 0 && y > 0) {
q1x.push_back(x);
q1y.push_back(y);
}
else if (x < 0 && y > 0) {
q2x.push_back(x);
q2y.push_back(y);
}
else if (x < 0 && y < 0) {
q3x.push_back(x);
q3y.push_back(y);
}
else if (x > 0 && y < 0) {
q4x.push_back(x);
q4y.push_back(y);
}
}
bool pr = true;
if (q1x.size() >= 1 && q1y.size() >= 1) {
sort(q1x.begin(), q1x.end());
sort(q1y.begin(), q1y.end());
int a = abs(q1x[0] - q1x[q1x.size()-1]), b = abs(q1y[0] - q1y[q1y.size()-1]);
cout << "Q1: (" << q1x[0] << ", " << q1y[0] << ") (" << q1x[q1x.size()-1] << ", " << q1y[q1y.size()-1] << ") " << a*b << endl;
pr = false;
}
if (q2x.size() >= 1 && q2y.size() >= 1) {
sort(q2x.begin(), q2x.end());
sort(q2y.begin(), q2y.end());
int a = abs(q2x[0] - q2x[q2x.size()-1]), b = abs(q2y[0] - q2y[q2y.size()-1]);
cout << "Q2: (" << q2x[0] << ", " << q2y[0] << ") (" << q2x[q2x.size()-1] << ", " << q2y[q2y.size()-1] << ") " << a*b << endl;
pr = false;
}
if (q3x.size() >= 1 && q3y.size() >= 1) {
sort(q3x.begin(), q3x.end());
sort(q3y.begin(), q3y.end());
int a = abs(q3x[0] - q3x[q3x.size()-1]), b = abs(q3y[0] - q3y[q3y.size()-1]);
cout << "Q3: (" << q3x[0] << ", " << q3y[0] << ") (" << q3x[q3x.size()-1] << ", " << q3y[q3y.size()-1] << ") " << a*b << endl;
pr = false;
}
if (q4x.size() >= 1 && q4y.size() >= 1) {
sort(q4x.begin(), q4x.end());
sort(q4y.begin(), q4y.end());
int a = abs(q4x[0] - q4x[q4x.size()-1]), b = abs(q4y[0] - q4y[q4y.size()-1]);
cout << "Q4: (" << q4x[0] << ", " << q4y[0] << ") (" << q4x[q4x.size()-1] << ", " << q4y[q4y.size()-1] << ") " << a*b;
pr = false;
}
if (pr) cout << "No point in any quadrant";
}
/*
Q1: (2, 2) (5, 6) 12
Q2: (-6, 2) (-1, 7) 25
Q3: (-5, -6) (-2, -2) 12
Q4: (2, -6) (6, -2) 16
*/ |
# 2070914, 2024-11-02 13:32:52, PPPPPPPPPP (100%)
#include<iostream>
#include<vector>
#include<utility>
#include<algorithm>
#include<cmath>
using namespace std;
int main(){
vector<int> xq1,xq2,xq3,xq4,yq1,yq2,yq3,yq4;
int n,x,y;cin>>n;
for(int i=0;i<n;i++){
cin>>x>>y;
if(x>0&&y>0){
xq1.push_back(x);
yq1.push_back(y);
// q1.push_back(make_pair(x,y));
}else if(x<0&&y>0){
xq2.push_back(x);
yq2.push_back(y);
// q2.push_back(make_pair(x,y));
}else if(x<0&&y<0){
xq3.push_back(x);
yq3.push_back(y);
// q3.push_back(make_pair(x,y));
}else if(x>0&&y<0){
xq4.push_back(x);
yq4.push_back(y);
// q4.push_back(make_pair(x,y));
}
}
sort(xq1.begin(),xq1.end());
sort(xq2.begin(),xq2.end());
sort(xq3.begin(),xq3.end());
sort(xq4.begin(),xq4.end());
sort(yq1.begin(),yq1.end());
sort(yq2.begin(),yq2.end());
sort(yq3.begin(),yq3.end());
sort(yq4.begin(),yq4.end());
// cout<<"Q1";
// for(auto c:xq1){
// cout<<c;
// }
// cout<< "\n , ";
// for(auto c:yq1){
// cout<<c;
// }
// cout<<"q2";
// for(auto c:xq2){
// cout<<c;
// }
// cout<< "\n , ";
// for(auto c:yq2){
// cout<<c;
// }
if(xq1.empty()&&xq2.empty()&&xq3.empty()&&xq4.empty()){
cout<<"No point in any quadrant";
}
if(!xq1.empty()){
cout<<"Q1: ("<<xq1[0]<<", "<<yq1[0]<<") ("<<xq1.back()<<", ";
cout<<yq1.back()<<") "<<abs(xq1[0]-xq1.back()) * abs(yq1[0]-yq1.back()) ;
cout<<endl;
}
if(!xq2.empty()){
cout<<"Q2: ("<<xq2[0]<<", "<<yq2[0]<<") ("<<xq2.back()<<", ";
cout<<yq2.back()<<") "<<abs(xq2[0]-xq2.back()) * abs(yq2[0]-yq2.back()) ;
cout<<endl;
}
if(!xq3.empty()){
cout<<"Q3: ("<<xq3[0]<<", "<<yq3[0]<<") ("<<xq3.back()<<", ";
cout<<yq3.back()<<") "<<abs(xq3[0]-xq3.back()) * abs(yq3[0]-yq3.back()) ;
cout<<endl;
}
if(!xq4.empty()){
cout<<"Q4: ("<<xq4[0]<<", "<<yq4[0]<<") ("<<xq4.back()<<", ";
cout<<yq4.back()<<") "<<abs(xq4[0]-xq4.back()) * abs(yq4[0]-yq4.back()) ;
}
return 0;
} |
# 2069413, 2024-11-02 10:44:26, PPPPPPPPPP (100%)
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <map>
#include <vector>
#include <set>
#include <tuple>
using namespace std;
int main(){
int n;
cin >> n;
vector<pair<int, int>> Q1, Q2, Q3, Q4;
int tempx, tempy;
for(int i = 0; i < n; i++){
cin >> tempx >> tempy;
if(tempx > 0 && tempy > 0){
Q1.push_back({tempx, tempy});
}
else if(tempx < 0 && tempy > 0){
Q2.push_back({tempx, tempy});
}
else if(tempx < 0 && tempy < 0){
Q3.push_back({tempx, tempy});
}
else if(tempx > 0 && tempy < 0){
Q4.push_back({tempx, tempy});
}
}
vector<vector<pair<int, int>>> data;
data.push_back(Q1);
data.push_back(Q2);
data.push_back(Q3);
data.push_back(Q4);
if(data[0].size() == 0 && data[1].size() == 0 && data[2].size() == 0 && data[3].size() == 0){
cout << "No point in any quadrant";
}
for(int i = 0; i < 4; i++){
if(data[i].size() == 0){
continue;
}
int x1 = INT32_MAX;
int y1 = INT32_MAX;
int x2 = INT32_MIN;
int y2 = INT32_MIN;
for(auto p : data[i]){
if (p.first < x1){
x1 = p.first;
}
if (p.first > x2){
x2 = p.first;
}
if (p.second < y1){
y1 = p.second;
}
if (p.second > y2){
y2 = p.second;
}
}
cout << "Q" << i+1 << ": (" << x1 << ", " << y1 << ")" << " (" << x2 << ", " << y2 << ") " << ((x2-x1)*(y2-y1)) << endl;
}
} |
# 2070966, 2024-11-02 13:39:16, PPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std;
int main() {
vector <pair<int,int>> q1,q2,q3,q4;
int n ; cin >> n;
pair <int,int> lo;
while(n--) {
cin >> lo.first >> lo.second;
if (lo.first > 0 && lo.second > 0) q1.push_back(lo);
else if (lo.first > 0 && lo.second < 0) q4.push_back(lo);
else if (lo.first < 0 && lo.second > 0) q2.push_back(lo);
else if (lo.first < 0 && lo.second < 0) q3.push_back(lo);
}
if (q1.empty() && q2.empty() & q3.empty() & q4.empty()) {
cout << "No point in any quadrant";
}
else {
if (!q1.empty()) {
int min_x = 1e6, min_y = 1e6, max_x = -1e6, max_y = -1e6;
for (auto &it : q1) {
min_x = min(it.first, min_x);
max_x = max(it.first, max_x);
min_y = min(it.second, min_y);
max_y = max(it.second, max_y);
}
int area = abs((max_x - min_x) * (max_y - min_y));
cout << "Q1: (" << min_x << ", " << min_y << ") (" << max_x << ", " << max_y << ") " << area << endl;
}
if (!q2.empty()) {
int min_x = 1e6, min_y = 1e6, max_x = -1e6, max_y = -1e6;
for (auto &it : q2) {
min_x = min(it.first, min_x);
max_x = max(it.first, max_x);
min_y = min(it.second, min_y);
max_y = max(it.second, max_y);
}
int area = abs((max_x - min_x) * (max_y - min_y));
cout << "Q2: (" << min_x << ", " << min_y << ") (" << max_x << ", " << max_y << ") " << area << endl;
}
if (!q3.empty()) {
int min_x = 1e6, min_y = 1e6, max_x = -1e6, max_y = -1e6;
for (auto &it : q3) {
min_x = min(it.first, min_x);
max_x = max(it.first, max_x);
min_y = min(it.second, min_y);
max_y = max(it.second, max_y);
}
int area = abs((max_x - min_x) * (max_y - min_y));
cout << "Q3: (" << min_x << ", " << min_y << ") (" << max_x << ", " << max_y << ") " << area << endl;
}
if (!q4.empty()) {
int min_x = 1e6, min_y = 1e6, max_x = -1e6, max_y = -1e6;
for (auto &it : q4) {
min_x = min(it.first, min_x);
max_x = max(it.first, max_x);
min_y = min(it.second, min_y);
max_y = max(it.second, max_y);
}
int area = abs((max_x - min_x) * (max_y - min_y));
cout << "Q4: (" << min_x << ", " << min_y << ") (" << max_x << ", " << max_y << ") " << area << endl;
}
}
} |
# 2069207, 2024-11-02 10:26:03, PPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false); cin.tie(0);
vector<pair<int,int>> q1, q2, q3, q4;
int N; cin >> N;
int x, y;
while (N--)
{
cin >> x >> y;
if(x == 0 || y == 0){
continue;
}
// q1
if(x > 0 && y > 0){
q1.push_back({x,y});
}
//q2
if(x < 0 && y > 0){
q2.push_back({x,y});
}
//q3
if(x < 0 && y < 0){
q3.push_back({x,y});
}
//q4
if(x > 0 && y < 0){
q4.push_back({x,y});
}
}
int x1 = INT16_MAX, x2 = INT16_MIN, y1 = INT16_MAX, y2 = INT16_MIN;
for(auto e: q1){
x1 = min(x1, e.first);
x2 = max(x2, e.first);
y1 = min(y1, e.second);
y2 = max(y2, e.second);
}
if(!q1.empty())
cout << "Q1: " << "(" << x1 << ", " << y1 << ") (" << x2 << ", " << y2 << ") " << abs(x1 - x2 )* abs(y1 - y2) << endl;
x1 = INT16_MAX, x2 = INT16_MIN, y1 = INT16_MAX, y2 = INT16_MIN;
for(auto e: q2){
x1 = min(x1, e.first);
x2 = max(x2, e.first);
y1 = min(y1, e.second);
y2 = max(y2, e.second);
}
if(!q2.empty())
cout << "Q2: " << "(" << x1 << ", " << y1 << ") (" << x2 << ", " << y2 << ") " << abs(x1 - x2 )* abs(y1 - y2)<< endl;
x1 = INT16_MAX, x2 = INT16_MIN, y1 = INT16_MAX, y2 = INT16_MIN;
for(auto e: q3){
x1 = min(x1, e.first);
x2 = max(x2, e.first);
y1 = min(y1, e.second);
y2 = max(y2, e.second);
}
if(!q3.empty())
cout << "Q3: " << "(" << x1 << ", " << y1 << ") (" << x2 << ", " << y2 << ") " << abs(x1 - x2 )* abs(y1 - y2)<< endl;
x1 = INT16_MAX, x2 = INT16_MIN, y1 = INT16_MAX, y2 = INT16_MIN;
for(auto e: q4){
x1 = min(x1, e.first);
x2 = max(x2, e.first);
y1 = min(y1, e.second);
y2 = max(y2, e.second);
}
if(!q4.empty())
cout << "Q4: " << "(" << x1 << ", " << y1 << ") (" << x2 << ", " << y2 << ") " << abs(x1 - x2 )* abs(y1 - y2)<< endl;
if(q1.empty() && q2.empty() && q3.empty() && q4.empty()){
cout << "No point in any quadrant";
}
return 0;
} |
# 2071727, 2024-11-02 15:09:01, PPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std ;
int main() {
int n ; cin >> n ;
int x, y ;
set<int> xQ1, xQ2, xQ3, xQ4 ;
set<int> yQ1, yQ2, yQ3, yQ4 ;
bool empty1 = true, empty2 = true, empty3 = true, empty4 = true ;
for(int i = 0 ; i < n ; i++) {
cin >> x >> y ;
if(x > 0 && y > 0) {
empty1 = false ;
xQ1.insert(x) ;
yQ1.insert(y) ;
}
else if(x < 0 && y > 0) {
empty2 = false ;
xQ2.insert(x) ;
yQ2.insert(y) ;
}
else if(x < 0 && y < 0) {
empty3 = false ;
xQ3.insert(x) ;
yQ3.insert(y) ;
}
else if(x > 0 && y < 0) {
empty4 = false ;
xQ4.insert(x) ;
yQ4.insert(y) ;
}
else continue ;
}
if(empty1 && empty2 && empty3 && empty4) {
cout << "No point in any quadrant" ;
return 0 ;
}
if(!empty1) {
pair<int, int> min1 = make_pair(*xQ1.begin(), *yQ1.begin()) ;
pair<int, int> max1 = make_pair(*xQ1.rbegin(), *yQ1.rbegin()) ;
cout << "Q1: " << "(" << min1.first << ", " << min1.second << ") (" << max1.first << ", " << max1.second << ") " << abs((max1.first - min1.first) * (max1.second - min1.second)) << endl ;
}
if(!empty2) {
pair<int, int> min2 = make_pair(*xQ2.begin(), *yQ2.begin()) ;
pair<int, int> max2 = make_pair(*xQ2.rbegin(), *yQ2.rbegin()) ;
cout << "Q2: " << "(" << min2.first << ", " << min2.second << ") (" << max2.first << ", " << max2.second << ") " << abs((max2.first - min2.first) * (max2.second - min2.second)) << endl ;
}
if(!empty3) {
pair<int, int> min3 = make_pair(*xQ3.begin(), *yQ3.begin()) ;
pair<int, int> max3 = make_pair(*xQ3.rbegin(), *yQ3.rbegin()) ;
cout << "Q3: " << "(" << min3.first << ", " << min3.second << ") (" << max3.first << ", " << max3.second << ") " << abs((max3.first - min3.first) * (max3.second - min3.second)) << endl ;
}
if(!empty4) {
pair<int, int> min4 = make_pair(*xQ4.begin(), *yQ4.begin()) ;
pair<int, int> max4 = make_pair(*xQ4.rbegin(), *yQ4.rbegin()) ;
cout << "Q4: " << "(" << min4.first << ", " << min4.second << ") (" << max4.first << ", " << max4.second << ") " << abs((max4.first - min4.first) * (max4.second - min4.second)) << endl ;
}
} |
# 2071056, 2024-11-02 13:49:40, PPPPPPPPPP (100%)
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
int n;
cin >> n;
float x,y;
vector<int> q1x, q1y, q2x, q2y, q3x, q3y, q4x, q4y;
while(n--){
cin >> x >> y;
if(x>0 && y>0){
q1x.push_back(x);
q1y.push_back(y);
}
else if(x<0 && y>0){
q2x.push_back(x);
q2y.push_back(y);
}
else if(x<0 && y<0){
q3x.push_back(x);
q3y.push_back(y);
}
else if(x>0 && y<0){
q4x.push_back(x);
q4y.push_back(y);
}
}
sort(q1x.begin(), q1x.end()); sort(q1y.begin(), q1y.end());
sort(q2x.begin(), q2x.end()); sort(q2y.begin(), q2y.end());
sort(q3x.begin(), q3x.end()); sort(q3y.begin(), q3y.end());
sort(q4x.begin(), q4x.end()); sort(q4y.begin(), q4y.end());
bool found = false;
if(!q1x.empty()){
cout << "Q1: (" << q1x[0] << ", " << q1y[0] << ") ("
<< q1x[q1x.size()-1] << ", " << q1y[q1y.size()-1] << ") "
<< (q1x[q1x.size()-1] - q1x[0])*(q1y[q1y.size()-1] - q1y[0])<< endl;
found = true;
}
if(!q2x.empty()){
cout << "Q2: (" << q2x[0] << ", " << q2y[0] << ") ("
<< q2x[q2x.size()-1] << ", " << q2y[q2y.size()-1] << ") "
<< (q2x[q2x.size()-1] - q2x[0])*(q2y[q2y.size()-1] - q2y[0])<< endl;
found = true;
}
if(!q3x.empty()){
cout << "Q3: (" << q3x[0] << ", " << q3y[0] << ") ("
<< q3x[q3x.size()-1] << ", " << q3y[q3y.size()-1] << ") "
<< (q3x[q3x.size()-1] - q3x[0])*(q3y[q3y.size()-1] - q3y[0])<< endl;
found = true;
}
if(!q4x.empty()){
cout << "Q4: (" << q4x[0] << ", " << q4y[0] << ") ("
<< q4x[q4x.size()-1] << ", " << q4y[q4y.size()-1] << ") "
<< (q4x[q4x.size()-1] - q4x[0])*(q4y[q4y.size()-1] - q4y[0])<< endl;
found = true;
}
if(!found){
cout << "No point in any quadrant" << endl;
}
} |
# 2070088, 2024-11-02 11:49:53, PPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
vector<int> xQ1;
vector<int> yQ1;
vector<int> xQ2;
vector<int> yQ2;
vector<int> xQ3;
vector<int> yQ3;
vector<int> xQ4;
vector<int> yQ4;
while(n--){
int x,y;
cin>>x>>y;
if(x==0||y==0) continue;
else if(x>0&&y>0){
xQ1.push_back(x);
yQ1.push_back(y);
}
else if(x<0&&y>0){
xQ2.push_back(x);
yQ2.push_back(y);
}
else if(x<0&&y<0){
xQ3.push_back(x);
yQ3.push_back(y);
}
else if(x>0&&y<0){
xQ4.push_back(x);
yQ4.push_back(y);
}
}
auto max_xQ1 = max_element(xQ1.begin(),xQ1.end());
auto min_xQ1 = min_element(xQ1.begin(),xQ1.end());
auto max_yQ1 = max_element(yQ1.begin(),yQ1.end());
auto min_yQ1 = min_element(yQ1.begin(),yQ1.end());
auto max_xQ2 = max_element(xQ2.begin(),xQ2.end());
auto min_xQ2 = min_element(xQ2.begin(),xQ2.end());
auto max_yQ2 = max_element(yQ2.begin(),yQ2.end());
auto min_yQ2 = min_element(yQ2.begin(),yQ2.end());
auto max_xQ3 = max_element(xQ3.begin(),xQ3.end());
auto min_xQ3 = min_element(xQ3.begin(),xQ3.end());
auto max_yQ3 = max_element(yQ3.begin(),yQ3.end());
auto min_yQ3 = min_element(yQ3.begin(),yQ3.end());
auto max_xQ4 = max_element(xQ4.begin(),xQ4.end());
auto min_xQ4 = min_element(xQ4.begin(),xQ4.end());
auto max_yQ4 = max_element(yQ4.begin(),yQ4.end());
auto min_yQ4 = min_element(yQ4.begin(),yQ4.end());
if((xQ1.empty()||yQ1.empty())&&(xQ2.empty()||yQ2.empty())&&(xQ3.empty()||yQ3.empty())&&(xQ4.empty()||yQ4.empty()))
{
cout<<"No point in any quadrant";
return 0;
}
if(xQ1.empty()||yQ1.empty()){
}
else{
cout<<"Q1: ("<<*min_xQ1<<", "<<*min_yQ1<<") ("<<*max_xQ1<<", "<<*max_yQ1<<") "<<abs((*max_xQ1 - *min_xQ1)) * abs((*max_yQ1 - *min_yQ1))<<endl;
}
if(xQ2.empty()||yQ2.empty()){
}
else{
cout<<"Q2: ("<<*min_xQ2<<", "<<*min_yQ2<<") ("<<*max_xQ2<<", "<<*max_yQ2<<") "<<abs((*max_xQ2 - *min_xQ2)) * abs((*max_yQ2 - *min_yQ2))<<endl;
}
if(xQ3.empty()||yQ3.empty()){
}
else{
cout<<"Q3: ("<<*min_xQ3<<", "<<*min_yQ3<<") ("<<*max_xQ3<<", "<<*max_yQ3<<") "<<abs((*max_xQ3 - *min_xQ3)) * abs((*max_yQ3 - *min_yQ3))<<endl;
}
if(xQ4.empty()||yQ4.empty()){
}
else{
cout<<"Q4: ("<<*min_xQ4<<", "<<*min_yQ4<<") ("<<*max_xQ4<<", "<<*max_yQ4<<") "<<abs((*max_xQ4 - *min_xQ4)) * abs((*max_yQ4 - *min_yQ4))<<endl;
}
return 0;
} |
# 2071050, 2024-11-02 13:48:54, PPPPPPPPPP (100%)
#include <iostream>
#include<cmath>
#include<climits>
#include<set>
#include<vector>
using namespace std;
bool ch=0;
void printQ(pair<int,int>a,pair<int,int>b,int i){
if(a.first==INT_MAX&&a.second==INT_MAX)return;
if(b.first==INT_MIN&&b.second==INT_MIN)return;
cout<<"Q"<<i<<": ";
cout<<"("<<a.first<<", "<<a.second<<") ";
cout<<"("<<b.first<<", "<<b.second<<") ";
cout<<abs(abs(b.first-a.first)*abs(b.second-a.second))<<'\n';
ch=1;
return;
}
int main(){
int n;
cin>>n;
pair<int,int>mxq1,mnq1;
pair<int,int>mxq2,mnq2;
pair<int,int>mxq3,mnq3;
pair<int,int>mxq4,mnq4;
mxq1.first=mxq1.second=INT_MIN;
mxq2.first=mxq2.second=INT_MIN;
mxq3.first=mxq3.second=INT_MIN;
mxq4.first=mxq4.second=INT_MIN;
mnq1.first=mnq1.second=INT_MAX;
mnq2.first=mnq2.second=INT_MAX;
mnq3.first=mnq3.second=INT_MAX;
mnq4.first=mnq4.second=INT_MAX;
for(int i=0;i<n;i++){
int x,y;
cin>>x>>y;
if(x==0||y==0)continue;
if(x>0&&y>0){
mxq1.first=max(mxq1.first,x);
mxq1.second=max(mxq1.second,y);
mnq1.first=min(mnq1.first,x);
mnq1.second=min(mnq1.second,y);
}else if(x<0&&y>0){
mxq2.first=max(mxq2.first,x);
mxq2.second=max(mxq2.second,y);
mnq2.first=min(mnq2.first,x);
mnq2.second=min(mnq2.second,y);
}else if(x<0&&y<0){
mxq3.first=max(mxq3.first,x);
mxq3.second=max(mxq3.second,y);
mnq3.first=min(mnq3.first,x);
mnq3.second=min(mnq3.second,y);
}else if(x>0&&y<0){
mxq4.first=max(mxq4.first,x);
mxq4.second=max(mxq4.second,y);
mnq4.first=min(mnq4.first,x);
mnq4.second=min(mnq4.second,y);
}
}
printQ(mnq1,mxq1,1);
printQ(mnq2,mxq2,2);
printQ(mnq3,mxq3,3);
printQ(mnq4,mxq4,4);
if(ch==0){
cout<<"No point in any quadrant";
}
} |
# 2069080, 2024-11-02 10:10:20, PPPPPPPPPP (100%)
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
vector<pair<int, int>> Q[4];
pair<pair<int, int>, pair<int, int>> rect[4];
int main() {
int num;
cin >> num;
for (int i = 0; i < num; i++) {
int x1, y1;
cin >> x1 >> y1;
if (x1 > 0 && y1 > 0) Q[0].push_back({x1, y1});
if (x1 < 0 && y1 > 0) Q[1].push_back({x1, y1});
if (x1 < 0 && y1 < 0) Q[2].push_back({x1, y1});
if (x1 > 0 && y1 < 0) Q[3].push_back({x1, y1});
}
for (int i = 0; i < 4; i++) {
if (Q[i].size() > 0) {
int min_x = Q[i][0].first;
int min_y = Q[i][0].second;
int max_x = Q[i][0].first;
int max_y = Q[i][0].second;
for (auto & a : Q[i]) {
if (a.first > max_x) {
max_x = a.first;
} else if (a.first < min_x) {
min_x = a.first;
}
if (a.second > max_y) {
max_y = a.second;
} else if (a.second < min_y) {
min_y = a.second;
}
}
rect[i] = {{min_x, min_y}, {max_x, max_y}};
}
}
bool has = false;
for (int i = 0; i < 4; i++) {
if (Q[i].size() > 0) {
int area = abs((rect[i].first.first - rect[i].second.first) * (rect[i].first.second - rect[i].second.second));
cout << "Q" << i + 1 << ": ";
cout << "(" << rect[i].first.first << ", " << rect[i].first.second << ") ";
cout << "(" << rect[i].second.first << ", " << rect[i].second.second << ") ";
cout << area << endl;
has = true;
}
}
if (!has) {
cout << "No point in any quadrant" << endl;
}
} |
# 2070741, 2024-11-02 13:11:14, PPPPPPPPPP (100%)
#include <iostream>
#include <set>
using namespace std;
int main(){
set<int> x_q1, y_q1, x_q2, y_q2,
x_q3, y_q3, x_q4, y_q4;
int n, p1, p2;
cin >> n;
while(n--){
cin >> p1 >> p2;
if(p1 > 0){
if(p2 > 0){
x_q1.insert(p1);
y_q1.insert(p2);
}else if(p2 < 0){
x_q4.insert(p1);
y_q4.insert(p2);
}
}else if(p1 < 0){
if(p2 > 0){
x_q2.insert(p1);
y_q2.insert(p2);
}else if(p2 < 0){
x_q3.insert(p1);
y_q3.insert(p2);
}
}
}
if(!(x_q1.empty()) && !(y_q1.empty())){
auto minx = x_q1.begin(), miny = y_q1.begin(),
maxx = x_q1.end(), maxy = y_q1.end();
cout << "Q1: (" << *(minx) << ", "
<< *(miny) << ") (" << *(--maxx) << ", "
<< *(--maxy) << ") ";
cout << (*maxx - *minx) * (*maxy - *miny) << endl;
}
if(!(x_q2.empty()) && !(y_q2.empty())){
auto minx = x_q2.begin(), miny = y_q2.begin(),
maxx = x_q2.end(), maxy = y_q2.end();
cout << "Q2: (" << *(minx) << ", "
<< *(miny) << ") (" << *(--maxx) << ", "
<< *(--maxy) << ") ";
cout << (*maxx - *minx) * (*maxy - *miny) << endl;
}
if(!(x_q3.empty()) && !(y_q3.empty())){
auto minx = x_q3.begin(), miny = y_q3.begin(),
maxx = x_q3.end(), maxy = y_q3.end();
cout << "Q3: (" << *(minx) << ", "
<< *(miny) << ") (" << *(--maxx) << ", "
<< *(--maxy) << ") ";
cout << (*maxx - *minx) * (*maxy - *miny) << endl;
}
if(!(x_q4.empty()) && !(y_q4.empty())){
auto minx = x_q4.begin(), miny = y_q4.begin(),
maxx = x_q4.end(), maxy = y_q4.end();
cout << "Q4: (" << *(minx) << ", "
<< *(miny) << ") (" << *(--maxx) << ", "
<< *(--maxy) << ") ";
cout << (*maxx - *minx) * (*maxy - *miny) << endl;
}
if(x_q1.empty() && x_q2.empty() && x_q3.empty() && x_q4.empty()
&& y_q1.empty() && y_q2.empty() && y_q3.empty() && y_q4.empty())
cout << "No point in any quadrant";
} |
# 2068881, 2024-11-02 09:50:15, PPPPPPPPPP (100%)
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
int n,x,y;
int i;
vector<int> vec[8];
cin >> n;
for(i=0;i<n;i++){
cin >> x >> y;
if(x>0 && y>0){
vec[0].push_back(x);
vec[1].push_back(y);
}
else if(x<0 && y>0){
vec[2].push_back(x);
vec[3].push_back(y);
}
else if(x<0 && y<0){
vec[4].push_back(x);
vec[5].push_back(y);
}
else if(x>0 && y<0){
vec[6].push_back(x);
vec[7].push_back(y);
}
}
int area[4];
bool check=0;
for(i=0;i<8;i++){
if(vec[i].size() > 0){
sort(vec[i].begin(),vec[i].end());
if(i%2 == 1){
int xmin=0,xmax=0,ymin=0,ymax=0;
xmin=vec[i-1][0];
xmax=vec[i-1][vec[i-1].size()-1];
ymin=vec[i][0];
ymax=vec[i][vec[i].size()-1];
area[(i-1)/2]=(ymax-ymin)*(xmax-xmin);
cout << "Q" << (i+1)/2 << ": ";
cout << "(" << xmin << ", " << ymin << ") ";
cout << "(" << xmax << ", " << ymax << ") ";
cout << area[(i-1)/2] << endl;
check=1;
}
}
}
if(!check){
cout << "No point in any quadrant";
}
} |
# 2070945, 2024-11-02 13:36:53, PPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
vector<pair<int ,int>> Q1;
vector<pair<int ,int>> Q2;
vector<pair<int ,int>> Q3;
vector<pair<int ,int>> Q4;
int minxQ1 = INT_MAX,minxQ2 = INT_MAX,minxQ3 = INT_MAX,minxQ4 = INT_MAX;
int minyQ1 = INT_MAX,minyQ2 = INT_MAX,minyQ3 = INT_MAX,minyQ4 = INT_MAX;
int maxxQ1 = INT_MIN,maxxQ2 = INT_MIN,maxxQ3 = INT_MIN,maxxQ4 = INT_MIN;
int maxyQ1 = INT_MIN,maxyQ2 = INT_MIN,maxyQ3 = INT_MIN,maxyQ4 = INT_MIN;
int x,y;
for(int i = 0;i < n;i++){
cin >> x >> y;
if(x == 0||y == 0)continue;
if(x < 0){
if(y < 0){
Q3.push_back(make_pair(x,y));
if(x > maxxQ3){
maxxQ3 = x;
}
if(x < minxQ3){
minxQ3 = x;
}
if(y > maxyQ3){
maxyQ3 = y;
}
if(y < minyQ3){
minyQ3 = y;
}
}
else {
Q2.push_back(make_pair(x,y));
if(x > maxxQ2){
maxxQ2 = x;
}
if(x < minxQ2){
minxQ2= x;
}
if(y > maxyQ2){
maxyQ2 = y;
}
if(y < minyQ2){
minyQ2 = y;
}
}
}
else {
if(y < 0){
Q4.push_back(make_pair(x,y));
if(x > maxxQ4){
maxxQ4 = x;
}
if(x < minxQ4){
minxQ4 = x;
}
if(y > maxyQ4){
maxyQ4 = y;
}
if(y < minyQ4){
minyQ4 = y;
}
}
else {
Q1.push_back(make_pair(x,y));
if(x > maxxQ1){
maxxQ1 = x;
}
if(x < minxQ1){
minxQ1 = x;
}
if(y > maxyQ1){
maxyQ1 = y;
}
if(y < minyQ1){
minyQ1 = y;
}
}
}
}
if(Q1.empty()&&Q2.empty()&&Q3.empty()&&Q4.empty())cout << "No point in any quadrant" << endl;
else{
if(!Q1.empty())cout << "Q1: ("<< minxQ1 << ", "<< minyQ1 << ") (" << maxxQ1 << ", " << maxyQ1 <<") "<<(maxxQ1-minxQ1)*(maxyQ1-minyQ1)<<endl;
if(!Q2.empty())cout << "Q2: ("<< minxQ2 << ", "<< minyQ2 << ") (" << maxxQ2 << ", " << maxyQ2 <<") "<<(maxxQ2-minxQ2)*(maxyQ2-minyQ2)<<endl;
if(!Q3.empty())cout << "Q3: ("<< minxQ3 << ", "<< minyQ3 << ") (" << maxxQ3 << ", " << maxyQ3 <<") "<<(maxxQ3-minxQ3)*(maxyQ3-minyQ3)<<endl;
if(!Q4.empty())cout << "Q4: ("<< minxQ4 << ", "<< minyQ4 << ") (" << maxxQ4 << ", " << maxyQ4 <<") "<<(maxxQ4-minxQ4)*(maxyQ4-minyQ4)<<endl;
}
return 0;
} |
# 2069202, 2024-11-02 10:25:35, PPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
bool cmp(pair<int,int> &a,pair<int,int> &b){
if(a.first==b.first)return a.second<b.second;
return a.first<b.first;
}
int main(){
int n;
cin>>n;
vector<int > q1x,q2x,q3x,q4x,q1y,q2y,q3y,q4y;
//map< int,int>q1,q2,q3,q4;
while(n--){
int x,y;
cin>>x>>y;
if(x>0&&y>0){
q1x.push_back(x);
q1y.push_back(y);
}
if(x>0&&y<0) {q4x.push_back(x);
q4y.push_back(y);}
if(x<0&&y<0) {q3x.push_back(x);
q3y.push_back(y);}
if(x<0&&y>0) {q2x.push_back(x);
q2y.push_back(y);
}}
sort(q1x.begin(),q1x.end());
sort(q2x.begin(),q2x.end());
sort(q3x.begin(),q3x.end());
sort(q4x.begin(),q4x.end());
sort(q1y.begin(),q1y.end());
sort(q2y.begin(),q2y.end());
sort(q3y.begin(),q3y.end());
sort(q4y.begin(),q4y.end());
if(q1x.size()!=0)
cout<<"Q1: ("<<q1x.front()<<", "<<q1y.front()<<") ("<<q1x.back()<<", "<<q1y.back()<<") "<<(q1x.front()-q1x.back())*(q1y.front()-q1y.back())<<endl;
if(q2x.size()!=0)
cout<<"Q2: ("<<q2x.front()<<", "<<q2y.front()<<") ("<<q2x.back()<<", "<<q2y.back()<<") "<<(q2x.front()-q2x.back())*(q2y.front()-q2y.back())<<endl;
if(q3x.size()!=0)
cout<<"Q3: ("<<q3x.front()<<", "<<q3y.front()<<") ("<<q3x.back()<<", "<<q3y.back()<<") "<<(q3x.front()-q3x.back())*(q3y.front()-q3y.back())<<endl;
if(q4x.size()!=0)
cout<<"Q4: ("<<q4x.front()<<", "<<q4y.front()<<") ("<<q4x.back()<<", "<<q4y.back()<<") "<<(q4x.front()-q4x.back())*(q4y.front()-q4y.back())<<endl;
if(q1x.size()==0&&q2x.size()==0&&q3x.size()==0&&q4x.size()==0)cout<<"No point in any quadrant";
} |
# 2069097, 2024-11-02 10:11:53, PPPPPPPPPP (100%)
#include <iostream>
#include <cmath>
#include <string>
#include <utility>
#include <set>
#include <map>
using namespace std;
int main(int argc, char const *argv[])
{
unsigned n;
cin >> n;
map<string, pair<set<int>, set<int>>> dataList;
for (unsigned i = 0; i < n; i++)
{
int x, y;
cin >> x >> y;
if (x > 0 && y > 0)
{
dataList["Q1"].first.insert(x);
dataList["Q1"].second.insert(y);
}
else if (x < 0 && y > 0)
{
dataList["Q2"].first.insert(x);
dataList["Q2"].second.insert(y);
}
else if (x < 0 && y < 0)
{
dataList["Q3"].first.insert(x);
dataList["Q3"].second.insert(y);
}
else if (x > 0 && y < 0)
{
dataList["Q4"].first.insert(x);
dataList["Q4"].second.insert(y);
}
}
if (dataList.empty())
{
cout << "No point in any quadrant" << endl;
}
else
{
for (auto quadrant : dataList)
{
cout << quadrant.first << ": ";
auto xData = quadrant.second.first;
auto yData = quadrant.second.second;
int xMin = *(xData.begin());
int xMax = *(--xData.end());
int yMin = *(yData.begin());
int yMax = *(--yData.end());
int area = (xMax - xMin) * (yMax - yMin);
cout << '(' << xMin << ", " << yMin << ") ";
cout << '(' << xMax << ", " << yMax << ") ";
cout << area << '\n';
}
}
return 0;
} |
# 2069342, 2024-11-02 10:37:58, P-P--P---- (30%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
vector<pair<int, int>> point;
int nn = n;
while(n--){
int x, y;
cin>>x>>y;
point.push_back(make_pair(x, y));
}
vector<int> squr;
vector<pair<int, int>> q1;
vector<pair<int, int>> q2;
vector<pair<int, int>> q3;
vector<pair<int, int>> q4;
for(auto &ss:point){
if(ss.first >= 1 && ss.second >= 1){
q1.push_back(ss);
}
if(ss.first <= -1 && ss.second >= 1){
q2.push_back(ss);
}
if(ss.first <= -1 && ss.second <= -1){
q3.push_back(ss);
}
if(ss.first >= 1 && ss.second <= -1){
q4.push_back(ss);
}
}
pair<int, int> maxq1 = {0, 0};
pair<int, int> maxq2 = {-10000, 0};
pair<int, int> maxq3 = {-10000, -10000};
pair<int, int> maxq4 = {0, -10000};
pair<int, int> minq1 = {10000, 10000};
pair<int, int> minq2 = {10000, 10000};
pair<int, int> minq3 = {10000, 10000};
pair<int, int> minq4 = {10000, 10000};
for(auto &s:q1){
if(s.first > maxq1.first) maxq1.first = s.first;
if(s.second > maxq1.second) maxq1.second = s.second;
if(s.first < minq1.first) minq1.first = s.first;
if(s.second < minq1.second) minq1.second = s.second;
}
//cout<<maxq1.first<<' '<<maxq1.second<<' '<<minq1.first<<' '<<minq1.second<<endl;
for(auto &s:q2){
if(s.first > maxq2.first ) maxq2.first = s.first;
if(s.second > maxq2.second) maxq2.second = s.second;
if(s.first < minq2.first) minq2.first = s.first;
if(s.second < minq2.second) minq2.second = s.second;
}
//cout<<maxq2.first<<' '<<maxq2.second<<' '<<minq2.first<<' '<<minq2.second<<endl;
for(auto &s:q3){
if(s.first > maxq3.first) maxq3.first = s.first;
if(s.second > maxq3.second) maxq3.second = s.second;
if(s.first < minq3.first) minq3.first = s.first;
if(s.second < minq3.second) minq3.second = s.second;
}
//cout<<maxq3.first<<' '<<maxq3.second<<' '<<minq3.first<<' '<<minq3.second<<endl;
for(auto &s:q4){
if(s.first > maxq4.first) maxq4.first = s.first;
if(s.second > maxq4.second) maxq4.second = s.second;
if(s.first < minq4.first) minq4.first = s.first;
if(s.second < minq4.second) minq4.second = s.second;
}
//cout<<maxq4.first<<' '<<maxq4.second<<' '<<minq4.first<<' '<<minq4.second<<endl;
if(q1.size() == 0 && q1.size() == 0 && q3.size() == 0 && q4.size() == 0){
cout<<"No point in any quadrant";
}
else{
if(q1.size() != 0){
cout<<"Q1: ";
cout<<"("<<minq1.first<<", "<<minq1.second<<") ("<<maxq1.first<<", "<<maxq1.second<<") "<<abs( abs(maxq1.first) - abs(minq1.first) ) *
abs( abs(maxq1.second) - abs(minq1.second) )<<endl;
}
if(q2.size() != 0){
cout<<"Q2: ";
cout<<"("<<minq2.first<<", "<<minq2.second<<") ("<<maxq2.first<<", "<<maxq2.second<<") "<<abs( abs(maxq2.first) - abs(minq2.first) ) *
abs( abs(maxq2.second) - abs(minq2.second) )<<endl;
}
if(q3.size() != 0){
cout<<"Q1: ";
cout<<"("<<minq3.first<<", "<<minq3.second<<") ("<<maxq3.first<<", "<<maxq3.second<<") "<<abs( abs(maxq3.first) - abs(minq3.first) ) *
abs( abs(maxq3.second) - abs(minq3.second) )<<endl;
}
if(q4.size() != 0){
cout<<"Q1: ";
cout<<"("<<minq4.first<<", "<<minq4.second<<") ("<<maxq4.first<<", "<<maxq4.second<<") "<<abs( abs(maxq4.first) - abs(minq4.first) ) *
abs( abs(maxq4.second) - abs(minq4.second) )<<endl;
}
}
return 0;
}
/*
19
2 2
4 6
5 5
1 0
-1 2
-3 4
-2 6
0 -3
-5 7
-4 5
-6 3
0 4
-2 -2
-5 -6
-7 0
6 -4
4 -6
3 -2
2 -5
*/ | # 2069354, 2024-11-02 10:39:06, P-P--P---- (30%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
vector<pair<int, int>> point;
int nn = n;
while(n--){
int x, y;
cin>>x>>y;
point.push_back(make_pair(x, y));
}
vector<int> squr;
vector<pair<int, int>> q1;
vector<pair<int, int>> q2;
vector<pair<int, int>> q3;
vector<pair<int, int>> q4;
for(auto &ss:point){
if(ss.first >= 1 && ss.second >= 1){
q1.push_back(ss);
}
if(ss.first <= -1 && ss.second >= 1){
q2.push_back(ss);
}
if(ss.first <= -1 && ss.second <= -1){
q3.push_back(ss);
}
if(ss.first >= 1 && ss.second <= -1){
q4.push_back(ss);
}
}
pair<int, int> maxq1 = {0, 0};
pair<int, int> maxq2 = {-10000, 0};
pair<int, int> maxq3 = {-10000, -10000};
pair<int, int> maxq4 = {0, -10000};
pair<int, int> minq1 = {10000, 10000};
pair<int, int> minq2 = {10000, 10000};
pair<int, int> minq3 = {10000, 10000};
pair<int, int> minq4 = {10000, 10000};
for(auto &s:q1){
if(s.first > maxq1.first) maxq1.first = s.first;
if(s.second > maxq1.second) maxq1.second = s.second;
if(s.first < minq1.first) minq1.first = s.first;
if(s.second < minq1.second) minq1.second = s.second;
}
//cout<<maxq1.first<<' '<<maxq1.second<<' '<<minq1.first<<' '<<minq1.second<<endl;
for(auto &s:q2){
if(s.first > maxq2.first ) maxq2.first = s.first;
if(s.second > maxq2.second) maxq2.second = s.second;
if(s.first < minq2.first) minq2.first = s.first;
if(s.second < minq2.second) minq2.second = s.second;
}
//cout<<maxq2.first<<' '<<maxq2.second<<' '<<minq2.first<<' '<<minq2.second<<endl;
for(auto &s:q3){
if(s.first > maxq3.first) maxq3.first = s.first;
if(s.second > maxq3.second) maxq3.second = s.second;
if(s.first < minq3.first) minq3.first = s.first;
if(s.second < minq3.second) minq3.second = s.second;
}
//cout<<maxq3.first<<' '<<maxq3.second<<' '<<minq3.first<<' '<<minq3.second<<endl;
for(auto &s:q4){
if(s.first > maxq4.first) maxq4.first = s.first;
if(s.second > maxq4.second) maxq4.second = s.second;
if(s.first < minq4.first) minq4.first = s.first;
if(s.second < minq4.second) minq4.second = s.second;
}
//cout<<maxq4.first<<' '<<maxq4.second<<' '<<minq4.first<<' '<<minq4.second<<endl;
if(q1.size() == 0 && q1.size() == 0 && q3.size() == 0 && q4.size() == 0){
cout<<"No point in any quadrant";
}
else{
if(q1.size() != 0){
cout<<"Q1: ";
cout<<"("<<minq1.first<<", "<<minq1.second<<") ("<<maxq1.first<<", "<<maxq1.second<<") "<<abs( abs(maxq1.first) - abs(minq1.first) ) *
abs( abs(maxq1.second) - abs(minq1.second) )<<endl;
}
if(q2.size() != 0){
cout<<"Q2: ";
cout<<"("<<minq2.first<<", "<<minq2.second<<") ("<<maxq2.first<<", "<<maxq2.second<<") "<<abs( abs(maxq2.first) - abs(minq2.first) ) *
abs( abs(maxq2.second) - abs(minq2.second) )<<endl;
}
if(q3.size() != 0){
cout<<"Q1: ";
cout<<"("<<minq3.first<<", "<<minq3.second<<") ("<<maxq3.first<<", "<<maxq3.second<<") "<<abs( abs(maxq3.first) - abs(minq3.first) ) *
abs( abs(maxq3.second) - abs(minq3.second) )<<endl;
}
if(q4.size() != 0){
cout<<"Q1: ";
cout<<"("<<minq4.first<<", "<<minq4.second<<") ("<<maxq4.first<<", "<<maxq4.second<<") "<<abs( abs(maxq4.first) - abs(minq4.first) ) *
abs( abs(maxq4.second) - abs(minq4.second) )<<endl;
}
}
return 0;
}
/*
19
2 2
4 6
5 5
1 0
-1 2
-3 4
-2 6
0 -3
-5 7
-4 5
-6 3
0 4
-2 -2
-5 -6
-7 0
6 -4
4 -6
3 -2
2 -5
*/ | # 2069367, 2024-11-02 10:40:27, P-PPPPPPPP (90%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
vector<pair<int, int>> point;
int nn = n;
while(n--){
int x, y;
cin>>x>>y;
point.push_back(make_pair(x, y));
}
vector<int> squr;
vector<pair<int, int>> q1;
vector<pair<int, int>> q2;
vector<pair<int, int>> q3;
vector<pair<int, int>> q4;
for(auto &ss:point){
if(ss.first >= 1 && ss.second >= 1){
q1.push_back(ss);
}
if(ss.first <= -1 && ss.second >= 1){
q2.push_back(ss);
}
if(ss.first <= -1 && ss.second <= -1){
q3.push_back(ss);
}
if(ss.first >= 1 && ss.second <= -1){
q4.push_back(ss);
}
}
pair<int, int> maxq1 = {0, 0};
pair<int, int> maxq2 = {-10000, 0};
pair<int, int> maxq3 = {-10000, -10000};
pair<int, int> maxq4 = {0, -10000};
pair<int, int> minq1 = {10000, 10000};
pair<int, int> minq2 = {10000, 10000};
pair<int, int> minq3 = {10000, 10000};
pair<int, int> minq4 = {10000, 10000};
for(auto &s:q1){
if(s.first > maxq1.first) maxq1.first = s.first;
if(s.second > maxq1.second) maxq1.second = s.second;
if(s.first < minq1.first) minq1.first = s.first;
if(s.second < minq1.second) minq1.second = s.second;
}
//cout<<maxq1.first<<' '<<maxq1.second<<' '<<minq1.first<<' '<<minq1.second<<endl;
for(auto &s:q2){
if(s.first > maxq2.first ) maxq2.first = s.first;
if(s.second > maxq2.second) maxq2.second = s.second;
if(s.first < minq2.first) minq2.first = s.first;
if(s.second < minq2.second) minq2.second = s.second;
}
//cout<<maxq2.first<<' '<<maxq2.second<<' '<<minq2.first<<' '<<minq2.second<<endl;
for(auto &s:q3){
if(s.first > maxq3.first) maxq3.first = s.first;
if(s.second > maxq3.second) maxq3.second = s.second;
if(s.first < minq3.first) minq3.first = s.first;
if(s.second < minq3.second) minq3.second = s.second;
}
//cout<<maxq3.first<<' '<<maxq3.second<<' '<<minq3.first<<' '<<minq3.second<<endl;
for(auto &s:q4){
if(s.first > maxq4.first) maxq4.first = s.first;
if(s.second > maxq4.second) maxq4.second = s.second;
if(s.first < minq4.first) minq4.first = s.first;
if(s.second < minq4.second) minq4.second = s.second;
}
//cout<<maxq4.first<<' '<<maxq4.second<<' '<<minq4.first<<' '<<minq4.second<<endl;
if(q1.size() == 0 && q1.size() == 0 && q3.size() == 0 && q4.size() == 0){
cout<<"No point in any quadrant";
}
else{
if(q1.size() != 0){
cout<<"Q1: ";
cout<<"("<<minq1.first<<", "<<minq1.second<<") ("<<maxq1.first<<", "<<maxq1.second<<") "<<abs( abs(maxq1.first) - abs(minq1.first) ) *
abs( abs(maxq1.second) - abs(minq1.second) )<<endl;
}
if(q2.size() != 0){
cout<<"Q2: ";
cout<<"("<<minq2.first<<", "<<minq2.second<<") ("<<maxq2.first<<", "<<maxq2.second<<") "<<abs( abs(maxq2.first) - abs(minq2.first) ) *
abs( abs(maxq2.second) - abs(minq2.second) )<<endl;
}
if(q3.size() != 0){
cout<<"Q3: ";
cout<<"("<<minq3.first<<", "<<minq3.second<<") ("<<maxq3.first<<", "<<maxq3.second<<") "<<abs( abs(maxq3.first) - abs(minq3.first) ) *
abs( abs(maxq3.second) - abs(minq3.second) )<<endl;
}
if(q4.size() != 0){
cout<<"Q4: ";
cout<<"("<<minq4.first<<", "<<minq4.second<<") ("<<maxq4.first<<", "<<maxq4.second<<") "<<abs( abs(maxq4.first) - abs(minq4.first) ) *
abs( abs(maxq4.second) - abs(minq4.second) )<<endl;
}
}
return 0;
}
/*
9
-1 2
2 3
2 6
2 4
-2 -3
4 -5
2 0
-2 0
5 0
*/
/*
19
2 2
4 6
5 5
1 0
-1 2
-3 4
-2 6
0 -3
-5 7
-4 5
-6 3
0 4
-2 -2
-5 -6
-7 0
6 -4
4 -6
3 -2
2 -5
*/ |
# 2070883, 2024-11-02 13:28:39, ----P-PP-P (40%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n; cin >> n;
int x, y;
vector<pair <int, int>> alldata;
map <int, int> Q1;
map <int, int> Q2;
map <int, int> Q3;
map <int, int> Q4;
while(n--){
cin >> x >> y;
alldata.push_back({x,y});
}
for(auto e : alldata){
if(e.first > 0 && e.second > 0){
Q1[e.first] = e.second;
}
if(e.first < 0 && e.second > 0){
Q2[e.first] = e.second;
}
if(e.first < 0 && e.second < 0){
Q3[e.first] = e.second;
}
if(e.first > 0 && e.second < 0){
Q4[e.first] = e.second;
}
}
int XminQ1 = INT_MAX;
int YminQ1 = INT_MAX;
for(auto e : Q1){
if(XminQ1 > e.first){
XminQ1 = e.first;
}
if(YminQ1 > e.second){
YminQ1 = e.second;
}
}
//cout << XminQ1 << " " << YminQ1;
int XmaxQ1 = INT_MIN;
int YmaxQ1 = INT_MIN;
for(auto e : Q1){
if(XmaxQ1 < e.first){
XmaxQ1 = e.first;
}
if(YmaxQ1 < e.second){
YmaxQ1 = e.second;
}
}
//cout << endl << "max" << endl;
//cout << XmaxQ1 << " " << YmaxQ1;
int XminQ2 = INT_MAX;
int YminQ2 = INT_MAX;
for(auto e : Q2){
if(XminQ2 > e.first){
XminQ2 = e.first;
}
if(YminQ2 > e.second){
YminQ2 = e.second;
}
}
//cout << endl << XminQ2 << " " << YminQ2;
int XmaxQ2 = INT_MIN;
int YmaxQ2 = INT_MIN;
for(auto e : Q2){
if(XmaxQ2 < e.first){
XmaxQ2 = e.first;
}
if(YmaxQ2 < e.second){
YmaxQ2 = e.second;
}
}
//cout << endl << "max" <<endl;
//cout << XmaxQ2 << " " << YmaxQ2;
int XminQ3 = INT_MAX;
int YminQ3 = INT_MAX;
for(auto e : Q3){
if(XminQ3 > e.first){
XminQ3 = e.first;
}
if(YminQ3 > e.second){
YminQ3 = e.second;
}
}
//cout << endl << XminQ3 << " " << YminQ3;
int XmaxQ3 = INT_MIN;
int YmaxQ3 = INT_MIN;
for(auto e : Q3){
if(XmaxQ3 < e.first){
XmaxQ3 = e.first;
}
if(YmaxQ3 < e.second){
YmaxQ3 = e.second;
}
}
//cout << endl << "max" <<endl;
//cout << XmaxQ3 << " " << YmaxQ3;
int XminQ4 = INT_MAX;
int YminQ4 = INT_MAX;
for(auto e : Q4){
if(XminQ4 > e.first){
XminQ4 = e.first;
}
if(YminQ4 > e.second){
YminQ4 = e.second;
}
}
//cout << endl << XminQ4 << " " << YminQ4;
int XmaxQ4 = INT_MIN;
int YmaxQ4 = INT_MIN;
for(auto e : Q4){
if(XmaxQ4 < e.first){
XmaxQ4 = e.first;
}
if(YmaxQ4 < e.second){
YmaxQ4 = e.second;
}
}
//cout << endl << "max" <<endl;
//cout << XmaxQ4 << " " << YmaxQ4;
cout << "Q1:" << " (" << XminQ1 << ", " << YminQ1 << ") (" << XmaxQ1 << ", " << YmaxQ1 <<") "<< ((XmaxQ1 - XminQ1) * (YmaxQ1 - YminQ1)) << endl;
cout << "Q2:" << " (" << XminQ2 << ", " << YminQ2 << ") (" << XmaxQ2 << ", " << YmaxQ2 <<") "<< ((XmaxQ2 - XminQ2) * (YmaxQ2 - YminQ2)) << endl;
cout << "Q3:" << " (" << XminQ3 << ", " << YminQ3 << ") (" << XmaxQ3 << ", " << YmaxQ3 <<") "<< ((XmaxQ3 - XminQ3) * (YmaxQ3 - YminQ3)) << endl;
cout << "Q4:" << " (" << XminQ4 << ", " << YminQ4 << ") (" << XmaxQ4 << ", " << YmaxQ4 <<") "<< ((XmaxQ4 - XminQ4) * (YmaxQ4 - YminQ4)) << endl;
} | # 2070925, 2024-11-02 13:34:35, PP-PPPPPPP (90%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n; cin >> n;
int x, y;
vector<pair <int, int>> alldata;
map <int, int> Q1;
map <int, int> Q2;
map <int, int> Q3;
map <int, int> Q4;
while(n--){
cin >> x >> y;
alldata.push_back({x,y});
}
for(auto e : alldata){
if(e.first > 0 && e.second > 0){
Q1[e.first] = e.second;
}
if(e.first < 0 && e.second > 0){
Q2[e.first] = e.second;
}
if(e.first < 0 && e.second < 0){
Q3[e.first] = e.second;
}
if(e.first > 0 && e.second < 0){
Q4[e.first] = e.second;
}
}
int XminQ1 = INT_MAX;
int YminQ1 = INT_MAX;
for(auto e : Q1){
if(XminQ1 > e.first){
XminQ1 = e.first;
}
if(YminQ1 > e.second){
YminQ1 = e.second;
}
}
//cout << XminQ1 << " " << YminQ1;
int XmaxQ1 = INT_MIN;
int YmaxQ1 = INT_MIN;
for(auto e : Q1){
if(XmaxQ1 < e.first){
XmaxQ1 = e.first;
}
if(YmaxQ1 < e.second){
YmaxQ1 = e.second;
}
}
//cout << endl << "max" << endl;
//cout << XmaxQ1 << " " << YmaxQ1;
int XminQ2 = INT_MAX;
int YminQ2 = INT_MAX;
for(auto e : Q2){
if(XminQ2 > e.first){
XminQ2 = e.first;
}
if(YminQ2 > e.second){
YminQ2 = e.second;
}
}
//cout << endl << XminQ2 << " " << YminQ2;
int XmaxQ2 = INT_MIN;
int YmaxQ2 = INT_MIN;
for(auto e : Q2){
if(XmaxQ2 < e.first){
XmaxQ2 = e.first;
}
if(YmaxQ2 < e.second){
YmaxQ2 = e.second;
}
}
//cout << endl << "max" <<endl;
//cout << XmaxQ2 << " " << YmaxQ2;
int XminQ3 = INT_MAX;
int YminQ3 = INT_MAX;
for(auto e : Q3){
if(XminQ3 > e.first){
XminQ3 = e.first;
}
if(YminQ3 > e.second){
YminQ3 = e.second;
}
}
//cout << endl << XminQ3 << " " << YminQ3;
int XmaxQ3 = INT_MIN;
int YmaxQ3 = INT_MIN;
for(auto e : Q3){
if(XmaxQ3 < e.first){
XmaxQ3 = e.first;
}
if(YmaxQ3 < e.second){
YmaxQ3 = e.second;
}
}
//cout << endl << "max" <<endl;
//cout << XmaxQ3 << " " << YmaxQ3;
int XminQ4 = INT_MAX;
int YminQ4 = INT_MAX;
for(auto e : Q4){
if(XminQ4 > e.first){
XminQ4 = e.first;
}
if(YminQ4 > e.second){
YminQ4 = e.second;
}
}
//cout << endl << XminQ4 << " " << YminQ4;
int XmaxQ4 = INT_MIN;
int YmaxQ4 = INT_MIN;
for(auto e : Q4){
if(XmaxQ4 < e.first){
XmaxQ4 = e.first;
}
if(YmaxQ4 < e.second){
YmaxQ4 = e.second;
}
}
//cout << endl << "max" <<endl;
//cout << XmaxQ4 << " " << YmaxQ4;
if(!Q1.empty()){
cout << "Q1:" << " (" << XminQ1 << ", " << YminQ1 << ") (" << XmaxQ1 << ", " << YmaxQ1 <<") "<< ((XmaxQ1 - XminQ1) * (YmaxQ1 - YminQ1)) << endl;
}
if(!Q2.empty()){
cout << "Q2:" << " (" << XminQ2 << ", " << YminQ2 << ") (" << XmaxQ2 << ", " << YmaxQ2 <<") "<< ((XmaxQ2 - XminQ2) * (YmaxQ2 - YminQ2)) << endl;
}
if(!Q3.empty()){
cout << "Q3:" << " (" << XminQ3 << ", " << YminQ3 << ") (" << XmaxQ3 << ", " << YmaxQ3 <<") "<< ((XmaxQ3 - XminQ3) * (YmaxQ3 - YminQ3)) << endl;
}
if(!Q4.empty()){
cout << "Q4:" << " (" << XminQ4 << ", " << YminQ4 << ") (" << XmaxQ4 << ", " << YmaxQ4 <<") "<< ((XmaxQ4 - XminQ4) * (YmaxQ4 - YminQ4)) << endl;
}
if(Q1.empty() && Q2.empty() && Q3.empty() && Q4.empty()){
cout <<"No point in any quadrant";
}
} | # 2071767, 2024-11-02 15:13:42, PP-PPPPPPP (90%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n; cin >> n;
int x, y;
vector<pair <int, int>> alldata;
map <int, int> Q1;
map <int, int> Q2;
map <int, int> Q3;
map <int, int> Q4;
while(n--){
cin >> x >> y;
alldata.push_back({x,y});
}
for(auto e : alldata){
if(e.first > 0 && e.second > 0){
Q1[e.first] = e.second;
}
if(e.first < 0 && e.second > 0){
Q2[e.first] = e.second;
}
if(e.first < 0 && e.second < 0){
Q3[e.first] = e.second;
}
if(e.first > 0 && e.second < 0){
Q4[e.first] = e.second;
}
}
int XminQ1 = INT_MAX;
int YminQ1 = INT_MAX;
for(auto e : Q1){
if(XminQ1 > e.first){
XminQ1 = e.first;
}
if(YminQ1 > e.second){
YminQ1 = e.second;
}
}
int XmaxQ1 = INT_MIN;
int YmaxQ1 = INT_MIN;
for(auto e : Q1){
if(XmaxQ1 < e.first){
XmaxQ1 = e.first;
}
if(YmaxQ1 < e.second){
YmaxQ1 = e.second;
}
}
int XminQ2 = INT_MAX;
int YminQ2 = INT_MAX;
for(auto e : Q2){
if(XminQ2 > e.first){
XminQ2 = e.first;
}
if(YminQ2 > e.second){
YminQ2 = e.second;
}
}
int XmaxQ2 = INT_MIN;
int YmaxQ2 = INT_MIN;
for(auto e : Q2){
if(XmaxQ2 < e.first){
XmaxQ2 = e.first;
}
if(YmaxQ2 < e.second){
YmaxQ2 = e.second;
}
}
int XminQ3 = INT_MAX;
int YminQ3 = INT_MAX;
for(auto e : Q3){
if(XminQ3 > e.first){
XminQ3 = e.first;
}
if(YminQ3 > e.second){
YminQ3 = e.second;
}
}
int XmaxQ3 = INT_MIN;
int YmaxQ3 = INT_MIN;
for(auto e : Q3){
if(XmaxQ3 < e.first){
XmaxQ3 = e.first;
}
if(YmaxQ3 < e.second){
YmaxQ3 = e.second;
}
}
int XminQ4 = INT_MAX;
int YminQ4 = INT_MAX;
for(auto e : Q4){
if(XminQ4 > e.first){
XminQ4 = e.first;
}
if(YminQ4 > e.second){
YminQ4 = e.second;
}
}
int XmaxQ4 = INT_MIN;
int YmaxQ4 = INT_MIN;
for(auto e : Q4){
if(XmaxQ4 < e.first){
XmaxQ4 = e.first;
}
if(YmaxQ4 < e.second){
YmaxQ4 = e.second;
}
}
if(!Q1.empty()){
cout << "Q1:" << " (" << XminQ1 << ", " << YminQ1 << ") (" << XmaxQ1 << ", " << YmaxQ1 <<") "<< ((XmaxQ1 - XminQ1) * (YmaxQ1 - YminQ1)) << endl;
}
if(!Q2.empty()){
cout << "Q2:" << " (" << XminQ2 << ", " << YminQ2 << ") (" << XmaxQ2 << ", " << YmaxQ2 <<") "<< ((XmaxQ2 - XminQ2) * (YmaxQ2 - YminQ2)) << endl;
}
if(!Q3.empty()){
cout << "Q3:" << " (" << XminQ3 << ", " << YminQ3 << ") (" << XmaxQ3 << ", " << YmaxQ3 <<") "<< ((XmaxQ3 - XminQ3) * (YmaxQ3 - YminQ3)) << endl;
}
if(!Q4.empty()){
cout << "Q4:" << " (" << XminQ4 << ", " << YminQ4 << ") (" << XmaxQ4 << ", " << YmaxQ4 <<") "<< ((XmaxQ4 - XminQ4) * (YmaxQ4 - YminQ4)) << endl;
}
if(Q1.empty() && Q2.empty() && Q3.empty() && Q4.empty()){
cout <<"No point in any quadrant";
}
} |
# 2071183, 2024-11-02 14:05:53, ----P-PP-P (40%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
vector<pair<int,int>> point,Q1,Q2,Q3,Q4,ans1,ans2,ans3,ans4;
pair<int,int> tem1,tem2;
int a,b;
for(int i=0;i<n;i++){
cin>>a;
cin>>b;
point.push_back(make_pair(a,b));
}
for(auto x : point){
if(x.first>0&&x.second>0){
Q1.push_back(make_pair(x.first,x.second));
}
else if(x.first<0&&x.second>0){
Q2.push_back(make_pair(x.first,x.second));
}
else if(x.first<0&&x.second<0){
Q3.push_back(make_pair(x.first,x.second));
}
else if(x.first>0&&x.second<0){
Q4.push_back(make_pair(x.first,x.second));
}
}
int max_x=-100000000,max_y=-10000000,min_x=1000000,min_y=1000000;
for(auto l:Q1){
max_x=max(max_x,l.first);
max_y=max(max_y,l.second);
min_x=min(min_x,l.first);
min_y=min(min_y,l.second);
}
ans1.push_back(make_pair(max_x,max_y));
ans1.push_back(make_pair(min_x,min_y));
sort(ans1.begin(),ans1.end());
cout<<"Q1:";
for(auto s:ans1){
cout<<" ("<<s.first<<", "<<s.second<<")";
}
cout<<" "<<(max_x-min_x)*(max_y-min_y)<<endl;
int max_x1=-10000000,max_y1=-10000000,min_x1=1000000,min_y1=1000000;
for(auto l:Q2){
max_x1=max(max_x1,l.first);
max_y1=max(max_y1,l.second);
min_x1=min(min_x1,l.first);
min_y1=min(min_y1,l.second);
}
ans2.push_back(make_pair(max_x1,max_y1));
ans2.push_back(make_pair(min_x1,min_y1));
sort(ans2.begin(),ans2.end());
cout<<"Q2:";
for(auto s:ans2){
cout<<" ("<<s.first<<", "<<s.second<<")";
}
cout<<" "<<(max_x1-min_x1)*(max_y1-min_y1)<<endl;
int max_x2=-10000000,max_y2=-10000000,min_x2=1000000,min_y2=1000000;
for(auto l:Q3){
max_x2=max(max_x2,l.first);
max_y2=max(max_y2,l.second);
min_x2=min(min_x2,l.first);
min_y2=min(min_y2,l.second);
}
ans3.push_back(make_pair(max_x2,max_y2));
ans3.push_back(make_pair(min_x2,min_y2));
sort(ans3.begin(),ans3.end());
cout<<"Q3:";
for(auto s:ans3){
cout<<" ("<<s.first<<", "<<s.second<<")";
}
cout<<" "<<(max_x2-min_x2)*(max_y2-min_y2)<<endl;
int max_x3=-10000000,max_y3=-10000000,min_x3=1000000,min_y3=1000000;
for(auto l:Q4){
max_x3=max(max_x3,l.first);
max_y3=max(max_y3,l.second);
min_x3=min(min_x3,l.first);
min_y3=min(min_y3,l.second);
}
ans4.push_back(make_pair(max_x3,max_y3));
ans4.push_back(make_pair(min_x3,min_y3));
sort(ans4.begin(),ans4.end());
cout<<"Q4:";
for(auto s:ans4){
cout<<" ("<<s.first<<", "<<s.second<<")";
}
cout<<" "<<(max_x3-min_x3)*(max_y3-min_y3)<<endl;
if(Q1.size()==0&&Q2.size()==0&&Q3.size()==0&&Q4.size()==1)
cout<<"No point in any quadrant";
} | # 2071225, 2024-11-02 14:10:29, PPPPP-PPPP (90%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
vector<pair<int,int>> point,Q1,Q2,Q3,Q4,ans1,ans2,ans3,ans4;
pair<int,int> tem1,tem2;
int a,b;
for(int i=0;i<n;i++){
cin>>a;
cin>>b;
point.push_back(make_pair(a,b));
}
for(auto x : point){
if(x.first>0&&x.second>0){
Q1.push_back(make_pair(x.first,x.second));
}
else if(x.first<0&&x.second>0){
Q2.push_back(make_pair(x.first,x.second));
}
else if(x.first<0&&x.second<0){
Q3.push_back(make_pair(x.first,x.second));
}
else if(x.first>0&&x.second<0){
Q4.push_back(make_pair(x.first,x.second));
}
}
int max_x=-100000000,max_y=-10000000,min_x=1000000,min_y=1000000;
for(auto l:Q1){
max_x=max(max_x,l.first);
max_y=max(max_y,l.second);
min_x=min(min_x,l.first);
min_y=min(min_y,l.second);
}
ans1.push_back(make_pair(max_x,max_y));
ans1.push_back(make_pair(min_x,min_y));
sort(ans1.begin(),ans1.end());
while(1){
if(Q1.size()==0) break;
cout<<"Q1:";
for(auto s:ans1){
cout<<" ("<<s.first<<", "<<s.second<<")";
}
cout<<" "<<(max_x-min_x)*(max_y-min_y)<<endl;
break;
}
int max_x1=-10000000,max_y1=-10000000,min_x1=1000000,min_y1=1000000;
for(auto l:Q2){
max_x1=max(max_x1,l.first);
max_y1=max(max_y1,l.second);
min_x1=min(min_x1,l.first);
min_y1=min(min_y1,l.second);
}
ans2.push_back(make_pair(max_x1,max_y1));
ans2.push_back(make_pair(min_x1,min_y1));
sort(ans2.begin(),ans2.end());
while(1){
if(Q2.size()==0) break;
cout<<"Q2:";
for(auto s:ans2){
cout<<" ("<<s.first<<", "<<s.second<<")";
}
cout<<" "<<(max_x1-min_x1)*(max_y1-min_y1)<<endl;
break;
}
int max_x2=-10000000,max_y2=-10000000,min_x2=1000000,min_y2=1000000;
for(auto l:Q3){
max_x2=max(max_x2,l.first);
max_y2=max(max_y2,l.second);
min_x2=min(min_x2,l.first);
min_y2=min(min_y2,l.second);
}
ans3.push_back(make_pair(max_x2,max_y2));
ans3.push_back(make_pair(min_x2,min_y2));
sort(ans3.begin(),ans3.end());
while(1){
if(Q3.size()==0) break;
cout<<"Q3:";
for(auto s:ans3){
cout<<" ("<<s.first<<", "<<s.second<<")";
}
cout<<" "<<(max_x2-min_x2)*(max_y2-min_y2)<<endl;
break;
}
int max_x3=-10000000,max_y3=-10000000,min_x3=1000000,min_y3=1000000;
for(auto l:Q4){
max_x3=max(max_x3,l.first);
max_y3=max(max_y3,l.second);
min_x3=min(min_x3,l.first);
min_y3=min(min_y3,l.second);
}
ans4.push_back(make_pair(max_x3,max_y3));
ans4.push_back(make_pair(min_x3,min_y3));
sort(ans4.begin(),ans4.end());
while(1){
if(Q4.size()==0) break;
cout<<"Q4:";
for(auto s:ans4){
cout<<" ("<<s.first<<", "<<s.second<<")";
}
cout<<" "<<(max_x3-min_x3)*(max_y3-min_y3)<<endl;
break;
}
if(Q1.size()==0&&Q2.size()==0&&Q3.size()==0&&Q4.size()==1)
cout<<"No point in any quadrant";
} |
# 2068948, 2024-11-02 09:56:27, PP-PPPPPPP (90%)
#include <iostream>
#include <vector>
#include <map>
#include <cmath>
using namespace std;
int main() {
int n,x,y,minx = 1000000,miny = 1000000 ,maxx = -1000000,maxy = -1000000;
cin >> n;
bool c1 = false,c2 = false,c3 = false,c4 = false;
map <int,int> Q1;
map <int,int> Q2;
map <int,int> Q3;
map <int,int> Q4;
while (n--){
cin >> x >> y;
if (x > 0 && y > 0) {
Q1[x] = y;
} else if (x > 0 && y < 0){
Q4[x] = y;
} else if (x < 0 && y > 0){
Q2[x] = y;
} else if (x < 0 && y < 0) {
Q3[x] = y;
}
}
for (auto p: Q1) {
minx = min(p.first,minx);
miny = min(p.second,miny);
maxx = max(p.first,maxx);
maxy = max(p.second,maxy);
}
if (Q1.size() != 0) {
cout << "Q1: (" << minx << ", " << miny << ") (" << maxx << ", " << maxy << ") " << (maxx-minx)*(maxy-miny) << endl;
} else {
c1 = true;
}
minx = 1000000;miny = 1000000;maxx = -1000000;maxy = -1000000;
for (auto p: Q2) {
minx = min(p.first,minx);
miny = min(p.second,miny);
maxx = max(p.first,maxx);
maxy = max(p.second,maxy);
}
if (Q2.size() != 0) {
cout << "Q2: (" << minx << ", " << miny << ") (" << maxx << ", " << maxy << ") " << (maxx-minx)*(maxy-miny) << endl;
} else {
c2 = true;
}
minx = 1000000;miny = 1000000;maxx = -1000000;maxy = -1000000;
for (auto p: Q3) {
minx = min(p.first,minx);
miny = min(p.second,miny);
maxx = max(p.first,maxx);
maxy = max(p.second,maxy);
}
if (Q3.size() != 0) {
cout << "Q3: (" << minx << ", " << miny << ") (" << maxx << ", " << maxy << ") " << (maxx-minx)*(maxy-miny) << endl;
} else {
c3 = true;
}
minx = 1000000;miny = 1000000;maxx = -1000000;maxy = -1000000;
for (auto p: Q4) {
minx = min(p.first,minx);
miny = min(p.second,miny);
maxx = max(p.first,maxx);
maxy = max(p.second,maxy);
}
if (Q4.size() != 0) {
cout << "Q4: (" << minx << ", " << miny << ") (" << maxx << ", " << maxy << ") " << (maxx-minx)*(maxy-miny) << endl;
} else {
c4 = true;
}
if (c1 && c2 && c3 && c4) {
cout << "No point in any quadrant" ;
}
} |
# 2069634, 2024-11-02 11:05:43, PPPPPPP--- (70%)
#include <iostream>
#include <vector>
#include <map>
#include <utility>
#include <cmath>
#include <set>
#include <algorithm>
using namespace std;
int main(){
int n;
cin >> n;
int x, y;
vector <int> Q1x, Q2x, Q3x, Q4x;
vector <int> Q1y, Q2y, Q3y, Q4y;
for(int i = 0; i < n; i++){
cin >> x >> y;
if(x > 0){
if(y > 0){
Q1x.push_back(x);
Q1y.push_back(y);
}
else if(y < 0){
Q4x.push_back(x);
Q4y.push_back(y);
}
}
else if(x < 0){
if(y > 0){
Q2x.push_back(x);
Q2y.push_back(y);
}
else if(y < 0){
Q3x.push_back(x);
Q3y.push_back(y);
}
}
}
sort(Q1x.begin(), Q1x.end());
sort(Q2x.begin(), Q2x.end());
sort(Q3x.begin(), Q3x.end());
sort(Q4x.begin(), Q4x.end());
sort(Q1y.begin(), Q1y.end());
sort(Q2y.begin(), Q2y.end());
sort(Q3y.begin(), Q3y.end());
sort(Q4y.begin(), Q4y.end());
if(Q1x.size() != 0){
cout << "Q1: ";
cout << "(" << Q1x[0] << ", " << Q1y[0] << ") ";
cout << "(" << Q1x[Q1x.size()-1] << ", " << Q1y[Q1x.size()-1] << ") ";
cout << (Q1x[Q1x.size()-1] - Q1x[0]) * (Q1y[Q1y.size()-1] - Q1y[0]) << endl;
}
if(Q2x.size() != 0){
cout << "Q2: ";
cout << "(" << Q2x[0] << ", " << Q2y[0] << ") ";
cout << "(" << Q2x[Q2x.size()-1] << ", " << Q2y[Q2x.size()-1] << ") ";
cout << (Q2x[Q2x.size()-1] - Q2x[0]) * (Q2y[Q2y.size()-1] - Q2y[0]) << endl;
}
if(Q3x.size() != 0){
cout << "Q3: ";
cout << "(" << Q3x[0] << ", " << Q3y[0] << ") ";
cout << "(" << Q3x[Q3x.size()-1] << ", " << Q3y[Q3x.size()-1] << ") ";
cout << (Q3x[Q3x.size()-1] - Q3x[0]) * (Q3y[Q3y.size()-1] - Q3y[0]) << endl;
}
if(Q4x.size() != 0){
cout << "Q4: ";
cout << "(" << Q4x[0] << ", " << Q4y[0] << ") ";
cout << "(" << Q4x[Q4x.size()-1] << ", " << Q4y[Q1x.size()-1] << ") ";
cout << (Q4x[Q4x.size()-1] - Q4x[0]) * (Q4y[Q4y.size()-1] - Q4y[0]) << endl;
}
if(Q1x.size() == 0 && Q2x.size() == 0 && Q3x.size() == 0 && Q4x.size() == 0)
cout << "No point in any quadrant";
} | # 2069762, 2024-11-02 11:22:31, PPPPPPP--- (70%)
#include <iostream>
#include <vector>
#include <map>
#include <utility>
#include <cmath>
#include <set>
#include <algorithm>
using namespace std;
int main(){
long n;
cin >> n;
long x, y;
vector <long> Q1x, Q2x, Q3x, Q4x;
vector <long> Q1y, Q2y, Q3y, Q4y;
for(long i = 0; i < n; i++){
cin >> x >> y;
if(x > 0){
if(y > 0){
Q1x.push_back(x);
Q1y.push_back(y);
}
else if(y < 0){
Q4x.push_back(x);
Q4y.push_back(y);
}
}
else if(x < 0){
if(y > 0){
Q2x.push_back(x);
Q2y.push_back(y);
}
else if(y < 0){
Q3x.push_back(x);
Q3y.push_back(y);
}
}
}
sort(Q1x.begin(), Q1x.end());
sort(Q2x.begin(), Q2x.end());
sort(Q3x.begin(), Q3x.end());
sort(Q4x.begin(), Q4x.end());
sort(Q1y.begin(), Q1y.end());
sort(Q2y.begin(), Q2y.end());
sort(Q3y.begin(), Q3y.end());
sort(Q4y.begin(), Q4y.end());
if(Q1x.size() != 0){
cout << "Q1: ";
cout << "(" << Q1x[0] << ", " << Q1y[0] << ") ";
cout << "(" << Q1x[Q1x.size()-1] << ", " << Q1y[Q1x.size()-1] << ") ";
cout << (Q1x[Q1x.size()-1] - Q1x[0]) * (Q1y[Q1y.size()-1] - Q1y[0]) << endl;
}
if(Q2x.size() != 0){
cout << "Q2: ";
cout << "(" << Q2x[0] << ", " << Q2y[0] << ") ";
cout << "(" << Q2x[Q2x.size()-1] << ", " << Q2y[Q2x.size()-1] << ") ";
cout << (Q2x[Q2x.size()-1] - Q2x[0]) * (Q2y[Q2y.size()-1] - Q2y[0]) << endl;
}
if(Q3x.size() != 0){
cout << "Q3: ";
cout << "(" << Q3x[0] << ", " << Q3y[0] << ") ";
cout << "(" << Q3x[Q3x.size()-1] << ", " << Q3y[Q3x.size()-1] << ") ";
cout << (Q3x[Q3x.size()-1] - Q3x[0]) * (Q3y[Q3y.size()-1] - Q3y[0]) << endl;
}
if(Q4x.size() != 0){
cout << "Q4: ";
cout << "(" << Q4x[0] << ", " << Q4y[0] << ") ";
cout << "(" << Q4x[Q4x.size()-1] << ", " << Q4y[Q1x.size()-1] << ") ";
cout << (Q4x[Q4x.size()-1] - Q4x[0]) * (Q4y[Q4y.size()-1] - Q4y[0]) << endl;
}
if(Q1x.size() == 0 && Q2x.size() == 0 && Q3x.size() == 0 && Q4x.size() == 0)
cout << "No point in any quadrant";
} | # 2069766, 2024-11-02 11:22:44, PPPPPPP--- (70%)
#include <iostream>
#include <vector>
#include <map>
#include <utility>
#include <cmath>
#include <set>
#include <algorithm>
using namespace std;
int main(){
int n;
cin >> n;
int x, y;
vector <int> Q1x, Q2x, Q3x, Q4x;
vector <int> Q1y, Q2y, Q3y, Q4y;
for(int i = 0; i < n; i++){
cin >> x >> y;
if(x > 0){
if(y > 0){
Q1x.push_back(x);
Q1y.push_back(y);
}
else if(y < 0){
Q4x.push_back(x);
Q4y.push_back(y);
}
}
else if(x < 0){
if(y > 0){
Q2x.push_back(x);
Q2y.push_back(y);
}
else if(y < 0){
Q3x.push_back(x);
Q3y.push_back(y);
}
}
}
sort(Q1x.begin(), Q1x.end());
sort(Q2x.begin(), Q2x.end());
sort(Q3x.begin(), Q3x.end());
sort(Q4x.begin(), Q4x.end());
sort(Q1y.begin(), Q1y.end());
sort(Q2y.begin(), Q2y.end());
sort(Q3y.begin(), Q3y.end());
sort(Q4y.begin(), Q4y.end());
if(Q1x.size() != 0){
cout << "Q1: ";
cout << "(" << Q1x[0] << ", " << Q1y[0] << ") ";
cout << "(" << Q1x[Q1x.size()-1] << ", " << Q1y[Q1x.size()-1] << ") ";
cout << (Q1x[Q1x.size()-1] - Q1x[0]) * (Q1y[Q1y.size()-1] - Q1y[0]) << endl;
}
if(Q2x.size() != 0){
cout << "Q2: ";
cout << "(" << Q2x[0] << ", " << Q2y[0] << ") ";
cout << "(" << Q2x[Q2x.size()-1] << ", " << Q2y[Q2x.size()-1] << ") ";
cout << (Q2x[Q2x.size()-1] - Q2x[0]) * (Q2y[Q2y.size()-1] - Q2y[0]) << endl;
}
if(Q3x.size() != 0){
cout << "Q3: ";
cout << "(" << Q3x[0] << ", " << Q3y[0] << ") ";
cout << "(" << Q3x[Q3x.size()-1] << ", " << Q3y[Q3x.size()-1] << ") ";
cout << (Q3x[Q3x.size()-1] - Q3x[0]) * (Q3y[Q3y.size()-1] - Q3y[0]) << endl;
}
if(Q4x.size() != 0){
cout << "Q4: ";
cout << "(" << Q4x[0] << ", " << Q4y[0] << ") ";
cout << "(" << Q4x[Q4x.size()-1] << ", " << Q4y[Q1x.size()-1] << ") ";
cout << (Q4x[Q4x.size()-1] - Q4x[0]) * (Q4y[Q4y.size()-1] - Q4y[0]) << endl;
}
if(Q1x.size() == 0 && Q2x.size() == 0 && Q3x.size() == 0 && Q4x.size() == 0)
cout << "No point in any quadrant";
} |
# 2069675, 2024-11-02 11:11:44, xxxx-x--x- (0%)
#include<bits/stdc++.h>
using namespace std ;
int main(){
int n ; cin >> n ;
int x , y ;
vector<vector<int>> Q1 ;
vector<vector<int>> Q2 ;
vector<vector<int>> Q3 ;
vector<vector<int>> Q4 ;
while (n--) {
cin >> x >> y ;
if(x> 0 && y > 0) Q1.push_back({x,y}) ;
else if (x > 0 && y < 0) Q4.push_back({x,y}) ;
else if (x < 0 && y < 0) Q3.push_back({x,y}) ;
else if (x < 0 && y > 0) Q2.push_back({x,y}) ;
}
int minx = Q1[0][0] , miny = Q1[0][1], maxx = Q1[0][0] , maxy = Q1[0][1] ;
for(int i = 0 ; i < Q1.size() ; i++){
for (int j = 0; j < 2; j++) {
if(Q1[i][0] > maxx) maxx = Q1[i][0] ;
if(Q1[i][1] > maxy) maxy = Q1[i][1] ;
if(Q1[i][0] < minx) minx = Q1[i][0] ;
if(Q1[i][1] < miny) miny = Q1[i][1] ;
}
}
cout << "Q1: " << "(" << minx <<" , " << miny<<") " << "(" << maxx <<" , " << maxy<<") " << (maxx-minx)*(maxy-miny) << endl ;
minx = Q2[0][0] , miny = Q2[0][1], maxx = Q2[0][0] , maxy = Q2[0][1] ;
for(int i = 0 ; i < Q2.size() ; i++){
for (int j = 0; j < 2; j++) {
if(Q2[i][0] > maxx) maxx = Q2[i][0] ;
if(Q2[i][1] > maxy) maxy = Q2[i][1] ;
if(Q2[i][0] < minx) minx = Q2[i][0] ;
if(Q2[i][1] < miny) miny = Q2[i][1] ;
}
}
cout << "Q2: " << "(" << minx <<" , " << miny<<") " << "(" << maxx <<" , " << maxy<<") " << (maxx-minx)*(maxy-miny) <<endl ;
minx = Q3[0][0] , miny = Q3[0][1], maxx = Q3[0][0] , maxy = Q3[0][1] ;
for(int i = 0 ; i < Q3.size() ; i++){
for (int j = 0; j < 2; j++) {
if(Q3[i][0] > maxx) maxx = Q3[i][0] ;
if(Q3[i][1] > maxy) maxy = Q3[i][1] ;
if(Q3[i][0] < minx) minx = Q3[i][0] ;
if(Q3[i][1] < miny) miny = Q3[i][1] ;
}
}
cout << "Q3: " << "(" << minx <<" , " << miny<<") " << "(" << maxx <<" , " << maxy<<") " << (maxx-minx)*(maxy-miny) <<endl ;
minx = Q4[0][0] , miny = Q4[0][1], maxx = Q4[0][0] , maxy = Q4[0][1] ;
for(int i = 0 ; i < Q4.size() ; i++){
for (int j = 0; j < 2; j++) {
if(Q4[i][0] > maxx) maxx = Q4[i][0] ;
if(Q4[i][1] > maxy) maxy = Q4[i][1] ;
if(Q4[i][0] < minx) minx = Q4[i][0] ;
if(Q4[i][1] < miny) miny = Q4[i][1] ;
}
}
cout << "Q4: " << "(" << minx <<" , " << miny<<") " << "(" << maxx <<" , " << maxy<<") " << (maxx-minx)*(maxy-miny) <<endl ;
} | # 2069725, 2024-11-02 11:18:40, -x-x-P--x- (10%)
#include<bits/stdc++.h>
using namespace std ;
int main(){
int n ; cin >> n ;
int x , y ;
bool check = false ;
vector<vector<int>> Q1 ;
vector<vector<int>> Q2 ;
vector<vector<int>> Q3 ;
vector<vector<int>> Q4 ;
while (n--) {
cin >> x >> y ;
if(x> 0 && y > 0){ Q1.push_back({x,y}); check = true ; }
else if (x > 0 && y < 0){ Q4.push_back({x,y}) ; check = true ; }
else if (x < 0 && y < 0) {Q3.push_back({x,y}) ; check = true ;}
else if (x < 0 && y > 0) {Q2.push_back({x,y}) ; check = true ;}
}
if(!check) {
cout << "No point in any quadrant" ;
return 0 ;
}
int minx = Q1[0][0] , miny = Q1[0][1], maxx = Q1[0][0] , maxy = Q1[0][1] ;
if(Q1.size()> 0){
for(int i = 0 ; i < Q1.size() ; i++){
for (int j = 0; j < 2; j++) {
if(Q1[i][0] > maxx) maxx = Q1[i][0] ;
if(Q1[i][1] > maxy) maxy = Q1[i][1] ;
if(Q1[i][0] < minx) minx = Q1[i][0] ;
if(Q1[i][1] < miny) miny = Q1[i][1] ;
}
}
cout << "Q1: " << "(" << minx <<" , " << miny<<") " << "(" << maxx <<" , " << maxy<<") " << (maxx-minx)*(maxy-miny) << endl ;
}
if(Q2.size()> 0){
minx = Q2[0][0] , miny = Q2[0][1], maxx = Q2[0][0] , maxy = Q2[0][1] ;
for(int i = 0 ; i < Q2.size() ; i++){
for (int j = 0; j < 2; j++) {
if(Q2[i][0] > maxx) maxx = Q2[i][0] ;
if(Q2[i][1] > maxy) maxy = Q2[i][1] ;
if(Q2[i][0] < minx) minx = Q2[i][0] ;
if(Q2[i][1] < miny) miny = Q2[i][1] ;
}
}
cout << "Q2: " << "(" << minx <<" , " << miny<<") " << "(" << maxx <<" , " << maxy<<") " << (maxx-minx)*(maxy-miny) <<endl ;
}
if(Q3.size()> 0){
minx = Q3[0][0] , miny = Q3[0][1], maxx = Q3[0][0] , maxy = Q3[0][1] ;
for(int i = 0 ; i < Q3.size() ; i++){
for (int j = 0; j < 2; j++) {
if(Q3[i][0] > maxx) maxx = Q3[i][0] ;
if(Q3[i][1] > maxy) maxy = Q3[i][1] ;
if(Q3[i][0] < minx) minx = Q3[i][0] ;
if(Q3[i][1] < miny) miny = Q3[i][1] ;
}
}
cout << "Q3: " << "(" << minx <<" , " << miny<<") " << "(" << maxx <<" , " << maxy<<") " << (maxx-minx)*(maxy-miny) <<endl ;
}
if(Q4.size()> 0){
minx = Q4[0][0] , miny = Q4[0][1], maxx = Q4[0][0] , maxy = Q4[0][1] ;
for(int i = 0 ; i < Q4.size() ; i++){
for (int j = 0; j < 2; j++) {
if(Q4[i][0] > maxx) maxx = Q4[i][0] ;
if(Q4[i][1] > maxy) maxy = Q4[i][1] ;
if(Q4[i][0] < minx) minx = Q4[i][0] ;
if(Q4[i][1] < miny) miny = Q4[i][1] ;
}
}
cout << "Q4: " << "(" << minx <<" , " << miny<<") " << "(" << maxx <<" , " << maxy<<") " << (maxx-minx)*(maxy-miny) <<endl ;
}
} | # 2069746, 2024-11-02 11:21:17, PxPxPPPPxP (70%)
#include<bits/stdc++.h>
using namespace std ;
int main(){
int n ; cin >> n ;
int x , y ;
bool check = false ;
vector<vector<int>> Q1 ;
vector<vector<int>> Q2 ;
vector<vector<int>> Q3 ;
vector<vector<int>> Q4 ;
while (n--) {
cin >> x >> y ;
if(x> 0 && y > 0){ Q1.push_back({x,y}); check = true ; }
else if (x > 0 && y < 0){ Q4.push_back({x,y}) ; check = true ; }
else if (x < 0 && y < 0) {Q3.push_back({x,y}) ; check = true ;}
else if (x < 0 && y > 0) {Q2.push_back({x,y}) ; check = true ;}
}
if(!check) {
cout << "No point in any quadrant" <<endl;
return 0 ;
}
int minx = Q1[0][0] , miny = Q1[0][1], maxx = Q1[0][0] , maxy = Q1[0][1] ;
if(Q1.size()> 0){
for(int i = 0 ; i < Q1.size() ; i++){
for (int j = 0; j < 2; j++) {
if(Q1[i][0] > maxx) maxx = Q1[i][0] ;
if(Q1[i][1] > maxy) maxy = Q1[i][1] ;
if(Q1[i][0] < minx) minx = Q1[i][0] ;
if(Q1[i][1] < miny) miny = Q1[i][1] ;
}
}
cout << "Q1: " << "(" << minx <<", " << miny<<") " << "(" << maxx <<", " << maxy<<") " << (maxx-minx)*(maxy-miny) << endl ;
}
if(Q2.size()> 0){
minx = Q2[0][0] , miny = Q2[0][1], maxx = Q2[0][0] , maxy = Q2[0][1] ;
for(int i = 0 ; i < Q2.size() ; i++){
for (int j = 0; j < 2; j++) {
if(Q2[i][0] > maxx) maxx = Q2[i][0] ;
if(Q2[i][1] > maxy) maxy = Q2[i][1] ;
if(Q2[i][0] < minx) minx = Q2[i][0] ;
if(Q2[i][1] < miny) miny = Q2[i][1] ;
}
}
cout << "Q2: " << "(" << minx <<", " << miny<<") " << "(" << maxx <<", " << maxy<<") " << (maxx-minx)*(maxy-miny) <<endl ;
}
if(Q3.size()> 0){
minx = Q3[0][0] , miny = Q3[0][1], maxx = Q3[0][0] , maxy = Q3[0][1] ;
for(int i = 0 ; i < Q3.size() ; i++){
for (int j = 0; j < 2; j++) {
if(Q3[i][0] > maxx) maxx = Q3[i][0] ;
if(Q3[i][1] > maxy) maxy = Q3[i][1] ;
if(Q3[i][0] < minx) minx = Q3[i][0] ;
if(Q3[i][1] < miny) miny = Q3[i][1] ;
}
}
cout << "Q3: " << "(" << minx <<", " << miny<<") " << "(" << maxx <<", " << maxy<<") " << (maxx-minx)*(maxy-miny) <<endl ;
}
if(Q4.size()> 0){
minx = Q4[0][0] , miny = Q4[0][1], maxx = Q4[0][0] , maxy = Q4[0][1] ;
for(int i = 0 ; i < Q4.size() ; i++){
for (int j = 0; j < 2; j++) {
if(Q4[i][0] > maxx) maxx = Q4[i][0] ;
if(Q4[i][1] > maxy) maxy = Q4[i][1] ;
if(Q4[i][0] < minx) minx = Q4[i][0] ;
if(Q4[i][1] < miny) miny = Q4[i][1] ;
}
}
cout << "Q4: " << "(" << minx <<", " << miny<<") " << "(" << maxx <<", " << maxy<<") " << (maxx-minx)*(maxy-miny) <<endl ;
}
} |
# 2071059, 2024-11-02 13:49:51, -x-x-x--x- (0%)
#include <iostream>
#include <vector>
#include <utility>
using namespace std;
int main(){
int n;
cin >> n;
vector<pair<int,int>> Q1 = {};
vector<pair<int,int>> Q2 = {};
vector<pair<int,int>> Q3 = {};
vector<pair<int,int>> Q4 = {};
pair<int,int> a;
int x,y;
for(int i = 0 ; i < n ; i++){
cin >> x >> y;
if(x == 0 || y == 0) continue;
if(x > 0 && y > 0){
a.first = x; a.second = y;
Q1.push_back(a);
}
if(x < 0 && y > 0){
a.first = x; a.second = y;
Q2.push_back(a);
}
if(x < 0 && y < 0){
a.first = x; a.second = y;
Q3.push_back(a);
}
if(x > 0 && y < 0){
a.first = x; a.second = y;
Q4.push_back(a);
}
}
int xQ1max=Q1[0].first , yQ1max=Q1[0].second;
int xQ1min=Q1[0].first , yQ1min=Q1[0].second;
for(auto e : Q1){
if(e.first > xQ1max){
xQ1max = e.first;
}
if(e.first < xQ1min){
xQ1min = e.first;
}
if(e.second > yQ1max){
yQ1max = e.second;
}
if(e.second < yQ1min){
yQ1min = e.second;
}
}
cout << "Q1 : (" << xQ1min << ", " << yQ1min << ") (" << xQ1max << ", " << yQ1max << ")" << endl;
} | # 2071084, 2024-11-02 13:53:27, -x-x-x--x- (0%)
#include <iostream>
#include <vector>
#include <utility>
using namespace std;
int main(){
int n;
cin >> n;
vector<pair<int,int>> Q1 = {};
vector<pair<int,int>> Q2 = {};
vector<pair<int,int>> Q3 = {};
vector<pair<int,int>> Q4 = {};
pair<int,int> a;
int x,y;
for(int i = 0 ; i < n ; i++){
cin >> x >> y;
if(x == 0 || y == 0) continue;
if(x > 0 && y > 0){
a.first = x; a.second = y;
Q1.push_back(a);
}
if(x < 0 && y > 0){
a.first = x; a.second = y;
Q2.push_back(a);
}
if(x < 0 && y < 0){
a.first = x; a.second = y;
Q3.push_back(a);
}
if(x > 0 && y < 0){
a.first = x; a.second = y;
Q4.push_back(a);
}
}
int xQ1max=Q1[0].first , yQ1max=Q1[0].second;
int xQ1min=Q1[0].first , yQ1min=Q1[0].second;
for(auto e : Q1){
if(e.first > xQ1max){
xQ1max = e.first;
}
if(e.first < xQ1min){
xQ1min = e.first;
}
if(e.second > yQ1max){
yQ1max = e.second;
}
if(e.second < yQ1min){
yQ1min = e.second;
}
}
cout << "Q1 : (" << xQ1min << ", " << yQ1min << ") (" << xQ1max << ", " << yQ1max << ") " << (yQ1max - yQ1min) * (xQ1max - xQ1min) << endl;
} | # 2071132, 2024-11-02 13:59:37, xxxx-x--x- (0%)
#include <iostream>
#include <vector>
#include <utility>
using namespace std;
int main(){
int n;
cin >> n;
vector<pair<int,int>> Q1 = {};
vector<pair<int,int>> Q2 = {};
vector<pair<int,int>> Q3 = {};
vector<pair<int,int>> Q4 = {};
pair<int,int> a;
int x,y;
for(int i = 0 ; i < n ; i++){
cin >> x >> y;
if(x == 0 || y == 0) continue;
if(x > 0 && y > 0){
a.first = x; a.second = y;
Q1.push_back(a);
}
if(x < 0 && y > 0){
a.first = x; a.second = y;
Q2.push_back(a);
}
if(x < 0 && y < 0){
a.first = x; a.second = y;
Q3.push_back(a);
}
if(x > 0 && y < 0){
a.first = x; a.second = y;
Q4.push_back(a);
}
}
int xQ1max=Q1[0].first , yQ1max=Q1[0].second;
int xQ1min=Q1[0].first , yQ1min=Q1[0].second;
for(auto e : Q1){
if(e.first > xQ1max){
xQ1max = e.first;
}
if(e.first < xQ1min){
xQ1min = e.first;
}
if(e.second > yQ1max){
yQ1max = e.second;
}
if(e.second < yQ1min){
yQ1min = e.second;
}
}
int xQ2max=Q2[0].first , yQ2max=Q2[0].second;
int xQ2min=Q2[0].first , yQ2min=Q2[0].second;
for(auto e : Q2){
if(e.first > xQ2max){
xQ2max = e.first;
}
if(e.first < xQ2min){
xQ2min = e.first;
}
if(e.second > yQ2max){
yQ2max = e.second;
}
if(e.second < yQ2min){
yQ2min = e.second;
}
}
int xQ3max=Q3[0].first , yQ3max=Q1[0].second;
int xQ3min=Q1[0].first , yQ3min=Q1[0].second;
for(auto e : Q3){
if(e.first > xQ3max){
xQ3max = e.first;
}
if(e.first < xQ3min){
xQ3min = e.first;
}
if(e.second > yQ3max){
yQ3max = e.second;
}
if(e.second < yQ3min){
yQ3min = e.second;
}
}
int xQ4max=Q4[0].first , yQ4max=Q4[0].second;
int xQ4min=Q4[0].first , yQ4min=Q4[0].second;
for(auto e : Q4){
if(e.first > xQ4max){
xQ4max = e.first;
}
if(e.first < xQ4min){
xQ4min = e.first;
}
if(e.second > yQ4max){
yQ4max = e.second;
}
if(e.second < yQ4min){
yQ4min = e.second;
}
}
cout << "Q1 : (" << xQ1min << ", " << yQ1min << ") (" << xQ1max << ", " << yQ1max << ") " << (yQ1max - yQ1min) * (xQ1max - xQ1min) << endl;
cout << "Q2 : (" << xQ2min << ", " << yQ2min << ") (" << xQ2max << ", " << yQ2max << ") " << (yQ2max - yQ2min) * (xQ2max - xQ2min) << endl;
cout << "Q3 : (" << xQ3min << ", " << yQ3min << ") (" << xQ3max << ", " << yQ3max << ") " << (yQ3max - yQ3min) * (xQ3max - xQ3min) << endl;
cout << "Q4 : (" << xQ4min << ", " << yQ4min << ") (" << xQ4max << ", " << yQ4max << ") " << (yQ4max - yQ4min) * (xQ4max - xQ4min) << endl;
} | # 2071172, 2024-11-02 14:03:56, xxxx-x--x- (0%)
#include <iostream>
#include <vector>
#include <utility>
using namespace std;
int main(){
int n;
cin >> n;
vector<pair<int,int>> Q1 = {};
vector<pair<int,int>> Q2 = {};
vector<pair<int,int>> Q3 = {};
vector<pair<int,int>> Q4 = {};
pair<int,int> a;
int x,y;
for(int i = 0 ; i < n ; i++){
cin >> x >> y;
if(x == 0 || y == 0) continue;
if(x > 0 && y > 0){
a.first = x; a.second = y;
Q1.push_back(a);
}
if(x < 0 && y > 0){
a.first = x; a.second = y;
Q2.push_back(a);
}
if(x < 0 && y < 0){
a.first = x; a.second = y;
Q3.push_back(a);
}
if(x > 0 && y < 0){
a.first = x; a.second = y;
Q4.push_back(a);
}
}
int xQ1max=Q1[0].first , yQ1max=Q1[0].second;
int xQ1min=Q1[0].first , yQ1min=Q1[0].second;
for(auto e : Q1){
if(e.first > xQ1max){
xQ1max = e.first;
}
if(e.first < xQ1min){
xQ1min = e.first;
}
if(e.second > yQ1max){
yQ1max = e.second;
}
if(e.second < yQ1min){
yQ1min = e.second;
}
}
int xQ2max=Q2[0].first , yQ2max=Q2[0].second;
int xQ2min=Q2[0].first , yQ2min=Q2[0].second;
for(auto e : Q2){
if(e.first > xQ2max){
xQ2max = e.first;
}
if(e.first < xQ2min){
xQ2min = e.first;
}
if(e.second > yQ2max){
yQ2max = e.second;
}
if(e.second < yQ2min){
yQ2min = e.second;
}
}
int xQ3max=Q3[0].first , yQ3max=Q1[0].second;
int xQ3min=Q1[0].first , yQ3min=Q1[0].second;
for(auto e : Q3){
if(e.first > xQ3max){
xQ3max = e.first;
}
if(e.first < xQ3min){
xQ3min = e.first;
}
if(e.second > yQ3max){
yQ3max = e.second;
}
if(e.second < yQ3min){
yQ3min = e.second;
}
}
int xQ4max=Q4[0].first , yQ4max=Q4[0].second;
int xQ4min=Q4[0].first , yQ4min=Q4[0].second;
for(auto e : Q4){
if(e.first > xQ4max){
xQ4max = e.first;
}
if(e.first < xQ4min){
xQ4min = e.first;
}
if(e.second > yQ4max){
yQ4max = e.second;
}
if(e.second < yQ4min){
yQ4min = e.second;
}
}
if(!Q1.empty()){
cout << "Q1 : (" << xQ1min << ", " << yQ1min << ") (" << xQ1max << ", " << yQ1max << ") " << (yQ1max - yQ1min) * (xQ1max - xQ1min) << endl;
}
if(!Q2.empty()){
cout << "Q2 : (" << xQ2min << ", " << yQ2min << ") (" << xQ2max << ", " << yQ2max << ") " << (yQ2max - yQ2min) * (xQ2max - xQ2min) << endl;
}
if(!Q3.empty()){
cout << "Q3 : (" << xQ3min << ", " << yQ3min << ") (" << xQ3max << ", " << yQ3max << ") " << (yQ3max - yQ3min) * (xQ3max - xQ3min) << endl;
}
if(!Q4.empty()){
cout << "Q4 : (" << xQ4min << ", " << yQ4min << ") (" << xQ4max << ", " << yQ4max << ") " << (yQ4max - yQ4min) * (xQ4max - xQ4min) << endl;
}
if(Q1.empty() && Q2.empty() && Q3.empty() && Q4.empty()){
cout << "No point in any quadrant";
}
} | # 2071227, 2024-11-02 14:10:40, PPPxPP-Px- (60%)
#include <iostream>
#include <vector>
#include <utility>
using namespace std;
int main(){
int n;
cin >> n;
vector<pair<int,int>> Q1 = {};
vector<pair<int,int>> Q2 = {};
vector<pair<int,int>> Q3 = {};
vector<pair<int,int>> Q4 = {};
pair<int,int> a;
int x,y;
for(int i = 0 ; i < n ; i++){
cin >> x >> y;
if(x == 0 || y == 0) continue;
if(x > 0 && y > 0){
a.first = x; a.second = y;
Q1.push_back(a);
}
if(x < 0 && y > 0){
a.first = x; a.second = y;
Q2.push_back(a);
}
if(x < 0 && y < 0){
a.first = x; a.second = y;
Q3.push_back(a);
}
if(x > 0 && y < 0){
a.first = x; a.second = y;
Q4.push_back(a);
}
}
if(!Q1.empty()){
int xQ1max=Q1[0].first , yQ1max=Q1[0].second;
int xQ1min=Q1[0].first , yQ1min=Q1[0].second;
for(auto e : Q1){
if(e.first > xQ1max){
xQ1max = e.first;
}
if(e.first < xQ1min){
xQ1min = e.first;
}
if(e.second > yQ1max){
yQ1max = e.second;
}
if(e.second < yQ1min){
yQ1min = e.second;
}
}
cout << "Q1: (" << xQ1min << ", " << yQ1min << ") (" << xQ1max << ", " << yQ1max << ") " << (yQ1max - yQ1min) * (xQ1max - xQ1min) << endl;
}
if(!Q2.empty()){
int xQ2max=Q2[0].first , yQ2max=Q2[0].second;
int xQ2min=Q2[0].first , yQ2min=Q2[0].second;
for(auto e : Q2){
if(e.first > xQ2max){
xQ2max = e.first;
}
if(e.first < xQ2min){
xQ2min = e.first;
}
if(e.second > yQ2max){
yQ2max = e.second;
}
if(e.second < yQ2min){
yQ2min = e.second;
}
}
cout << "Q2: (" << xQ2min << ", " << yQ2min << ") (" << xQ2max << ", " << yQ2max << ") " << (yQ2max - yQ2min) * (xQ2max - xQ2min) << endl;
}
if(!Q3.empty()){
int xQ3max=Q3[0].first , yQ3max=Q1[0].second;
int xQ3min=Q1[0].first , yQ3min=Q1[0].second;
for(auto e : Q3){
if(e.first > xQ3max){
xQ3max = e.first;
}
if(e.first < xQ3min){
xQ3min = e.first;
}
if(e.second > yQ3max){
yQ3max = e.second;
}
if(e.second < yQ3min){
yQ3min = e.second;
}
}
cout << "Q3: (" << xQ3min << ", " << yQ3min << ") (" << xQ3max << ", " << yQ3min << ") " << (yQ3max - yQ3min) * (xQ3max - xQ3min) << endl;
}
if(!Q4.empty()){
int xQ4max=Q4[0].first , yQ4max=Q4[0].second;
int xQ4min=Q4[0].first , yQ4min=Q4[0].second;
for(auto e : Q4){
if(e.first > xQ4max){
xQ4max = e.first;
}
if(e.first < xQ4min){
xQ4min = e.first;
}
if(e.second > yQ4max){
yQ4max = e.second;
}
if(e.second < yQ4min){
yQ4min = e.second;
}
}
cout << "Q4: (" << xQ4min << ", " << yQ4min << ") (" << xQ4max << ", " << yQ4max << ") " << (yQ4max - yQ4min) * (xQ4max - xQ4min) << endl;
}
if(Q1.empty() && Q2.empty() && Q3.empty() && Q4.empty()){
cout << "No point in any quadrant";
}
} | # 2071298, 2024-11-02 14:20:09, PPPxPP-Px- (60%)
#include <iostream>
#include <vector>
#include <utility>
using namespace std;
int main(){
int n;
cin >> n;
vector<pair<int,int>> Q1 = {};
vector<pair<int,int>> Q2 = {};
vector<pair<int,int>> Q3 = {};
vector<pair<int,int>> Q4 = {};
pair<int,int> a;
int x,y;
for(int i = 0 ; i < n ; i++){
cin >> x >> y;
if(x == 0 || y == 0) continue;
if(x > 0 && y > 0){
a.first = x; a.second = y;
Q1.push_back(a);
}
if(x < 0 && y > 0){
a.first = x; a.second = y;
Q2.push_back(a);
}
if(x < 0 && y < 0){
a.first = x; a.second = y;
Q3.push_back(a);
}
if(x > 0 && y < 0){
a.first = x; a.second = y;
Q4.push_back(a);
}
}
if(!Q1.empty()){
int xQ1max=Q1[0].first , yQ1max=Q1[0].second;
int xQ1min=Q1[0].first , yQ1min=Q1[0].second;
for(auto e : Q1){
if(e.first > xQ1max){
xQ1max = e.first;
}
if(e.first < xQ1min){
xQ1min = e.first;
}
if(e.second > yQ1max){
yQ1max = e.second;
}
if(e.second < yQ1min){
yQ1min = e.second;
}
}
int areaQ1 = (yQ1max - yQ1min) * (xQ1max - xQ1min);
if(areaQ1 < 0) areaQ1 = -areaQ1;
cout << "Q1: (" << xQ1min << ", " << yQ1min << ") (" << xQ1max << ", " << yQ1max << ") " << areaQ1<< endl;
}
if(!Q2.empty()){
int xQ2max=Q2[0].first , yQ2max=Q2[0].second;
int xQ2min=Q2[0].first , yQ2min=Q2[0].second;
for(auto e : Q2){
if(e.first > xQ2max){
xQ2max = e.first;
}
if(e.first < xQ2min){
xQ2min = e.first;
}
if(e.second > yQ2max){
yQ2max = e.second;
}
if(e.second < yQ2min){
yQ2min = e.second;
}
}
int areaQ2 = (yQ2max - yQ2min) * (xQ2max - xQ2min);
if(areaQ2 < 0) areaQ2 = -areaQ2;
cout << "Q2: (" << xQ2min << ", " << yQ2min << ") (" << xQ2max << ", " << yQ2max << ") " << areaQ2 << endl;
}
if(!Q3.empty()){
int xQ3max=Q3[0].first , yQ3max=Q1[0].second;
int xQ3min=Q1[0].first , yQ3min=Q1[0].second;
for(auto e : Q3){
if(e.first > xQ3max){
xQ3max = e.first;
}
if(e.first < xQ3min){
xQ3min = e.first;
}
if(e.second > yQ3max){
yQ3max = e.second;
}
if(e.second < yQ3min){
yQ3min = e.second;
}
}
int areaQ3 = (yQ3max - yQ3min) * (xQ3max - xQ3min);
if(areaQ3 < 0) areaQ3 = -areaQ3;
cout << "Q3: (" << xQ3min << ", " << yQ3min << ") (" << xQ3max << ", " << yQ3min << ") " << areaQ3 << endl;
}
if(!Q4.empty()){
int xQ4max=Q4[0].first , yQ4max=Q4[0].second;
int xQ4min=Q4[0].first , yQ4min=Q4[0].second;
for(auto e : Q4){
if(e.first > xQ4max){
xQ4max = e.first;
}
if(e.first < xQ4min){
xQ4min = e.first;
}
if(e.second > yQ4max){
yQ4max = e.second;
}
if(e.second < yQ4min){
yQ4min = e.second;
}
}
int areaQ4 = (yQ4max - yQ4min) * (xQ4max - xQ4min);
if(areaQ4 < 0) areaQ4 = -areaQ4;
cout << "Q4: (" << xQ4min << ", " << yQ4min << ") (" << xQ4max << ", " << yQ4max << ") " << areaQ4 << endl;
}
if(Q1.empty() && Q2.empty() && Q3.empty() && Q4.empty()){
cout << "No point in any quadrant";
}
} | # 2071301, 2024-11-02 14:20:18, PPPxPP-Px- (60%)
#include <iostream>
#include <vector>
#include <utility>
using namespace std;
int main(){
int n;
cin >> n;
vector<pair<int,int>> Q1 = {};
vector<pair<int,int>> Q2 = {};
vector<pair<int,int>> Q3 = {};
vector<pair<int,int>> Q4 = {};
pair<int,int> a;
int x,y;
for(int i = 0 ; i < n ; i++){
cin >> x >> y;
if(x == 0 || y == 0) continue;
if(x > 0 && y > 0){
a.first = x; a.second = y;
Q1.push_back(a);
}
if(x < 0 && y > 0){
a.first = x; a.second = y;
Q2.push_back(a);
}
if(x < 0 && y < 0){
a.first = x; a.second = y;
Q3.push_back(a);
}
if(x > 0 && y < 0){
a.first = x; a.second = y;
Q4.push_back(a);
}
}
if(!Q1.empty()){
int xQ1max=Q1[0].first , yQ1max=Q1[0].second;
int xQ1min=Q1[0].first , yQ1min=Q1[0].second;
for(auto e : Q1){
if(e.first > xQ1max){
xQ1max = e.first;
}
if(e.first < xQ1min){
xQ1min = e.first;
}
if(e.second > yQ1max){
yQ1max = e.second;
}
if(e.second < yQ1min){
yQ1min = e.second;
}
}
int areaQ1 = (yQ1max - yQ1min) * (xQ1max - xQ1min);
if(areaQ1 < 0) areaQ1 = -areaQ1;
cout << "Q1: (" << xQ1min << ", " << yQ1min << ") (" << xQ1max << ", " << yQ1max << ") " << areaQ1<< endl;
}
if(!Q2.empty()){
int xQ2max=Q2[0].first , yQ2max=Q2[0].second;
int xQ2min=Q2[0].first , yQ2min=Q2[0].second;
for(auto e : Q2){
if(e.first > xQ2max){
xQ2max = e.first;
}
if(e.first < xQ2min){
xQ2min = e.first;
}
if(e.second > yQ2max){
yQ2max = e.second;
}
if(e.second < yQ2min){
yQ2min = e.second;
}
}
int areaQ2 = (yQ2max - yQ2min) * (xQ2max - xQ2min);
if(areaQ2 < 0) areaQ2 = -areaQ2;
cout << "Q2: (" << xQ2min << ", " << yQ2min << ") (" << xQ2max << ", " << yQ2max << ") " << areaQ2 << endl;
}
if(!Q3.empty()){
int xQ3max=Q3[0].first , yQ3max=Q1[0].second;
int xQ3min=Q1[0].first , yQ3min=Q1[0].second;
for(auto e : Q3){
if(e.first > xQ3max){
xQ3max = e.first;
}
if(e.first < xQ3min){
xQ3min = e.first;
}
if(e.second > yQ3max){
yQ3max = e.second;
}
if(e.second < yQ3min){
yQ3min = e.second;
}
}
int areaQ3 = (yQ3max - yQ3min) * (xQ3max - xQ3min);
if(areaQ3 < 0) areaQ3 = -areaQ3;
cout << "Q3: (" << xQ3min << ", " << yQ3min << ") (" << xQ3max << ", " << yQ3min << ") " << areaQ3 << endl;
}
if(!Q4.empty()){
int xQ4max=Q4[0].first , yQ4max=Q4[0].second;
int xQ4min=Q4[0].first , yQ4min=Q4[0].second;
for(auto e : Q4){
if(e.first > xQ4max){
xQ4max = e.first;
}
if(e.first < xQ4min){
xQ4min = e.first;
}
if(e.second > yQ4max){
yQ4max = e.second;
}
if(e.second < yQ4min){
yQ4min = e.second;
}
}
int areaQ4 = (yQ4max - yQ4min) * (xQ4max - xQ4min);
if(areaQ4 < 0) areaQ4 = -areaQ4;
cout << "Q4: (" << xQ4min << ", " << yQ4min << ") (" << xQ4max << ", " << yQ4max << ") " << areaQ4 << endl;
}
if(Q1.empty() && Q2.empty() && Q3.empty() && Q4.empty()){
cout << "No point in any quadrant";
}
} | # 2071373, 2024-11-02 14:28:47, PPPxPP-Px- (60%)
#include <iostream>
#include <vector>
#include <utility>
using namespace std;
int main(){
int n;
cin >> n;
vector<pair<int,int>> Q1 = {};
vector<pair<int,int>> Q2 = {};
vector<pair<int,int>> Q3 = {};
vector<pair<int,int>> Q4 = {};
pair<int,int> a;
int x=0,y=0;
for(int i = 0 ; i < n ; i++){
cin >> x >> y;
if(x == 0 || y == 0) continue;
if(x > 0 && y > 0){
a.first = x; a.second = y;
Q1.push_back(a);
continue;
}
if(x < 0 && y > 0){
a.first = x; a.second = y;
Q2.push_back(a);
continue;
}
if(x < 0 && y < 0){
a.first = x; a.second = y;
Q3.push_back(a);
continue;
}
if(x > 0 && y < 0){
a.first = x; a.second = y;
Q4.push_back(a);
continue;
}
}
if(!Q1.empty()){
int xQ1max=Q1[0].first , yQ1max=Q1[0].second;
int xQ1min=Q1[0].first , yQ1min=Q1[0].second;
for(auto e : Q1){
if(e.first > xQ1max){
xQ1max = e.first;
}
if(e.first < xQ1min){
xQ1min = e.first;
}
if(e.second > yQ1max){
yQ1max = e.second;
}
if(e.second < yQ1min){
yQ1min = e.second;
}
}
int areaQ1 = (yQ1max - yQ1min) * (xQ1max - xQ1min);
if(areaQ1 < 0) areaQ1 = -areaQ1;
cout << "Q1: (" << xQ1min << ", " << yQ1min << ") (" << xQ1max << ", " << yQ1max << ") " << areaQ1<< endl;
}
if(!Q2.empty()){
int xQ2max=Q2[0].first , yQ2max=Q2[0].second;
int xQ2min=Q2[0].first , yQ2min=Q2[0].second;
for(auto e : Q2){
if(e.first > xQ2max){
xQ2max = e.first;
}
if(e.first < xQ2min){
xQ2min = e.first;
}
if(e.second > yQ2max){
yQ2max = e.second;
}
if(e.second < yQ2min){
yQ2min = e.second;
}
}
int areaQ2 = (yQ2max - yQ2min) * (xQ2max - xQ2min);
if(areaQ2 < 0) areaQ2 = -areaQ2;
cout << "Q2: (" << xQ2min << ", " << yQ2min << ") (" << xQ2max << ", " << yQ2max << ") " << areaQ2 << endl;
}
if(!Q3.empty()){
int xQ3max=Q3[0].first , yQ3max=Q1[0].second;
int xQ3min=Q1[0].first , yQ3min=Q1[0].second;
for(auto e : Q3){
if(e.first > xQ3max){
xQ3max = e.first;
}
if(e.first < xQ3min){
xQ3min = e.first;
}
if(e.second > yQ3max){
yQ3max = e.second;
}
if(e.second < yQ3min){
yQ3min = e.second;
}
}
int areaQ3 = (yQ3max - yQ3min) * (xQ3max - xQ3min);
if(areaQ3 < 0) areaQ3 = -areaQ3;
cout << "Q3: (" << xQ3min << ", " << yQ3min << ") (" << xQ3max << ", " << yQ3min << ") " << areaQ3 << endl;
}
if(!Q4.empty()){
int xQ4max=Q4[0].first , yQ4max=Q4[0].second;
int xQ4min=Q4[0].first , yQ4min=Q4[0].second;
for(auto e : Q4){
if(e.first > xQ4max){
xQ4max = e.first;
}
if(e.first < xQ4min){
xQ4min = e.first;
}
if(e.second > yQ4max){
yQ4max = e.second;
}
if(e.second < yQ4min){
yQ4min = e.second;
}
}
int areaQ4 = (yQ4max - yQ4min) * (xQ4max - xQ4min);
if(areaQ4 < 0) areaQ4 = -areaQ4;
cout << "Q4: (" << xQ4min << ", " << yQ4min << ") (" << xQ4max << ", " << yQ4max << ") " << areaQ4 << endl;
}
if(Q1.empty() && Q2.empty() && Q3.empty() && Q4.empty()){
cout << "No point in any quadrant";
}
} | # 2071949, 2024-11-02 15:29:38, PPP-PP-P-- (60%)
#include <iostream>
#include <vector>
#include <utility>
using namespace std;
int main(){
int n;
cin >> n;
vector<pair<int,int>> Q1 = {};
vector<pair<int,int>> Q2 = {};
vector<pair<int,int>> Q3 = {};
vector<pair<int,int>> Q4 = {};
pair<int,int> a;
int x=0,y=0;
for(int i = 0 ; i < n ; i++){
cin >> x >> y;
if(x == 0 || y == 0) continue;
if(x > 0 && y > 0){
a.first = x; a.second = y;
Q1.push_back(a);
continue;
}
if(x < 0 && y > 0){
a.first = x; a.second = y;
Q2.push_back(a);
continue;
}
if(x < 0 && y < 0){
a.first = x; a.second = y;
Q3.push_back(a);
continue;
}
if(x > 0 && y < 0){
a.first = x; a.second = y;
Q4.push_back(a);
continue;
}
}
if(!Q1.empty()){
int xQ1max=Q1[0].first , yQ1max=Q1[0].second;
int xQ1min=Q1[0].first , yQ1min=Q1[0].second;
for(auto e : Q1){
if(e.first > xQ1max){
xQ1max = e.first;
}
if(e.first < xQ1min){
xQ1min = e.first;
}
if(e.second > yQ1max){
yQ1max = e.second;
}
if(e.second < yQ1min){
yQ1min = e.second;
}
}
int areaQ1 = (yQ1max - yQ1min) * (xQ1max - xQ1min);
if(areaQ1 < 0) areaQ1 = -areaQ1;
cout << "Q1: (" << xQ1min << ", " << yQ1min << ") (" << xQ1max << ", " << yQ1max << ") " << areaQ1<< endl;
}
if(!Q2.empty()){
int xQ2max=Q2[0].first , yQ2max=Q2[0].second;
int xQ2min=Q2[0].first , yQ2min=Q2[0].second;
for(auto e : Q2){
if(e.first > xQ2max){
xQ2max = e.first;
}
if(e.first < xQ2min){
xQ2min = e.first;
}
if(e.second > yQ2max){
yQ2max = e.second;
}
if(e.second < yQ2min){
yQ2min = e.second;
}
}
int areaQ2 = (yQ2max - yQ2min) * (xQ2max - xQ2min);
if(areaQ2 < 0) areaQ2 = -areaQ2;
cout << "Q2: (" << xQ2min << ", " << yQ2min << ") (" << xQ2max << ", " << yQ2max << ") " << areaQ2 << endl;
}
if(!Q3.empty()){
int xQ3max=Q3[0].first , yQ3max=Q3[0].second;
int xQ3min=Q3[0].first , yQ3min=Q3[0].second;
for(auto e : Q3){
if(e.first > xQ3max){
xQ3max = e.first;
}
if(e.first < xQ3min){
xQ3min = e.first;
}
if(e.second > yQ3max){
yQ3max = e.second;
}
if(e.second < yQ3min){
yQ3min = e.second;
}
}
int areaQ3 = (yQ3max - yQ3min) * (xQ3max - xQ3min);
if(areaQ3 < 0) areaQ3 = -areaQ3;
cout << "Q3: (" << xQ3min << ", " << yQ3min << ") (" << xQ3max << ", " << yQ3min << ") " << areaQ3 << endl;
}
if(!Q4.empty()){
int xQ4max=Q4[0].first , yQ4max=Q4[0].second;
int xQ4min=Q4[0].first , yQ4min=Q4[0].second;
for(auto e : Q4){
if(e.first > xQ4max){
xQ4max = e.first;
}
if(e.first < xQ4min){
xQ4min = e.first;
}
if(e.second > yQ4max){
yQ4max = e.second;
}
if(e.second < yQ4min){
yQ4min = e.second;
}
}
int areaQ4 = (yQ4max - yQ4min) * (xQ4max - xQ4min);
if(areaQ4 < 0) areaQ4 = -areaQ4;
cout << "Q4: (" << xQ4min << ", " << yQ4min << ") (" << xQ4max << ", " << yQ4max << ") " << areaQ4 << endl;
}
if(Q1.empty() && Q2.empty() && Q3.empty() && Q4.empty()){
cout << "No point in any quadrant";
}
} |
# 2071022, 2024-11-02 13:46:50, ----PPPPPP (60%)
#include<iostream>
#include<vector>
#include<utility>
using namespace std;
int main()
{
int n,x,y;
vector<pair<int,int>> Q1,Q2,Q3,Q4;
bool found=false;
cin>>n;
while(n--)
{
cin>>x>>y;
if(x>0&&y>0) Q1.push_back(make_pair(x,y));
else if(x<0&&y>0) Q2.push_back(make_pair(x,y));
else if(x<0&&y<0) Q3.push_back(make_pair(x,y));
else if(x>0&&y<0) Q4.push_back(make_pair(x,y));
}
int max_x=-2000000,max_y=-2000000,min_x=2000000,min_y=2000000;
for(auto itr : Q1)
{
found=true;
if(itr.first>max_x) max_x=itr.first;
if(itr.second>max_y) max_y=itr.second;
if(itr.first<min_x) min_x=itr.first;
if(itr.second<min_y) min_y=itr.second;
}
if(found) cout<<"Q1: ("<<min_x<<", "<<min_y<<") ("<<max_x<<", "<<max_y<<") "<<(max_x-min_x)*(max_y-min_y)<<endl;
max_x=-2000000,max_y=-2000000,min_x=2000000,min_y=2000000;
found=false;
for(auto itr : Q2)
{
found=true;
if(itr.first>max_x) max_x=itr.first;
if(itr.second>max_y) max_y=itr.second;
if(itr.first<min_x) min_x=itr.first;
if(itr.second<min_y) min_y=itr.second;
}
if(found) cout<<"Q2: ("<<min_x<<", "<<min_y<<") ("<<max_x<<", "<<max_y<<") "<<(max_x-min_x)*(max_y-min_y)<<endl;
max_x=-2000000,max_y=-2000000,min_x=2000000,min_y=2000000;
found=false;
for(auto itr : Q3)
{
found=true;
if(itr.first>max_x) max_x=itr.first;
if(itr.second>max_y) max_y=itr.second;
if(itr.first<min_x) min_x=itr.first;
if(itr.second<min_y) min_y=itr.second;
}
if(found) cout<<"Q3: ("<<min_x<<", "<<min_y<<") ("<<max_x<<", "<<max_y<<") "<<(max_x-min_x)*(max_y-min_y)<<endl;
max_x=-2000000,max_y=-2000000,min_x=2000000,min_y=2000000;
found=false;
for(auto itr : Q4)
{
found=true;
if(itr.first>max_x) max_x=itr.first;
if(itr.second>max_y) max_y=itr.second;
if(itr.first<min_x) min_x=itr.first;
if(itr.second<min_y) min_y=itr.second;
}
if(found) cout<<"Q4: ("<<min_x<<", "<<min_y<<") ("<<max_x<<", "<<max_y<<") "<<(max_x-min_x)*(max_y-min_y)<<endl;
if(found==false) cout<<"No point in any quadrant";
return 0;
} | # 2071038, 2024-11-02 13:48:19, ----PPPPPP (60%)
#include<iostream>
#include<vector>
#include<utility>
using namespace std;
int main()
{
int n,x,y;
vector<pair<int,int>> Q1,Q2,Q3,Q4;
bool found=false;
cin>>n;
while(n--)
{
cin>>x>>y;
if(x>0&&y>0) Q1.push_back(make_pair(x,y));
else if(x<0&&y>0) Q2.push_back(make_pair(x,y));
else if(x<0&&y<0) Q3.push_back(make_pair(x,y));
else if(x>0&&y<0) Q4.push_back(make_pair(x,y));
}
int max_x=-2000000,max_y=-2000000,min_x=2000000,min_y=2000000;
for(auto itr : Q1)
{
found=true;
if(itr.first>max_x) max_x=itr.first;
if(itr.second>max_y) max_y=itr.second;
if(itr.first<min_x) min_x=itr.first;
if(itr.second<min_y) min_y=itr.second;
}
if(found) cout<<"Q1: ("<<min_x<<", "<<min_y<<") ("<<max_x<<", "<<max_y<<") "<<(max_x-min_x)*(max_y-min_y)<<endl;
max_x=-2000000,max_y=-2000000,min_x=2000000,min_y=2000000;
found=false;
for(auto itr : Q2)
{
found=true;
if(itr.first>max_x) max_x=itr.first;
if(itr.second>max_y) max_y=itr.second;
if(itr.first<min_x) min_x=itr.first;
if(itr.second<min_y) min_y=itr.second;
}
if(found) cout<<"Q2: ("<<min_x<<", "<<min_y<<") ("<<max_x<<", "<<max_y<<") "<<(max_x-min_x)*(max_y-min_y)<<endl;
max_x=-2000000,max_y=-2000000,min_x=2000000,min_y=2000000;
found=false;
for(auto itr : Q3)
{
found=true;
if(itr.first>max_x) max_x=itr.first;
if(itr.second>max_y) max_y=itr.second;
if(itr.first<min_x) min_x=itr.first;
if(itr.second<min_y) min_y=itr.second;
}
if(found) cout<<"Q3: ("<<min_x<<", "<<min_y<<") ("<<max_x<<", "<<max_y<<") "<<(max_x-min_x)*(max_y-min_y)<<endl;
max_x=-2000000,max_y=-2000000,min_x=2000000,min_y=2000000;
found=false;
for(auto itr : Q4)
{
found=true;
if(itr.first>max_x) max_x=itr.first;
if(itr.second>max_y) max_y=itr.second;
if(itr.first<min_x) min_x=itr.first;
if(itr.second<min_y) min_y=itr.second;
}
if(found) cout<<"Q4: ("<<min_x<<", "<<min_y<<") ("<<max_x<<", "<<max_y<<") "<<(max_x-min_x)*(max_y-min_y)<<endl;
if(found==false) cout<<"No point in any quadrant";
return 0;
} | # 2071194, 2024-11-02 14:06:43, ----PPPPPP (60%)
#include<iostream>
#include<vector>
#include<utility>
using namespace std;
int main()
{
int n,x,y;
vector<pair<int,int>> Q1,Q2,Q3,Q4;
bool found=false;
cin>>n;
while(n--)
{
cin>>x>>y;
if(x>0&&y>0) Q1.push_back(make_pair(x,y));
else if(x<0&&y>0) Q2.push_back(make_pair(x,y));
else if(x<0&&y<0) Q3.push_back(make_pair(x,y));
else if(x>0&&y<0) Q4.push_back(make_pair(x,y));
}
int max_x=-2000000,max_y=-2000000,min_x=2000000,min_y=2000000;
for(auto itr : Q1)
{
found=true;
if(itr.first>max_x) max_x=itr.first;
if(itr.second>max_y) max_y=itr.second;
if(itr.first<min_x) min_x=itr.first;
if(itr.second<min_y) min_y=itr.second;
}
if(found) cout<<"Q1: ("<<min_x<<", "<<min_y<<") ("<<max_x<<", "<<max_y<<") "<<(max_x-min_x)*(max_y-min_y)<<endl;
max_x=-2000000,max_y=-2000000,min_x=2000000,min_y=2000000;
found=false;
for(auto itr : Q2)
{
found=true;
if(itr.first>max_x) max_x=itr.first;
if(itr.second>max_y) max_y=itr.second;
if(itr.first<min_x) min_x=itr.first;
if(itr.second<min_y) min_y=itr.second;
}
if(found) cout<<"Q2: ("<<min_x<<", "<<min_y<<") ("<<max_x<<", "<<max_y<<") "<<(max_x-min_x)*(max_y-min_y)<<endl;
max_x=-2000000,max_y=-2000000,min_x=2000000,min_y=2000000;
found=false;
for(auto itr : Q3)
{
found=true;
if(itr.first>max_x) max_x=itr.first;
if(itr.second>max_y) max_y=itr.second;
if(itr.first<min_x) min_x=itr.first;
if(itr.second<min_y) min_y=itr.second;
}
if(found) cout<<"Q3: ("<<min_x<<", "<<min_y<<") ("<<max_x<<", "<<max_y<<") "<<(max_x-min_x)*(max_y-min_y)<<endl;
max_x=-2000000,max_y=-2000000,min_x=2000000,min_y=2000000;
found=false;
for(auto itr : Q4)
{
found=true;
if(itr.first>max_x) max_x=itr.first;
if(itr.second>max_y) max_y=itr.second;
if(itr.first<min_x) min_x=itr.first;
if(itr.second<min_y) min_y=itr.second;
}
if(found) cout<<"Q4: ("<<min_x<<", "<<min_y<<") ("<<max_x<<", "<<max_y<<") "<<(max_x-min_x)*(max_y-min_y)<<endl;
if(found==false) cout<<"No point in any quadrant"<<endl;
return 0;
} | # 2071211, 2024-11-02 14:07:50, ----PPPPPP (60%)
#include<iostream>
#include<vector>
#include<utility>
using namespace std;
int main()
{
int n,x,y;
vector<pair<int,int>> Q1,Q2,Q3,Q4;
bool found=false;
cin>>n;
while(n--)
{
cin>>x>>y;
if(x>0&&y>0) Q1.push_back(make_pair(x,y));
else if(x<0&&y>0) Q2.push_back(make_pair(x,y));
else if(x<0&&y<0) Q3.push_back(make_pair(x,y));
else if(x>0&&y<0) Q4.push_back(make_pair(x,y));
}
int max_x=-2000000000,max_y=-2000000000,min_x=2000000000,min_y=2000000000;
for(auto itr : Q1)
{
found=true;
if(itr.first>max_x) max_x=itr.first;
if(itr.second>max_y) max_y=itr.second;
if(itr.first<min_x) min_x=itr.first;
if(itr.second<min_y) min_y=itr.second;
}
if(found) cout<<"Q1: ("<<min_x<<", "<<min_y<<") ("<<max_x<<", "<<max_y<<") "<<(max_x-min_x)*(max_y-min_y)<<endl;
max_x=-2000000000,max_y=-2000000000,min_x=2000000000,min_y=2000000000;
found=false;
for(auto itr : Q2)
{
found=true;
if(itr.first>max_x) max_x=itr.first;
if(itr.second>max_y) max_y=itr.second;
if(itr.first<min_x) min_x=itr.first;
if(itr.second<min_y) min_y=itr.second;
}
if(found) cout<<"Q2: ("<<min_x<<", "<<min_y<<") ("<<max_x<<", "<<max_y<<") "<<(max_x-min_x)*(max_y-min_y)<<endl;
max_x=-2000000000,max_y=-2000000000,min_x=2000000000,min_y=2000000000;
found=false;
for(auto itr : Q3)
{
found=true;
if(itr.first>max_x) max_x=itr.first;
if(itr.second>max_y) max_y=itr.second;
if(itr.first<min_x) min_x=itr.first;
if(itr.second<min_y) min_y=itr.second;
}
if(found) cout<<"Q3: ("<<min_x<<", "<<min_y<<") ("<<max_x<<", "<<max_y<<") "<<(max_x-min_x)*(max_y-min_y)<<endl;
max_x=-2000000000,max_y=-2000000000,min_x=2000000000,min_y=2000000000;
found=false;
for(auto itr : Q4)
{
found=true;
if(itr.first>max_x) max_x=itr.first;
if(itr.second>max_y) max_y=itr.second;
if(itr.first<min_x) min_x=itr.first;
if(itr.second<min_y) min_y=itr.second;
}
if(found) cout<<"Q4: ("<<min_x<<", "<<min_y<<") ("<<max_x<<", "<<max_y<<") "<<(max_x-min_x)*(max_y-min_y)<<endl;
if(found==false) cout<<"No point in any quadrant"<<endl;
return 0;
} | # 2071216, 2024-11-02 14:08:53, ----PPPPPP (60%)
#include<iostream>
#include<vector>
#include<utility>
using namespace std;
int main()
{
long n,x,y;
vector<pair<long,long>> Q1,Q2,Q3,Q4;
bool found=false;
cin>>n;
while(n--)
{
cin>>x>>y;
if(x>0&&y>0) Q1.push_back(make_pair(x,y));
else if(x<0&&y>0) Q2.push_back(make_pair(x,y));
else if(x<0&&y<0) Q3.push_back(make_pair(x,y));
else if(x>0&&y<0) Q4.push_back(make_pair(x,y));
}
long max_x=-2000000000,max_y=-2000000000,min_x=2000000000,min_y=2000000000;
for(auto itr : Q1)
{
found=true;
if(itr.first>max_x) max_x=itr.first;
if(itr.second>max_y) max_y=itr.second;
if(itr.first<min_x) min_x=itr.first;
if(itr.second<min_y) min_y=itr.second;
}
if(found) cout<<"Q1: ("<<min_x<<", "<<min_y<<") ("<<max_x<<", "<<max_y<<") "<<(max_x-min_x)*(max_y-min_y)<<endl;
max_x=-2000000000,max_y=-2000000000,min_x=2000000000,min_y=2000000000;
found=false;
for(auto itr : Q2)
{
found=true;
if(itr.first>max_x) max_x=itr.first;
if(itr.second>max_y) max_y=itr.second;
if(itr.first<min_x) min_x=itr.first;
if(itr.second<min_y) min_y=itr.second;
}
if(found) cout<<"Q2: ("<<min_x<<", "<<min_y<<") ("<<max_x<<", "<<max_y<<") "<<(max_x-min_x)*(max_y-min_y)<<endl;
max_x=-2000000000,max_y=-2000000000,min_x=2000000000,min_y=2000000000;
found=false;
for(auto itr : Q3)
{
found=true;
if(itr.first>max_x) max_x=itr.first;
if(itr.second>max_y) max_y=itr.second;
if(itr.first<min_x) min_x=itr.first;
if(itr.second<min_y) min_y=itr.second;
}
if(found) cout<<"Q3: ("<<min_x<<", "<<min_y<<") ("<<max_x<<", "<<max_y<<") "<<(max_x-min_x)*(max_y-min_y)<<endl;
max_x=-2000000000,max_y=-2000000000,min_x=2000000000,min_y=2000000000;
found=false;
for(auto itr : Q4)
{
found=true;
if(itr.first>max_x) max_x=itr.first;
if(itr.second>max_y) max_y=itr.second;
if(itr.first<min_x) min_x=itr.first;
if(itr.second<min_y) min_y=itr.second;
}
if(found) cout<<"Q4: ("<<min_x<<", "<<min_y<<") ("<<max_x<<", "<<max_y<<") "<<(max_x-min_x)*(max_y-min_y)<<endl;
if(found==false) cout<<"No point in any quadrant"<<endl;
return 0;
} | # 2071293, 2024-11-02 14:19:49, ----PPPPPP (60%)
#include<iostream>
#include<vector>
#include<utility>
using namespace std;
int main()
{
int n,x,y;
vector<pair<int,int>> Q1,Q2,Q3,Q4;
bool found=false;
cin>>n;
while(n--)
{
cin>>x>>y;
if(x>0&&y>0) Q1.push_back(make_pair(x,y));
else if(x<0&&y>0) Q2.push_back(make_pair(x,y));
else if(x<0&&y<0) Q3.push_back(make_pair(x,y));
else if(x>0&&y<0) Q4.push_back(make_pair(x,y));
}
int max_x=0,max_y=0,min_x=2000000000,min_y=2000000000;
for(auto itr : Q1)
{
found=true;
if(itr.first>max_x) max_x=itr.first;
if(itr.second>max_y) max_y=itr.second;
if(itr.first<min_x) min_x=itr.first;
if(itr.second<min_y) min_y=itr.second;
}
if(found) cout<<"Q1: ("<<min_x<<", "<<min_y<<") ("<<max_x<<", "<<max_y<<") "<<(max_x-min_x)*(max_y-min_y)<<endl;
max_x=-2000000000,max_y=0,min_x=0,min_y=2000000000;
found=false;
for(auto itr : Q2)
{
found=true;
if(itr.first>max_x) max_x=itr.first;
if(itr.second>max_y) max_y=itr.second;
if(itr.first<min_x) min_x=itr.first;
if(itr.second<min_y) min_y=itr.second;
}
if(found) cout<<"Q2: ("<<min_x<<", "<<min_y<<") ("<<max_x<<", "<<max_y<<") "<<(max_x-min_x)*(max_y-min_y)<<endl;
max_x=-2000000000,max_y=-2000000000,min_x=0,min_y=0;
found=false;
for(auto itr : Q3)
{
found=true;
if(itr.first>max_x) max_x=itr.first;
if(itr.second>max_y) max_y=itr.second;
if(itr.first<min_x) min_x=itr.first;
if(itr.second<min_y) min_y=itr.second;
}
if(found) cout<<"Q3: ("<<min_x<<", "<<min_y<<") ("<<max_x<<", "<<max_y<<") "<<(max_x-min_x)*(max_y-min_y)<<endl;
max_x=0,max_y=-2000000000,min_x=2000000000,min_y=0;
found=false;
for(auto itr : Q4)
{
found=true;
if(itr.first>max_x) max_x=itr.first;
if(itr.second>max_y) max_y=itr.second;
if(itr.first<min_x) min_x=itr.first;
if(itr.second<min_y) min_y=itr.second;
}
if(found) cout<<"Q4: ("<<min_x<<", "<<min_y<<") ("<<max_x<<", "<<max_y<<") "<<(max_x-min_x)*(max_y-min_y)<<endl;
if(found==false) cout<<"No point in any quadrant"<<endl;
return 0;
} |
# 2069107, 2024-11-02 10:12:55, Compilation error (0%)
#include<bits/stdc++.h>
using namespace std;
int main() {
int n; cin >> n;
map<double,double> pos;
vector<double> vec_x;
vector<double> vec_y;
double x,y;
for (int i=0;i<n;i++) {
cin >> x >> y;
vec_x.push_back(x);
vec_y.push_back(y);
}
vector<double> vec_x_q1;
vector<double> vec_y_q1;
vector<double> vec_x_q2;
vector<double> vec_y_q2;
vector<double> vec_x_q3;
vector<double> vec_y_q3;
vector<double> vec_x_q4;
vector<double> vec_y_q4;
for (int i=0;i<vec_x.size();i++) {
for (int j=0;j<vec_y.size();j++) {
if (x > 0 && y > 0) {
vec_x_q1.push_back(x);
vec_y_q1.push_back(y);
} else if (x < 0 && y > 0) {
vec_x_q2.push_back(x);
vec_y_q2.push_back(y);
} else if (x < 0 && y < 0) {
vec_x_q3.push_back(x);
vec_y_q3.push_back(y);
} else if (x > 0 && y < 0) {
vec_x_q4.push_back(x);
vec_y_q4.push_back(y);
}
}
}
if (vec_x_q1 == 0 && vec_x_q2 == 0 && vec_x_q3 == 0 && vec_x_q4 ==0) cout << "No point in any quadrant";
} | # 2069111, 2024-11-02 10:13:31, -----P---- (10%)
#include<bits/stdc++.h>
using namespace std;
int main() {
int n; cin >> n;
map<double,double> pos;
vector<double> vec_x;
vector<double> vec_y;
double x,y;
for (int i=0;i<n;i++) {
cin >> x >> y;
vec_x.push_back(x);
vec_y.push_back(y);
}
vector<double> vec_x_q1;
vector<double> vec_y_q1;
vector<double> vec_x_q2;
vector<double> vec_y_q2;
vector<double> vec_x_q3;
vector<double> vec_y_q3;
vector<double> vec_x_q4;
vector<double> vec_y_q4;
for (int i=0;i<vec_x.size();i++) {
for (int j=0;j<vec_y.size();j++) {
if (x > 0 && y > 0) {
vec_x_q1.push_back(x);
vec_y_q1.push_back(y);
} else if (x < 0 && y > 0) {
vec_x_q2.push_back(x);
vec_y_q2.push_back(y);
} else if (x < 0 && y < 0) {
vec_x_q3.push_back(x);
vec_y_q3.push_back(y);
} else if (x > 0 && y < 0) {
vec_x_q4.push_back(x);
vec_y_q4.push_back(y);
}
}
}
if (vec_x_q1.size() == 0 && vec_x_q2.size() == 0 && vec_x_q3.size() == 0 && vec_x_q4.size() ==0) cout << "No point in any quadrant";
} | # 2069601, 2024-11-02 11:02:39, xxxx-x--x- (0%)
#include<bits/stdc++.h>
using namespace std;
int main() {
int n; cin >> n;
vector<int> vec_x_q1,vec_y_q1;
vector<int> vec_x_q2,vec_y_q2;
vector<int> vec_x_q3,vec_y_q3;
vector<int> vec_x_q4,vec_y_q4;
int x,y;
for (int i=0;i<n;i++) {
cin >> x >> y;
if (x == 0 || y == 0) continue;
else if (x > 0 && y > 0) {
vec_x_q1.push_back(x);
vec_y_q1.push_back(y);
} else if (x < 0 && y > 0) {
vec_x_q2.push_back(x);
vec_y_q2.push_back(y);
} else if (x < 0 && y < 0) {
vec_x_q3.push_back(x);
vec_y_q3.push_back(y);
} else if (x > 0 && y < 0) {
vec_x_q4.push_back(x);
vec_y_q4.push_back(y);
}
}
if (vec_x_q1.size() == 0 && vec_x_q2.size() == 0 && vec_x_q3.size() == 0 && vec_x_q4.size() ==0) cout << "No point in any quadrant";
sort(vec_x_q1.begin(),vec_x_q1.end());
sort(vec_y_q1.begin(),vec_y_q1.end());
sort(vec_x_q2.begin(),vec_x_q2.end());
sort(vec_y_q2.begin(),vec_y_q2.end());
sort(vec_x_q3.begin(),vec_x_q3.end());
sort(vec_y_q3.begin(),vec_y_q3.end());
sort(vec_x_q4.begin(),vec_x_q4.end());
sort(vec_y_q4.begin(),vec_y_q4.end());
int max_x_q1 = vec_x_q1[vec_x_q1.size()-1];
int max_y_q1 = vec_y_q1[vec_y_q1.size()-1];
int min_x_q1 = vec_x_q1[0];
int min_y_q1 = vec_y_q1[0];
int area_1 = (max_y_q1-min_y_q1)*(max_x_q1-min_x_q1);
int max_x_q2 = vec_x_q2[vec_x_q2.size()-1];
int max_y_q2 = vec_y_q2[vec_y_q2.size()-1];
int min_x_q2 = vec_x_q2[0];
int min_y_q2 = vec_y_q2[0];
int area_2 = (max_y_q2-min_y_q2)*(max_x_q2-min_x_q2);
int max_x_q3 = vec_x_q3[vec_x_q3.size()-1];
int max_y_q3 = vec_y_q3[vec_y_q3.size()-1];
int min_x_q3 = vec_x_q3[0];
int min_y_q3 = vec_y_q3[0];
int area_3 = (max_y_q3-min_y_q3)*(max_x_q3-min_x_q3);
int max_x_q4 = vec_x_q4[vec_x_q4.size()-1];
int max_y_q4 = vec_y_q4[vec_y_q4.size()-1];
int min_x_q4 = vec_x_q4[0];
int min_y_q4 = vec_y_q4[0];
int area_4 = (max_y_q4-min_y_q4)*(max_x_q4-min_x_q4);
if (vec_x_q1.size() != 0 && vec_x_q2.size() != 0 && vec_x_q3.size() != 0 && vec_x_q4.size() !=0) {
cout << "Q1: (" << min_x_q1 << "," << min_y_q1 << ") (" << max_x_q1 << "," << max_y_q1 << ") " << area_1 << endl;
cout << "Q2: (" << min_x_q2 << "," << min_y_q2 << ") (" << max_x_q2 << "," << max_y_q2 << ") " << area_2 << endl;
cout << "Q3: (" << min_x_q3 << "," << min_y_q3 << ") (" << max_x_q3 << "," << max_y_q3 << ") " << area_3 << endl;
cout << "Q4: (" << min_x_q4 << "," << min_y_q4 << ") (" << max_x_q4 << "," << max_y_q4 << ") " << area_4 << endl;
} else if (vec_x_q1.size() == 0 && vec_x_q2.size() != 0 && vec_x_q3.size() != 0 && vec_x_q4.size() !=0) {
cout << "Q2: (" << min_x_q2 << "," << min_y_q2 << ") (" << max_x_q2 << "," << max_y_q2 << ") " << area_2 << endl;
cout << "Q3: (" << min_x_q3 << "," << min_y_q3 << ") (" << max_x_q3 << "," << max_y_q3 << ") " << area_3 << endl;
cout << "Q4: (" << min_x_q4 << "," << min_y_q4 << ") (" << max_x_q4 << "," << max_y_q4 << ") " << area_4 << endl;
} else if (vec_x_q1.size() != 0 && vec_x_q2.size() == 0 && vec_x_q3.size() != 0 && vec_x_q4.size() !=0) {
cout << "Q1: (" << min_x_q1 << "," << min_y_q1 << ") (" << max_x_q1 << "," << max_y_q1 << ") " << area_1 << endl;
cout << "Q3: (" << min_x_q3 << "," << min_y_q3 << ") (" << max_x_q3 << "," << max_y_q3 << ") " << area_3 << endl;
cout << "Q4: (" << min_x_q4 << "," << min_y_q4 << ") (" << max_x_q4 << "," << max_y_q4 << ") " << area_4 << endl;
} else if (vec_x_q1.size() != 0 && vec_x_q2.size() != 0 && vec_x_q3.size() == 0 && vec_x_q4.size() !=0) {
cout << "Q1: (" << min_x_q1 << "," << min_y_q1 << ") (" << max_x_q1 << "," << max_y_q1 << ") " << area_1 << endl;
cout << "Q2: (" << min_x_q2 << "," << min_y_q2 << ") (" << max_x_q2 << "," << max_y_q2 << ") " << area_2 << endl;
cout << "Q4: (" << min_x_q4 << "," << min_y_q4 << ") (" << max_x_q4 << "," << max_y_q4 << ") " << area_4 << endl;
} else if (vec_x_q1.size() != 0 && vec_x_q2.size() != 0 && vec_x_q3.size() != 0 && vec_x_q4.size() ==0) {
cout << "Q1: (" << min_x_q1 << "," << min_y_q1 << ") (" << max_x_q1 << "," << max_y_q1 << ") " << area_1 << endl;
cout << "Q2: (" << min_x_q2 << "," << min_y_q2 << ") (" << max_x_q2 << "," << max_y_q2 << ") " << area_2 << endl;
cout << "Q3: (" << min_x_q3 << "," << min_y_q3 << ") (" << max_x_q3 << "," << max_y_q3 << ") " << area_3 << endl;
}
} | # 2069614, 2024-11-02 11:03:52, xxxx-x--x- (0%)
#include<bits/stdc++.h>
using namespace std;
int main() {
int n; cin >> n;
vector<int> vec_x_q1,vec_y_q1;
vector<int> vec_x_q2,vec_y_q2;
vector<int> vec_x_q3,vec_y_q3;
vector<int> vec_x_q4,vec_y_q4;
int x,y;
for (int i=0;i<n;i++) {
cin >> x >> y;
if (x == 0 || y == 0) continue;
else if (x > 0 && y > 0) {
vec_x_q1.push_back(x);
vec_y_q1.push_back(y);
} else if (x < 0 && y > 0) {
vec_x_q2.push_back(x);
vec_y_q2.push_back(y);
} else if (x < 0 && y < 0) {
vec_x_q3.push_back(x);
vec_y_q3.push_back(y);
} else if (x > 0 && y < 0) {
vec_x_q4.push_back(x);
vec_y_q4.push_back(y);
}
}
sort(vec_x_q1.begin(),vec_x_q1.end());
sort(vec_y_q1.begin(),vec_y_q1.end());
sort(vec_x_q2.begin(),vec_x_q2.end());
sort(vec_y_q2.begin(),vec_y_q2.end());
sort(vec_x_q3.begin(),vec_x_q3.end());
sort(vec_y_q3.begin(),vec_y_q3.end());
sort(vec_x_q4.begin(),vec_x_q4.end());
sort(vec_y_q4.begin(),vec_y_q4.end());
int max_x_q1 = vec_x_q1[vec_x_q1.size()-1];
int max_y_q1 = vec_y_q1[vec_y_q1.size()-1];
int min_x_q1 = vec_x_q1[0];
int min_y_q1 = vec_y_q1[0];
int area_1 = (max_y_q1-min_y_q1)*(max_x_q1-min_x_q1);
int max_x_q2 = vec_x_q2[vec_x_q2.size()-1];
int max_y_q2 = vec_y_q2[vec_y_q2.size()-1];
int min_x_q2 = vec_x_q2[0];
int min_y_q2 = vec_y_q2[0];
int area_2 = (max_y_q2-min_y_q2)*(max_x_q2-min_x_q2);
int max_x_q3 = vec_x_q3[vec_x_q3.size()-1];
int max_y_q3 = vec_y_q3[vec_y_q3.size()-1];
int min_x_q3 = vec_x_q3[0];
int min_y_q3 = vec_y_q3[0];
int area_3 = (max_y_q3-min_y_q3)*(max_x_q3-min_x_q3);
int max_x_q4 = vec_x_q4[vec_x_q4.size()-1];
int max_y_q4 = vec_y_q4[vec_y_q4.size()-1];
int min_x_q4 = vec_x_q4[0];
int min_y_q4 = vec_y_q4[0];
int area_4 = (max_y_q4-min_y_q4)*(max_x_q4-min_x_q4);
if (vec_x_q1.size() == 0 && vec_x_q2.size() == 0 && vec_x_q3.size() == 0 && vec_x_q4.size() ==0) {
cout << "No point in any quadrant";
return 0;
}
if (vec_x_q1.size() != 0 && vec_x_q2.size() != 0 && vec_x_q3.size() != 0 && vec_x_q4.size() !=0) {
cout << "Q1: (" << min_x_q1 << "," << min_y_q1 << ") (" << max_x_q1 << "," << max_y_q1 << ") " << area_1 << endl;
cout << "Q2: (" << min_x_q2 << "," << min_y_q2 << ") (" << max_x_q2 << "," << max_y_q2 << ") " << area_2 << endl;
cout << "Q3: (" << min_x_q3 << "," << min_y_q3 << ") (" << max_x_q3 << "," << max_y_q3 << ") " << area_3 << endl;
cout << "Q4: (" << min_x_q4 << "," << min_y_q4 << ") (" << max_x_q4 << "," << max_y_q4 << ") " << area_4 << endl;
} else if (vec_x_q1.size() == 0 && vec_x_q2.size() != 0 && vec_x_q3.size() != 0 && vec_x_q4.size() !=0) {
cout << "Q2: (" << min_x_q2 << "," << min_y_q2 << ") (" << max_x_q2 << "," << max_y_q2 << ") " << area_2 << endl;
cout << "Q3: (" << min_x_q3 << "," << min_y_q3 << ") (" << max_x_q3 << "," << max_y_q3 << ") " << area_3 << endl;
cout << "Q4: (" << min_x_q4 << "," << min_y_q4 << ") (" << max_x_q4 << "," << max_y_q4 << ") " << area_4 << endl;
} else if (vec_x_q1.size() != 0 && vec_x_q2.size() == 0 && vec_x_q3.size() != 0 && vec_x_q4.size() !=0) {
cout << "Q1: (" << min_x_q1 << "," << min_y_q1 << ") (" << max_x_q1 << "," << max_y_q1 << ") " << area_1 << endl;
cout << "Q3: (" << min_x_q3 << "," << min_y_q3 << ") (" << max_x_q3 << "," << max_y_q3 << ") " << area_3 << endl;
cout << "Q4: (" << min_x_q4 << "," << min_y_q4 << ") (" << max_x_q4 << "," << max_y_q4 << ") " << area_4 << endl;
} else if (vec_x_q1.size() != 0 && vec_x_q2.size() != 0 && vec_x_q3.size() == 0 && vec_x_q4.size() !=0) {
cout << "Q1: (" << min_x_q1 << "," << min_y_q1 << ") (" << max_x_q1 << "," << max_y_q1 << ") " << area_1 << endl;
cout << "Q2: (" << min_x_q2 << "," << min_y_q2 << ") (" << max_x_q2 << "," << max_y_q2 << ") " << area_2 << endl;
cout << "Q4: (" << min_x_q4 << "," << min_y_q4 << ") (" << max_x_q4 << "," << max_y_q4 << ") " << area_4 << endl;
} else if (vec_x_q1.size() != 0 && vec_x_q2.size() != 0 && vec_x_q3.size() != 0 && vec_x_q4.size() ==0) {
cout << "Q1: (" << min_x_q1 << "," << min_y_q1 << ") (" << max_x_q1 << "," << max_y_q1 << ") " << area_1 << endl;
cout << "Q2: (" << min_x_q2 << "," << min_y_q2 << ") (" << max_x_q2 << "," << max_y_q2 << ") " << area_2 << endl;
cout << "Q3: (" << min_x_q3 << "," << min_y_q3 << ") (" << max_x_q3 << "," << max_y_q3 << ") " << area_3 << endl;
}
} | # 2069621, 2024-11-02 11:04:36, xxxxPxPPxP (40%)
#include<bits/stdc++.h>
using namespace std;
int main() {
int n; cin >> n;
vector<int> vec_x_q1,vec_y_q1;
vector<int> vec_x_q2,vec_y_q2;
vector<int> vec_x_q3,vec_y_q3;
vector<int> vec_x_q4,vec_y_q4;
int x,y;
for (int i=0;i<n;i++) {
cin >> x >> y;
if (x == 0 || y == 0) continue;
else if (x > 0 && y > 0) {
vec_x_q1.push_back(x);
vec_y_q1.push_back(y);
} else if (x < 0 && y > 0) {
vec_x_q2.push_back(x);
vec_y_q2.push_back(y);
} else if (x < 0 && y < 0) {
vec_x_q3.push_back(x);
vec_y_q3.push_back(y);
} else if (x > 0 && y < 0) {
vec_x_q4.push_back(x);
vec_y_q4.push_back(y);
}
}
sort(vec_x_q1.begin(),vec_x_q1.end());
sort(vec_y_q1.begin(),vec_y_q1.end());
sort(vec_x_q2.begin(),vec_x_q2.end());
sort(vec_y_q2.begin(),vec_y_q2.end());
sort(vec_x_q3.begin(),vec_x_q3.end());
sort(vec_y_q3.begin(),vec_y_q3.end());
sort(vec_x_q4.begin(),vec_x_q4.end());
sort(vec_y_q4.begin(),vec_y_q4.end());
int max_x_q1 = vec_x_q1[vec_x_q1.size()-1];
int max_y_q1 = vec_y_q1[vec_y_q1.size()-1];
int min_x_q1 = vec_x_q1[0];
int min_y_q1 = vec_y_q1[0];
int area_1 = (max_y_q1-min_y_q1)*(max_x_q1-min_x_q1);
int max_x_q2 = vec_x_q2[vec_x_q2.size()-1];
int max_y_q2 = vec_y_q2[vec_y_q2.size()-1];
int min_x_q2 = vec_x_q2[0];
int min_y_q2 = vec_y_q2[0];
int area_2 = (max_y_q2-min_y_q2)*(max_x_q2-min_x_q2);
int max_x_q3 = vec_x_q3[vec_x_q3.size()-1];
int max_y_q3 = vec_y_q3[vec_y_q3.size()-1];
int min_x_q3 = vec_x_q3[0];
int min_y_q3 = vec_y_q3[0];
int area_3 = (max_y_q3-min_y_q3)*(max_x_q3-min_x_q3);
int max_x_q4 = vec_x_q4[vec_x_q4.size()-1];
int max_y_q4 = vec_y_q4[vec_y_q4.size()-1];
int min_x_q4 = vec_x_q4[0];
int min_y_q4 = vec_y_q4[0];
int area_4 = (max_y_q4-min_y_q4)*(max_x_q4-min_x_q4);
if (vec_x_q1.size() == 0 && vec_x_q2.size() == 0 && vec_x_q3.size() == 0 && vec_x_q4.size() ==0) {
cout << "No point in any quadrant";
return 0;
}
if (vec_x_q1.size() != 0 && vec_x_q2.size() != 0 && vec_x_q3.size() != 0 && vec_x_q4.size() !=0) {
cout << "Q1: (" << min_x_q1 << ", " << min_y_q1 << ") (" << max_x_q1 << ", " << max_y_q1 << ") " << area_1 << endl;
cout << "Q2: (" << min_x_q2 << ", " << min_y_q2 << ") (" << max_x_q2 << ", " << max_y_q2 << ") " << area_2 << endl;
cout << "Q3: (" << min_x_q3 << ", " << min_y_q3 << ") (" << max_x_q3 << ", " << max_y_q3 << ") " << area_3 << endl;
cout << "Q4: (" << min_x_q4 << ", " << min_y_q4 << ") (" << max_x_q4 << ", " << max_y_q4 << ") " << area_4 << endl;
} else if (vec_x_q1.size() == 0 && vec_x_q2.size() != 0 && vec_x_q3.size() != 0 && vec_x_q4.size() !=0) {
cout << "Q2: (" << min_x_q2 << ", " << min_y_q2 << ") (" << max_x_q2 << ", " << max_y_q2 << ") " << area_2 << endl;
cout << "Q3: (" << min_x_q3 << ", " << min_y_q3 << ") (" << max_x_q3 << ", " << max_y_q3 << ") " << area_3 << endl;
cout << "Q4: (" << min_x_q4 << ", " << min_y_q4 << ") (" << max_x_q4 << ", " << max_y_q4 << ") " << area_4 << endl;
} else if (vec_x_q1.size() != 0 && vec_x_q2.size() == 0 && vec_x_q3.size() != 0 && vec_x_q4.size() !=0) {
cout << "Q1: (" << min_x_q1 << ", " << min_y_q1 << ") (" << max_x_q1 << ", " << max_y_q1 << ") " << area_1 << endl;
cout << "Q3: (" << min_x_q3 << ", " << min_y_q3 << ") (" << max_x_q3 << ", " << max_y_q3 << ") " << area_3 << endl;
cout << "Q4: (" << min_x_q4 << ", " << min_y_q4 << ") (" << max_x_q4 << ", " << max_y_q4 << ") " << area_4 << endl;
} else if (vec_x_q1.size() != 0 && vec_x_q2.size() != 0 && vec_x_q3.size() == 0 && vec_x_q4.size() !=0) {
cout << "Q1: (" << min_x_q1 << ", " << min_y_q1 << ") (" << max_x_q1 << ", " << max_y_q1 << ") " << area_1 << endl;
cout << "Q2: (" << min_x_q2 << ", " << min_y_q2 << ") (" << max_x_q2 << ", " << max_y_q2 << ") " << area_2 << endl;
cout << "Q4: (" << min_x_q4 << ", " << min_y_q4 << ") (" << max_x_q4 << ", " << max_y_q4 << ") " << area_4 << endl;
} else if (vec_x_q1.size() != 0 && vec_x_q2.size() != 0 && vec_x_q3.size() != 0 && vec_x_q4.size() ==0) {
cout << "Q1: (" << min_x_q1 << ", " << min_y_q1 << ") (" << max_x_q1 << ", " << max_y_q1 << ") " << area_1 << endl;
cout << "Q2: (" << min_x_q2 << ", " << min_y_q2 << ") (" << max_x_q2 << ", " << max_y_q2 << ") " << area_2 << endl;
cout << "Q3: (" << min_x_q3 << ", " << min_y_q3 << ") (" << max_x_q3 << ", " << max_y_q3 << ") " << area_3 << endl;
}
} | # 2069657, 2024-11-02 11:08:33, xxxxPxPPxP (40%)
#include<bits/stdc++.h>
using namespace std;
int main() {
int n; cin >> n;
vector<int> vec_x_q1,vec_y_q1;
vector<int> vec_x_q2,vec_y_q2;
vector<int> vec_x_q3,vec_y_q3;
vector<int> vec_x_q4,vec_y_q4;
int x,y;
for (int i=0;i<n;i++) {
cin >> x >> y;
if (x == 0 || y == 0) continue;
else if (x > 0 && y > 0) {
vec_x_q1.push_back(x);
vec_y_q1.push_back(y);
} else if (x < 0 && y > 0) {
vec_x_q2.push_back(x);
vec_y_q2.push_back(y);
} else if (x < 0 && y < 0) {
vec_x_q3.push_back(x);
vec_y_q3.push_back(y);
} else if (x > 0 && y < 0) {
vec_x_q4.push_back(x);
vec_y_q4.push_back(y);
}
}
sort(vec_x_q1.begin(),vec_x_q1.end());
sort(vec_y_q1.begin(),vec_y_q1.end());
sort(vec_x_q2.begin(),vec_x_q2.end());
sort(vec_y_q2.begin(),vec_y_q2.end());
sort(vec_x_q3.begin(),vec_x_q3.end());
sort(vec_y_q3.begin(),vec_y_q3.end());
sort(vec_x_q4.begin(),vec_x_q4.end());
sort(vec_y_q4.begin(),vec_y_q4.end());
int max_x_q1 = vec_x_q1[vec_x_q1.size()-1];
int max_y_q1 = vec_y_q1[vec_y_q1.size()-1];
int min_x_q1 = vec_x_q1[0];
int min_y_q1 = vec_y_q1[0];
int area_1 = (max_y_q1-min_y_q1)*(max_x_q1-min_x_q1);
int max_x_q2 = vec_x_q2[vec_x_q2.size()-1];
int max_y_q2 = vec_y_q2[vec_y_q2.size()-1];
int min_x_q2 = vec_x_q2[0];
int min_y_q2 = vec_y_q2[0];
int area_2 = (max_y_q2-min_y_q2)*(max_x_q2-min_x_q2);
int max_x_q3 = vec_x_q3[vec_x_q3.size()-1];
int max_y_q3 = vec_y_q3[vec_y_q3.size()-1];
int min_x_q3 = vec_x_q3[0];
int min_y_q3 = vec_y_q3[0];
int area_3 = (max_y_q3-min_y_q3)*(max_x_q3-min_x_q3);
int max_x_q4 = vec_x_q4[vec_x_q4.size()-1];
int max_y_q4 = vec_y_q4[vec_y_q4.size()-1];
int min_x_q4 = vec_x_q4[0];
int min_y_q4 = vec_y_q4[0];
int area_4 = (max_y_q4-min_y_q4)*(max_x_q4-min_x_q4);
if (vec_x_q1.size() == 0 && vec_x_q2.size() == 0 && vec_x_q3.size() == 0 && vec_x_q4.size() ==0) {
cout << "No point in any quadrant";
} else if (vec_x_q1.size() != 0 && vec_x_q2.size() != 0 && vec_x_q3.size() != 0 && vec_x_q4.size() !=0) {
cout << "Q1: (" << min_x_q1 << ", " << min_y_q1 << ") (" << max_x_q1 << ", " << max_y_q1 << ") " << area_1 << endl;
cout << "Q2: (" << min_x_q2 << ", " << min_y_q2 << ") (" << max_x_q2 << ", " << max_y_q2 << ") " << area_2 << endl;
cout << "Q3: (" << min_x_q3 << ", " << min_y_q3 << ") (" << max_x_q3 << ", " << max_y_q3 << ") " << area_3 << endl;
cout << "Q4: (" << min_x_q4 << ", " << min_y_q4 << ") (" << max_x_q4 << ", " << max_y_q4 << ") " << area_4 << endl;
} else if (vec_x_q1.size() == 0 && vec_x_q2.size() != 0 && vec_x_q3.size() != 0 && vec_x_q4.size() !=0) {
cout << "Q2: (" << min_x_q2 << ", " << min_y_q2 << ") (" << max_x_q2 << ", " << max_y_q2 << ") " << area_2 << endl;
cout << "Q3: (" << min_x_q3 << ", " << min_y_q3 << ") (" << max_x_q3 << ", " << max_y_q3 << ") " << area_3 << endl;
cout << "Q4: (" << min_x_q4 << ", " << min_y_q4 << ") (" << max_x_q4 << ", " << max_y_q4 << ") " << area_4 << endl;
} else if (vec_x_q1.size() != 0 && vec_x_q2.size() == 0 && vec_x_q3.size() != 0 && vec_x_q4.size() !=0) {
cout << "Q1: (" << min_x_q1 << ", " << min_y_q1 << ") (" << max_x_q1 << ", " << max_y_q1 << ") " << area_1 << endl;
cout << "Q3: (" << min_x_q3 << ", " << min_y_q3 << ") (" << max_x_q3 << ", " << max_y_q3 << ") " << area_3 << endl;
cout << "Q4: (" << min_x_q4 << ", " << min_y_q4 << ") (" << max_x_q4 << ", " << max_y_q4 << ") " << area_4 << endl;
} else if (vec_x_q1.size() != 0 && vec_x_q2.size() != 0 && vec_x_q3.size() == 0 && vec_x_q4.size() !=0) {
cout << "Q1: (" << min_x_q1 << ", " << min_y_q1 << ") (" << max_x_q1 << ", " << max_y_q1 << ") " << area_1 << endl;
cout << "Q2: (" << min_x_q2 << ", " << min_y_q2 << ") (" << max_x_q2 << ", " << max_y_q2 << ") " << area_2 << endl;
cout << "Q4: (" << min_x_q4 << ", " << min_y_q4 << ") (" << max_x_q4 << ", " << max_y_q4 << ") " << area_4 << endl;
} else if (vec_x_q1.size() != 0 && vec_x_q2.size() != 0 && vec_x_q3.size() != 0 && vec_x_q4.size() ==0) {
cout << "Q1: (" << min_x_q1 << ", " << min_y_q1 << ") (" << max_x_q1 << ", " << max_y_q1 << ") " << area_1 << endl;
cout << "Q2: (" << min_x_q2 << ", " << min_y_q2 << ") (" << max_x_q2 << ", " << max_y_q2 << ") " << area_2 << endl;
cout << "Q3: (" << min_x_q3 << ", " << min_y_q3 << ") (" << max_x_q3 << ", " << max_y_q3 << ") " << area_3 << endl;
}
} | # 2069692, 2024-11-02 11:14:04, xxxxPPPPxP (50%)
#include<bits/stdc++.h>
using namespace std;
int main() {
int n; cin >> n;
vector<int> vec_x_q1,vec_y_q1;
vector<int> vec_x_q2,vec_y_q2;
vector<int> vec_x_q3,vec_y_q3;
vector<int> vec_x_q4,vec_y_q4;
int x,y;
for (int i=0;i<n;i++) {
cin >> x >> y;
if (x == 0 || y == 0) {
continue;
} else if (x > 0 && y > 0) {
vec_x_q1.push_back(x);
vec_y_q1.push_back(y);
} else if (x < 0 && y > 0) {
vec_x_q2.push_back(x);
vec_y_q2.push_back(y);
} else if (x < 0 && y < 0) {
vec_x_q3.push_back(x);
vec_y_q3.push_back(y);
} else if (x > 0 && y < 0) {
vec_x_q4.push_back(x);
vec_y_q4.push_back(y);
}
}
if (vec_x_q1.size() == 0 && vec_x_q2.size() == 0 && vec_x_q3.size() == 0 && vec_x_q4.size() == 0) {
cout << "No point in any quadrant";
return 0;
}
sort(vec_x_q1.begin(),vec_x_q1.end());
sort(vec_y_q1.begin(),vec_y_q1.end());
sort(vec_x_q2.begin(),vec_x_q2.end());
sort(vec_y_q2.begin(),vec_y_q2.end());
sort(vec_x_q3.begin(),vec_x_q3.end());
sort(vec_y_q3.begin(),vec_y_q3.end());
sort(vec_x_q4.begin(),vec_x_q4.end());
sort(vec_y_q4.begin(),vec_y_q4.end());
int max_x_q1 = vec_x_q1[vec_x_q1.size()-1];
int max_y_q1 = vec_y_q1[vec_y_q1.size()-1];
int min_x_q1 = vec_x_q1[0];
int min_y_q1 = vec_y_q1[0];
int area_1 = (max_y_q1-min_y_q1)*(max_x_q1-min_x_q1);
int max_x_q2 = vec_x_q2[vec_x_q2.size()-1];
int max_y_q2 = vec_y_q2[vec_y_q2.size()-1];
int min_x_q2 = vec_x_q2[0];
int min_y_q2 = vec_y_q2[0];
int area_2 = (max_y_q2-min_y_q2)*(max_x_q2-min_x_q2);
int max_x_q3 = vec_x_q3[vec_x_q3.size()-1];
int max_y_q3 = vec_y_q3[vec_y_q3.size()-1];
int min_x_q3 = vec_x_q3[0];
int min_y_q3 = vec_y_q3[0];
int area_3 = (max_y_q3-min_y_q3)*(max_x_q3-min_x_q3);
int max_x_q4 = vec_x_q4[vec_x_q4.size()-1];
int max_y_q4 = vec_y_q4[vec_y_q4.size()-1];
int min_x_q4 = vec_x_q4[0];
int min_y_q4 = vec_y_q4[0];
int area_4 = (max_y_q4-min_y_q4)*(max_x_q4-min_x_q4);
if (vec_x_q1.size() == 0 && vec_x_q2.size() == 0 && vec_x_q3.size() == 0 && vec_x_q4.size() == 0) {
cout << "No point in any quadrant";
} else if (vec_x_q1.size() != 0 && vec_x_q2.size() != 0 && vec_x_q3.size() != 0 && vec_x_q4.size() !=0) {
cout << "Q1: (" << min_x_q1 << ", " << min_y_q1 << ") (" << max_x_q1 << ", " << max_y_q1 << ") " << area_1 << endl;
cout << "Q2: (" << min_x_q2 << ", " << min_y_q2 << ") (" << max_x_q2 << ", " << max_y_q2 << ") " << area_2 << endl;
cout << "Q3: (" << min_x_q3 << ", " << min_y_q3 << ") (" << max_x_q3 << ", " << max_y_q3 << ") " << area_3 << endl;
cout << "Q4: (" << min_x_q4 << ", " << min_y_q4 << ") (" << max_x_q4 << ", " << max_y_q4 << ") " << area_4 << endl;
} else if (vec_x_q1.size() == 0 && vec_x_q2.size() != 0 && vec_x_q3.size() != 0 && vec_x_q4.size() !=0) {
cout << "Q2: (" << min_x_q2 << ", " << min_y_q2 << ") (" << max_x_q2 << ", " << max_y_q2 << ") " << area_2 << endl;
cout << "Q3: (" << min_x_q3 << ", " << min_y_q3 << ") (" << max_x_q3 << ", " << max_y_q3 << ") " << area_3 << endl;
cout << "Q4: (" << min_x_q4 << ", " << min_y_q4 << ") (" << max_x_q4 << ", " << max_y_q4 << ") " << area_4 << endl;
} else if (vec_x_q1.size() != 0 && vec_x_q2.size() == 0 && vec_x_q3.size() != 0 && vec_x_q4.size() !=0) {
cout << "Q1: (" << min_x_q1 << ", " << min_y_q1 << ") (" << max_x_q1 << ", " << max_y_q1 << ") " << area_1 << endl;
cout << "Q3: (" << min_x_q3 << ", " << min_y_q3 << ") (" << max_x_q3 << ", " << max_y_q3 << ") " << area_3 << endl;
cout << "Q4: (" << min_x_q4 << ", " << min_y_q4 << ") (" << max_x_q4 << ", " << max_y_q4 << ") " << area_4 << endl;
} else if (vec_x_q1.size() != 0 && vec_x_q2.size() != 0 && vec_x_q3.size() == 0 && vec_x_q4.size() !=0) {
cout << "Q1: (" << min_x_q1 << ", " << min_y_q1 << ") (" << max_x_q1 << ", " << max_y_q1 << ") " << area_1 << endl;
cout << "Q2: (" << min_x_q2 << ", " << min_y_q2 << ") (" << max_x_q2 << ", " << max_y_q2 << ") " << area_2 << endl;
cout << "Q4: (" << min_x_q4 << ", " << min_y_q4 << ") (" << max_x_q4 << ", " << max_y_q4 << ") " << area_4 << endl;
} else if (vec_x_q1.size() != 0 && vec_x_q2.size() != 0 && vec_x_q3.size() != 0 && vec_x_q4.size() ==0) {
cout << "Q1: (" << min_x_q1 << ", " << min_y_q1 << ") (" << max_x_q1 << ", " << max_y_q1 << ") " << area_1 << endl;
cout << "Q2: (" << min_x_q2 << ", " << min_y_q2 << ") (" << max_x_q2 << ", " << max_y_q2 << ") " << area_2 << endl;
cout << "Q3: (" << min_x_q3 << ", " << min_y_q3 << ") (" << max_x_q3 << ", " << max_y_q3 << ") " << area_3 << endl;
}
} | # 2069895, 2024-11-02 11:34:13, xxxxPPPPxP (50%)
#include<bits/stdc++.h>
using namespace std;
int main() {
int n; cin >> n;
vector<int> vec_x_q1,vec_y_q1;
vector<int> vec_x_q2,vec_y_q2;
vector<int> vec_x_q3,vec_y_q3;
vector<int> vec_x_q4,vec_y_q4;
int x,y;
for (int i=0;i<n;i++) {
cin >> x >> y;
if (x == 0 || y == 0) {
continue;
} else if (x > 0 && y > 0) {
vec_x_q1.push_back(x);
vec_y_q1.push_back(y);
} else if (x < 0 && y > 0) {
vec_x_q2.push_back(x);
vec_y_q2.push_back(y);
} else if (x < 0 && y < 0) {
vec_x_q3.push_back(x);
vec_y_q3.push_back(y);
} else if (x > 0 && y < 0) {
vec_x_q4.push_back(x);
vec_y_q4.push_back(y);
}
}
if (vec_x_q1.size() == 0 && vec_x_q2.size() == 0 && vec_x_q3.size() == 0 && vec_x_q4.size() == 0) {
cout << "No point in any quadrant";
return 0;
}
sort(vec_x_q1.begin(),vec_x_q1.end());
sort(vec_y_q1.begin(),vec_y_q1.end());
sort(vec_x_q2.begin(),vec_x_q2.end());
sort(vec_y_q2.begin(),vec_y_q2.end());
sort(vec_x_q3.begin(),vec_x_q3.end());
sort(vec_y_q3.begin(),vec_y_q3.end());
sort(vec_x_q4.begin(),vec_x_q4.end());
sort(vec_y_q4.begin(),vec_y_q4.end());
int max_x_q1 = vec_x_q1[vec_x_q1.size()-1];
int max_y_q1 = vec_y_q1[vec_y_q1.size()-1];
int min_x_q1 = vec_x_q1[0];
int min_y_q1 = vec_y_q1[0];
int area_1 = (max_y_q1-min_y_q1)*(max_x_q1-min_x_q1);
int max_x_q2 = vec_x_q2[vec_x_q2.size()-1];
int max_y_q2 = vec_y_q2[vec_y_q2.size()-1];
int min_x_q2 = vec_x_q2[0];
int min_y_q2 = vec_y_q2[0];
int area_2 = (max_y_q2-min_y_q2)*(max_x_q2-min_x_q2);
int max_x_q3 = vec_x_q3[vec_x_q3.size()-1];
int max_y_q3 = vec_y_q3[vec_y_q3.size()-1];
int min_x_q3 = vec_x_q3[0];
int min_y_q3 = vec_y_q3[0];
int area_3 = (max_y_q3-min_y_q3)*(max_x_q3-min_x_q3);
int max_x_q4 = vec_x_q4[vec_x_q4.size()-1];
int max_y_q4 = vec_y_q4[vec_y_q4.size()-1];
int min_x_q4 = vec_x_q4[0];
int min_y_q4 = vec_y_q4[0];
int area_4 = (max_y_q4-min_y_q4)*(max_x_q4-min_x_q4);
if (vec_x_q1.size() == 0 && vec_x_q2.size() == 0 && vec_x_q3.size() == 0 && vec_x_q4.size() == 0) {
cout << "No point in any quadrant";
} else if (vec_x_q1.size() != 0 && vec_x_q2.size() != 0 && vec_x_q3.size() != 0 && vec_x_q4.size() !=0) {
cout << "Q1: (" << min_x_q1 << ", " << min_y_q1 << ") (" << max_x_q1 << ", " << max_y_q1 << ") " << area_1 << endl;
cout << "Q2: (" << min_x_q2 << ", " << min_y_q2 << ") (" << max_x_q2 << ", " << max_y_q2 << ") " << area_2 << endl;
cout << "Q3: (" << min_x_q3 << ", " << min_y_q3 << ") (" << max_x_q3 << ", " << max_y_q3 << ") " << area_3 << endl;
cout << "Q4: (" << min_x_q4 << ", " << min_y_q4 << ") (" << max_x_q4 << ", " << max_y_q4 << ") " << area_4 << endl;
} else if (vec_x_q1.size() == 0 && vec_x_q2.size() != 0 && vec_x_q3.size() != 0 && vec_x_q4.size() !=0) {
cout << "Q2: (" << min_x_q2 << ", " << min_y_q2 << ") (" << max_x_q2 << ", " << max_y_q2 << ") " << area_2 << endl;
cout << "Q3: (" << min_x_q3 << ", " << min_y_q3 << ") (" << max_x_q3 << ", " << max_y_q3 << ") " << area_3 << endl;
cout << "Q4: (" << min_x_q4 << ", " << min_y_q4 << ") (" << max_x_q4 << ", " << max_y_q4 << ") " << area_4 << endl;
} else if (vec_x_q1.size() != 0 && vec_x_q2.size() == 0 && vec_x_q3.size() != 0 && vec_x_q4.size() !=0) {
cout << "Q1: (" << min_x_q1 << ", " << min_y_q1 << ") (" << max_x_q1 << ", " << max_y_q1 << ") " << area_1 << endl;
cout << "Q3: (" << min_x_q3 << ", " << min_y_q3 << ") (" << max_x_q3 << ", " << max_y_q3 << ") " << area_3 << endl;
cout << "Q4: (" << min_x_q4 << ", " << min_y_q4 << ") (" << max_x_q4 << ", " << max_y_q4 << ") " << area_4 << endl;
} else if (vec_x_q1.size() != 0 && vec_x_q2.size() != 0 && vec_x_q3.size() == 0 && vec_x_q4.size() !=0) {
cout << "Q1: (" << min_x_q1 << ", " << min_y_q1 << ") (" << max_x_q1 << ", " << max_y_q1 << ") " << area_1 << endl;
cout << "Q2: (" << min_x_q2 << ", " << min_y_q2 << ") (" << max_x_q2 << ", " << max_y_q2 << ") " << area_2 << endl;
cout << "Q4: (" << min_x_q4 << ", " << min_y_q4 << ") (" << max_x_q4 << ", " << max_y_q4 << ") " << area_4 << endl;
} else if (vec_x_q1.size() != 0 && vec_x_q2.size() != 0 && vec_x_q3.size() != 0 && vec_x_q4.size() ==0) {
cout << "Q1: (" << min_x_q1 << ", " << min_y_q1 << ") (" << max_x_q1 << ", " << max_y_q1 << ") " << area_1 << endl;
cout << "Q2: (" << min_x_q2 << ", " << min_y_q2 << ") (" << max_x_q2 << ", " << max_y_q2 << ") " << area_2 << endl;
cout << "Q3: (" << min_x_q3 << ", " << min_y_q3 << ") (" << max_x_q3 << ", " << max_y_q3 << ") " << area_3 << endl;
} else if (vec_x_q1.size() == 0 && vec_x_q2.size() == 0 && vec_x_q3.size() != 0 && vec_x_q4.size() !=0) { //---------------------
cout << "Q3: (" << min_x_q3 << ", " << min_y_q3 << ") (" << max_x_q3 << ", " << max_y_q3 << ") " << area_3 << endl;
cout << "Q4: (" << min_x_q4 << ", " << min_y_q4 << ") (" << max_x_q4 << ", " << max_y_q4 << ") " << area_4 << endl;
} else if (vec_x_q1.size() == 0 && vec_x_q2.size() != 0 && vec_x_q3.size() == 0 && vec_x_q4.size() !=0) {
cout << "Q2: (" << min_x_q2 << ", " << min_y_q2 << ") (" << max_x_q2 << ", " << max_y_q2 << ") " << area_2 << endl;
cout << "Q4: (" << min_x_q4 << ", " << min_y_q4 << ") (" << max_x_q4 << ", " << max_y_q4 << ") " << area_4 << endl;
} else if (vec_x_q1.size() == 0 && vec_x_q2.size() != 0 && vec_x_q3.size() != 0 && vec_x_q4.size() ==0) {
cout << "Q2: (" << min_x_q2 << ", " << min_y_q2 << ") (" << max_x_q2 << ", " << max_y_q2 << ") " << area_2 << endl;
cout << "Q3: (" << min_x_q3 << ", " << min_y_q3 << ") (" << max_x_q3 << ", " << max_y_q3 << ") " << area_3 << endl;
} else if (vec_x_q1.size() != 0 && vec_x_q2.size() == 0 && vec_x_q3.size() == 0 && vec_x_q4.size() !=0) {
cout << "Q2: (" << min_x_q2 << ", " << min_y_q2 << ") (" << max_x_q2 << ", " << max_y_q2 << ") " << area_2 << endl;
cout << "Q3: (" << min_x_q3 << ", " << min_y_q3 << ") (" << max_x_q3 << ", " << max_y_q3 << ") " << area_3 << endl;
} else if (vec_x_q1.size() != 0 && vec_x_q2.size() == 0 && vec_x_q3.size() != 0 && vec_x_q4.size() ==0) {
cout << "Q2: (" << min_x_q2 << ", " << min_y_q2 << ") (" << max_x_q2 << ", " << max_y_q2 << ") " << area_2 << endl;
cout << "Q4: (" << min_x_q4 << ", " << min_y_q4 << ") (" << max_x_q4 << ", " << max_y_q4 << ") " << area_4 << endl;
} else if (vec_x_q1.size() != 0 && vec_x_q2.size() != 0 && vec_x_q3.size() == 0 && vec_x_q4.size() ==0) {
cout << "Q3: (" << min_x_q3 << ", " << min_y_q3 << ") (" << max_x_q3 << ", " << max_y_q3 << ") " << area_3 << endl;
cout << "Q4: (" << min_x_q4 << ", " << min_y_q4 << ") (" << max_x_q4 << ", " << max_y_q4 << ") " << area_4 << endl;
}
} | # 2069901, 2024-11-02 11:34:56, Compilation error (0%)
#include<bits/stdc++.h>
using namespace std;
int main() {
int n; cin >> n;
vector<int> vec_x_q1,vec_y_q1;
vector<int> vec_x_q2,vec_y_q2;
vector<int> vec_x_q3,vec_y_q3;
vector<int> vec_x_q4,vec_y_q4;
int x,y;
for (int i=0;i<n;i++) {
cin >> x >> y;
if (x == 0 || y == 0) {
continue;
} else if (x > 0 && y > 0) {
vec_x_q1.push_back(x);
vec_y_q1.push_back(y);
} else if (x < 0 && y > 0) {
vec_x_q2.push_back(x);
vec_y_q2.push_back(y);
} else if (x < 0 && y < 0) {
vec_x_q3.push_back(x);
vec_y_q3.push_back(y);
} else if (x > 0 && y < 0) {
vec_x_q4.push_back(x);
vec_y_q4.push_back(y);
}
}
if (vec_x_q1.size() == 0 && vec_x_q2.size() == 0 && vec_x_q3.size() == 0 && vec_x_q4.size() == 0) {
cout << "No point in any quadrant";
return 0;
}
sort(vec_x_q1.begin(),vec_x_q1.end());
sort(vec_y_q1.begin(),vec_y_q1.end());
sort(vec_x_q2.begin(),vec_x_q2.end());
sort(vec_y_q2.begin(),vec_y_q2.end());
sort(vec_x_q3.begin(),vec_x_q3.end());
sort(vec_y_q3.begin(),vec_y_q3.end());
sort(vec_x_q4.begin(),vec_x_q4.end());
sort(vec_y_q4.begin(),vec_y_q4.end());
int max_x_q1 = vec_x_q1[vec_x_q1.size()-1];
int max_y_q1 = vec_y_q1[vec_y_q1.size()-1];
int min_x_q1 = vec_x_q1[0];
int min_y_q1 = vec_y_q1[0];
int area_1 = (max_y_q1-min_y_q1)*(max_x_q1-min_x_q1);
int max_x_q2 = vec_x_q2[vec_x_q2.size()-1];
int max_y_q2 = vec_y_q2[vec_y_q2.size()-1];
int min_x_q2 = vec_x_q2[0];
int min_y_q2 = vec_y_q2[0];
int area_2 = (max_y_q2-min_y_q2)*(max_x_q2-min_x_q2);
int max_x_q3 = vec_x_q3[vec_x_q3.size()-1];
int max_y_q3 = vec_y_q3[vec_y_q3.size()-1];
int min_x_q3 = vec_x_q3[0];
int min_y_q3 = vec_y_q3[0];
int area_3 = (max_y_q3-min_y_q3)*(max_x_q3-min_x_q3);
int max_x_q4 = vec_x_q4[vec_x_q4.size()-1];
int max_y_q4 = vec_y_q4[vec_y_q4.size()-1];
int min_x_q4 = vec_x_q4[0];
int min_y_q4 = vec_y_q4[0];
int area_4 = (max_y_q4-min_y_q4)*(max_x_q4-min_x_q4);
if (vec_x_q1.size() == 0 && vec_x_q2.size() == 0 && vec_x_q3.size() != 0 && vec_x_q4.size() !=0) { //---------------------
cout << "Q3: (" << min_x_q3 << ", " << min_y_q3 << ") (" << max_x_q3 << ", " << max_y_q3 << ") " << area_3 << endl;
cout << "Q4: (" << min_x_q4 << ", " << min_y_q4 << ") (" << max_x_q4 << ", " << max_y_q4 << ") " << area_4 << endl;
} else if (vec_x_q1.size() == 0 && vec_x_q2.size() != 0 && vec_x_q3.size() == 0 && vec_x_q4.size() !=0) {
cout << "Q2: (" << min_x_q2 << ", " << min_y_q2 << ") (" << max_x_q2 << ", " << max_y_q2 << ") " << area_2 << endl;
cout << "Q4: (" << min_x_q4 << ", " << min_y_q4 << ") (" << max_x_q4 << ", " << max_y_q4 << ") " << area_4 << endl;
} else if (vec_x_q1.size() == 0 && vec_x_q2.size() != 0 && vec_x_q3.size() != 0 && vec_x_q4.size() ==0) {
cout << "Q2: (" << min_x_q2 << ", " << min_y_q2 << ") (" << max_x_q2 << ", " << max_y_q2 << ") " << area_2 << endl;
cout << "Q3: (" << min_x_q3 << ", " << min_y_q3 << ") (" << max_x_q3 << ", " << max_y_q3 << ") " << area_3 << endl;
} else if (vec_x_q1.size() != 0 && vec_x_q2.size() == 0 && vec_x_q3.size() == 0 && vec_x_q4.size() !=0) {
cout << "Q2: (" << min_x_q2 << ", " << min_y_q2 << ") (" << max_x_q2 << ", " << max_y_q2 << ") " << area_2 << endl;
cout << "Q3: (" << min_x_q3 << ", " << min_y_q3 << ") (" << max_x_q3 << ", " << max_y_q3 << ") " << area_3 << endl;
} else if (vec_x_q1.size() != 0 && vec_x_q2.size() == 0 && vec_x_q3.size() != 0 && vec_x_q4.size() ==0) {
cout << "Q2: (" << min_x_q2 << ", " << min_y_q2 << ") (" << max_x_q2 << ", " << max_y_q2 << ") " << area_2 << endl;
cout << "Q4: (" << min_x_q4 << ", " << min_y_q4 << ") (" << max_x_q4 << ", " << max_y_q4 << ") " << area_4 << endl;
} else if (vec_x_q1.size() != 0 && vec_x_q2.size() != 0 && vec_x_q3.size() == 0 && vec_x_q4.size() ==0) {
cout << "Q3: (" << min_x_q3 << ", " << min_y_q3 << ") (" << max_x_q3 << ", " << max_y_q3 << ") " << area_3 << endl;
cout << "Q4: (" << min_x_q4 << ", " << min_y_q4 << ") (" << max_x_q4 << ", " << max_y_q4 << ") " << area_4 << endl;
}
}
if (vec_x_q1.size() == 0 && vec_x_q2.size() == 0 && vec_x_q3.size() == 0 && vec_x_q4.size() == 0) {
cout << "No point in any quadrant";
} else if (vec_x_q1.size() != 0 && vec_x_q2.size() != 0 && vec_x_q3.size() != 0 && vec_x_q4.size() !=0) {
cout << "Q1: (" << min_x_q1 << ", " << min_y_q1 << ") (" << max_x_q1 << ", " << max_y_q1 << ") " << area_1 << endl;
cout << "Q2: (" << min_x_q2 << ", " << min_y_q2 << ") (" << max_x_q2 << ", " << max_y_q2 << ") " << area_2 << endl;
cout << "Q3: (" << min_x_q3 << ", " << min_y_q3 << ") (" << max_x_q3 << ", " << max_y_q3 << ") " << area_3 << endl;
cout << "Q4: (" << min_x_q4 << ", " << min_y_q4 << ") (" << max_x_q4 << ", " << max_y_q4 << ") " << area_4 << endl;
} else if (vec_x_q1.size() == 0 && vec_x_q2.size() != 0 && vec_x_q3.size() != 0 && vec_x_q4.size() !=0) {
cout << "Q2: (" << min_x_q2 << ", " << min_y_q2 << ") (" << max_x_q2 << ", " << max_y_q2 << ") " << area_2 << endl;
cout << "Q3: (" << min_x_q3 << ", " << min_y_q3 << ") (" << max_x_q3 << ", " << max_y_q3 << ") " << area_3 << endl;
cout << "Q4: (" << min_x_q4 << ", " << min_y_q4 << ") (" << max_x_q4 << ", " << max_y_q4 << ") " << area_4 << endl;
} else if (vec_x_q1.size() != 0 && vec_x_q2.size() == 0 && vec_x_q3.size() != 0 && vec_x_q4.size() !=0) {
cout << "Q1: (" << min_x_q1 << ", " << min_y_q1 << ") (" << max_x_q1 << ", " << max_y_q1 << ") " << area_1 << endl;
cout << "Q3: (" << min_x_q3 << ", " << min_y_q3 << ") (" << max_x_q3 << ", " << max_y_q3 << ") " << area_3 << endl;
cout << "Q4: (" << min_x_q4 << ", " << min_y_q4 << ") (" << max_x_q4 << ", " << max_y_q4 << ") " << area_4 << endl;
} else if (vec_x_q1.size() != 0 && vec_x_q2.size() != 0 && vec_x_q3.size() == 0 && vec_x_q4.size() !=0) {
cout << "Q1: (" << min_x_q1 << ", " << min_y_q1 << ") (" << max_x_q1 << ", " << max_y_q1 << ") " << area_1 << endl;
cout << "Q2: (" << min_x_q2 << ", " << min_y_q2 << ") (" << max_x_q2 << ", " << max_y_q2 << ") " << area_2 << endl;
cout << "Q4: (" << min_x_q4 << ", " << min_y_q4 << ") (" << max_x_q4 << ", " << max_y_q4 << ") " << area_4 << endl;
} else if (vec_x_q1.size() != 0 && vec_x_q2.size() != 0 && vec_x_q3.size() != 0 && vec_x_q4.size() ==0) {
cout << "Q1: (" << min_x_q1 << ", " << min_y_q1 << ") (" << max_x_q1 << ", " << max_y_q1 << ") " << area_1 << endl;
cout << "Q2: (" << min_x_q2 << ", " << min_y_q2 << ") (" << max_x_q2 << ", " << max_y_q2 << ") " << area_2 << endl;
cout << "Q3: (" << min_x_q3 << ", " << min_y_q3 << ") (" << max_x_q3 << ", " << max_y_q3 << ") " << area_3 << endl;
}
} | # 2069911, 2024-11-02 11:36:18, Compilation error (0%)
#include<bits/stdc++.h>
using namespace std;
int main() {
int n; cin >> n;
vector<int> vec_x_q1,vec_y_q1;
vector<int> vec_x_q2,vec_y_q2;
vector<int> vec_x_q3,vec_y_q3;
vector<int> vec_x_q4,vec_y_q4;
int x,y;
for (int i=0;i<n;i++) {
cin >> x >> y;
if (x == 0 || y == 0) {
continue;
} else if (x > 0 && y > 0) {
vec_x_q1.push_back(x);
vec_y_q1.push_back(y);
} else if (x < 0 && y > 0) {
vec_x_q2.push_back(x);
vec_y_q2.push_back(y);
} else if (x < 0 && y < 0) {
vec_x_q3.push_back(x);
vec_y_q3.push_back(y);
} else if (x > 0 && y < 0) {
vec_x_q4.push_back(x);
vec_y_q4.push_back(y);
}
}
if (vec_x_q1.size() == 0 && vec_x_q2.size() == 0 && vec_x_q3.size() == 0 && vec_x_q4.size() == 0) {
cout << "No point in any quadrant";
return 0;
}
sort(vec_x_q1.begin(),vec_x_q1.end());
sort(vec_y_q1.begin(),vec_y_q1.end());
sort(vec_x_q2.begin(),vec_x_q2.end());
sort(vec_y_q2.begin(),vec_y_q2.end());
sort(vec_x_q3.begin(),vec_x_q3.end());
sort(vec_y_q3.begin(),vec_y_q3.end());
sort(vec_x_q4.begin(),vec_x_q4.end());
sort(vec_y_q4.begin(),vec_y_q4.end());
int max_x_q1 = vec_x_q1[vec_x_q1.size()-1];
int max_y_q1 = vec_y_q1[vec_y_q1.size()-1];
int min_x_q1 = vec_x_q1[0];
int min_y_q1 = vec_y_q1[0];
int area_1 = (max_y_q1-min_y_q1)*(max_x_q1-min_x_q1);
int max_x_q2 = vec_x_q2[vec_x_q2.size()-1];
int max_y_q2 = vec_y_q2[vec_y_q2.size()-1];
int min_x_q2 = vec_x_q2[0];
int min_y_q2 = vec_y_q2[0];
int area_2 = (max_y_q2-min_y_q2)*(max_x_q2-min_x_q2);
int max_x_q3 = vec_x_q3[vec_x_q3.size()-1];
int max_y_q3 = vec_y_q3[vec_y_q3.size()-1];
int min_x_q3 = vec_x_q3[0];
int min_y_q3 = vec_y_q3[0];
int area_3 = (max_y_q3-min_y_q3)*(max_x_q3-min_x_q3);
int max_x_q4 = vec_x_q4[vec_x_q4.size()-1];
int max_y_q4 = vec_y_q4[vec_y_q4.size()-1];
int min_x_q4 = vec_x_q4[0];
int min_y_q4 = vec_y_q4[0];
int area_4 = (max_y_q4-min_y_q4)*(max_x_q4-min_x_q4);
#include<bits/stdc++.h>
using namespace std;
int main() {
int n; cin >> n;
vector<int> vec_x_q1,vec_y_q1;
vector<int> vec_x_q2,vec_y_q2;
vector<int> vec_x_q3,vec_y_q3;
vector<int> vec_x_q4,vec_y_q4;
int x,y;
for (int i=0;i<n;i++) {
cin >> x >> y;
if (x == 0 || y == 0) {
continue;
} else if (x > 0 && y > 0) {
vec_x_q1.push_back(x);
vec_y_q1.push_back(y);
} else if (x < 0 && y > 0) {
vec_x_q2.push_back(x);
vec_y_q2.push_back(y);
} else if (x < 0 && y < 0) {
vec_x_q3.push_back(x);
vec_y_q3.push_back(y);
} else if (x > 0 && y < 0) {
vec_x_q4.push_back(x);
vec_y_q4.push_back(y);
}
}
if (vec_x_q1.size() == 0 && vec_x_q2.size() == 0 && vec_x_q3.size() == 0 && vec_x_q4.size() == 0) {
cout << "No point in any quadrant";
return 0;
}
sort(vec_x_q1.begin(),vec_x_q1.end());
sort(vec_y_q1.begin(),vec_y_q1.end());
sort(vec_x_q2.begin(),vec_x_q2.end());
sort(vec_y_q2.begin(),vec_y_q2.end());
sort(vec_x_q3.begin(),vec_x_q3.end());
sort(vec_y_q3.begin(),vec_y_q3.end());
sort(vec_x_q4.begin(),vec_x_q4.end());
sort(vec_y_q4.begin(),vec_y_q4.end());
int max_x_q1 = vec_x_q1[vec_x_q1.size()-1];
int max_y_q1 = vec_y_q1[vec_y_q1.size()-1];
int min_x_q1 = vec_x_q1[0];
int min_y_q1 = vec_y_q1[0];
int area_1 = (max_y_q1-min_y_q1)*(max_x_q1-min_x_q1);
int max_x_q2 = vec_x_q2[vec_x_q2.size()-1];
int max_y_q2 = vec_y_q2[vec_y_q2.size()-1];
int min_x_q2 = vec_x_q2[0];
int min_y_q2 = vec_y_q2[0];
int area_2 = (max_y_q2-min_y_q2)*(max_x_q2-min_x_q2);
int max_x_q3 = vec_x_q3[vec_x_q3.size()-1];
int max_y_q3 = vec_y_q3[vec_y_q3.size()-1];
int min_x_q3 = vec_x_q3[0];
int min_y_q3 = vec_y_q3[0];
int area_3 = (max_y_q3-min_y_q3)*(max_x_q3-min_x_q3);
int max_x_q4 = vec_x_q4[vec_x_q4.size()-1];
int max_y_q4 = vec_y_q4[vec_y_q4.size()-1];
int min_x_q4 = vec_x_q4[0];
int min_y_q4 = vec_y_q4[0];
int area_4 = (max_y_q4-min_y_q4)*(max_x_q4-min_x_q4);
if (vec_x_q1.size() == 0 && vec_x_q2.size() == 0 && vec_x_q3.size() != 0 && vec_x_q4.size() !=0) { //---------------------
cout << "Q3: (" << min_x_q3 << ", " << min_y_q3 << ") (" << max_x_q3 << ", " << max_y_q3 << ") " << area_3 << endl;
cout << "Q4: (" << min_x_q4 << ", " << min_y_q4 << ") (" << max_x_q4 << ", " << max_y_q4 << ") " << area_4 << endl;
} else if (vec_x_q1.size() == 0 && vec_x_q2.size() != 0 && vec_x_q3.size() == 0 && vec_x_q4.size() !=0) {
cout << "Q2: (" << min_x_q2 << ", " << min_y_q2 << ") (" << max_x_q2 << ", " << max_y_q2 << ") " << area_2 << endl;
cout << "Q4: (" << min_x_q4 << ", " << min_y_q4 << ") (" << max_x_q4 << ", " << max_y_q4 << ") " << area_4 << endl;
} else if (vec_x_q1.size() == 0 && vec_x_q2.size() != 0 && vec_x_q3.size() != 0 && vec_x_q4.size() ==0) {
cout << "Q2: (" << min_x_q2 << ", " << min_y_q2 << ") (" << max_x_q2 << ", " << max_y_q2 << ") " << area_2 << endl;
cout << "Q3: (" << min_x_q3 << ", " << min_y_q3 << ") (" << max_x_q3 << ", " << max_y_q3 << ") " << area_3 << endl;
} else if (vec_x_q1.size() != 0 && vec_x_q2.size() == 0 && vec_x_q3.size() == 0 && vec_x_q4.size() !=0) {
cout << "Q2: (" << min_x_q2 << ", " << min_y_q2 << ") (" << max_x_q2 << ", " << max_y_q2 << ") " << area_2 << endl;
cout << "Q3: (" << min_x_q3 << ", " << min_y_q3 << ") (" << max_x_q3 << ", " << max_y_q3 << ") " << area_3 << endl;
} else if (vec_x_q1.size() != 0 && vec_x_q2.size() == 0 && vec_x_q3.size() != 0 && vec_x_q4.size() ==0) {
cout << "Q2: (" << min_x_q2 << ", " << min_y_q2 << ") (" << max_x_q2 << ", " << max_y_q2 << ") " << area_2 << endl;
cout << "Q4: (" << min_x_q4 << ", " << min_y_q4 << ") (" << max_x_q4 << ", " << max_y_q4 << ") " << area_4 << endl;
} else if (vec_x_q1.size() != 0 && vec_x_q2.size() != 0 && vec_x_q3.size() == 0 && vec_x_q4.size() ==0) {
cout << "Q3: (" << min_x_q3 << ", " << min_y_q3 << ") (" << max_x_q3 << ", " << max_y_q3 << ") " << area_3 << endl;
cout << "Q4: (" << min_x_q4 << ", " << min_y_q4 << ") (" << max_x_q4 << ", " << max_y_q4 << ") " << area_4 << endl;
}
if (vec_x_q1.size() == 0 && vec_x_q2.size() == 0 && vec_x_q3.size() == 0 && vec_x_q4.size() == 0) {
cout << "No point in any quadrant";
} else if (vec_x_q1.size() != 0 && vec_x_q2.size() != 0 && vec_x_q3.size() != 0 && vec_x_q4.size() !=0) {
cout << "Q1: (" << min_x_q1 << ", " << min_y_q1 << ") (" << max_x_q1 << ", " << max_y_q1 << ") " << area_1 << endl;
cout << "Q2: (" << min_x_q2 << ", " << min_y_q2 << ") (" << max_x_q2 << ", " << max_y_q2 << ") " << area_2 << endl;
cout << "Q3: (" << min_x_q3 << ", " << min_y_q3 << ") (" << max_x_q3 << ", " << max_y_q3 << ") " << area_3 << endl;
cout << "Q4: (" << min_x_q4 << ", " << min_y_q4 << ") (" << max_x_q4 << ", " << max_y_q4 << ") " << area_4 << endl;
} else if (vec_x_q1.size() == 0 && vec_x_q2.size() != 0 && vec_x_q3.size() != 0 && vec_x_q4.size() !=0) {
cout << "Q2: (" << min_x_q2 << ", " << min_y_q2 << ") (" << max_x_q2 << ", " << max_y_q2 << ") " << area_2 << endl;
cout << "Q3: (" << min_x_q3 << ", " << min_y_q3 << ") (" << max_x_q3 << ", " << max_y_q3 << ") " << area_3 << endl;
cout << "Q4: (" << min_x_q4 << ", " << min_y_q4 << ") (" << max_x_q4 << ", " << max_y_q4 << ") " << area_4 << endl;
} else if (vec_x_q1.size() != 0 && vec_x_q2.size() == 0 && vec_x_q3.size() != 0 && vec_x_q4.size() !=0) {
cout << "Q1: (" << min_x_q1 << ", " << min_y_q1 << ") (" << max_x_q1 << ", " << max_y_q1 << ") " << area_1 << endl;
cout << "Q3: (" << min_x_q3 << ", " << min_y_q3 << ") (" << max_x_q3 << ", " << max_y_q3 << ") " << area_3 << endl;
cout << "Q4: (" << min_x_q4 << ", " << min_y_q4 << ") (" << max_x_q4 << ", " << max_y_q4 << ") " << area_4 << endl;
} else if (vec_x_q1.size() != 0 && vec_x_q2.size() != 0 && vec_x_q3.size() == 0 && vec_x_q4.size() !=0) {
cout << "Q1: (" << min_x_q1 << ", " << min_y_q1 << ") (" << max_x_q1 << ", " << max_y_q1 << ") " << area_1 << endl;
cout << "Q2: (" << min_x_q2 << ", " << min_y_q2 << ") (" << max_x_q2 << ", " << max_y_q2 << ") " << area_2 << endl;
cout << "Q4: (" << min_x_q4 << ", " << min_y_q4 << ") (" << max_x_q4 << ", " << max_y_q4 << ") " << area_4 << endl;
} else if (vec_x_q1.size() != 0 && vec_x_q2.size() != 0 && vec_x_q3.size() != 0 && vec_x_q4.size() ==0) {
cout << "Q1: (" << min_x_q1 << ", " << min_y_q1 << ") (" << max_x_q1 << ", " << max_y_q1 << ") " << area_1 << endl;
cout << "Q2: (" << min_x_q2 << ", " << min_y_q2 << ") (" << max_x_q2 << ", " << max_y_q2 << ") " << area_2 << endl;
cout << "Q3: (" << min_x_q3 << ", " << min_y_q3 << ") (" << max_x_q3 << ", " << max_y_q3 << ") " << area_3 << endl;
}
} | # 2069924, 2024-11-02 11:37:11, xxxxPPPPxP (50%)
#include<bits/stdc++.h>
using namespace std;
int main() {
int n; cin >> n;
vector<int> vec_x_q1,vec_y_q1;
vector<int> vec_x_q2,vec_y_q2;
vector<int> vec_x_q3,vec_y_q3;
vector<int> vec_x_q4,vec_y_q4;
int x,y;
for (int i=0;i<n;i++) {
cin >> x >> y;
if (x == 0 || y == 0) {
continue;
} else if (x > 0 && y > 0) {
vec_x_q1.push_back(x);
vec_y_q1.push_back(y);
} else if (x < 0 && y > 0) {
vec_x_q2.push_back(x);
vec_y_q2.push_back(y);
} else if (x < 0 && y < 0) {
vec_x_q3.push_back(x);
vec_y_q3.push_back(y);
} else if (x > 0 && y < 0) {
vec_x_q4.push_back(x);
vec_y_q4.push_back(y);
}
}
if (vec_x_q1.size() == 0 && vec_x_q2.size() == 0 && vec_x_q3.size() == 0 && vec_x_q4.size() == 0) {
cout << "No point in any quadrant";
return 0;
}
sort(vec_x_q1.begin(),vec_x_q1.end());
sort(vec_y_q1.begin(),vec_y_q1.end());
sort(vec_x_q2.begin(),vec_x_q2.end());
sort(vec_y_q2.begin(),vec_y_q2.end());
sort(vec_x_q3.begin(),vec_x_q3.end());
sort(vec_y_q3.begin(),vec_y_q3.end());
sort(vec_x_q4.begin(),vec_x_q4.end());
sort(vec_y_q4.begin(),vec_y_q4.end());
int max_x_q1 = vec_x_q1[vec_x_q1.size()-1];
int max_y_q1 = vec_y_q1[vec_y_q1.size()-1];
int min_x_q1 = vec_x_q1[0];
int min_y_q1 = vec_y_q1[0];
int area_1 = (max_y_q1-min_y_q1)*(max_x_q1-min_x_q1);
int max_x_q2 = vec_x_q2[vec_x_q2.size()-1];
int max_y_q2 = vec_y_q2[vec_y_q2.size()-1];
int min_x_q2 = vec_x_q2[0];
int min_y_q2 = vec_y_q2[0];
int area_2 = (max_y_q2-min_y_q2)*(max_x_q2-min_x_q2);
int max_x_q3 = vec_x_q3[vec_x_q3.size()-1];
int max_y_q3 = vec_y_q3[vec_y_q3.size()-1];
int min_x_q3 = vec_x_q3[0];
int min_y_q3 = vec_y_q3[0];
int area_3 = (max_y_q3-min_y_q3)*(max_x_q3-min_x_q3);
int max_x_q4 = vec_x_q4[vec_x_q4.size()-1];
int max_y_q4 = vec_y_q4[vec_y_q4.size()-1];
int min_x_q4 = vec_x_q4[0];
int min_y_q4 = vec_y_q4[0];
int area_4 = (max_y_q4-min_y_q4)*(max_x_q4-min_x_q4);
if (vec_x_q1.size() == 0 && vec_x_q2.size() == 0 && vec_x_q3.size() != 0 && vec_x_q4.size() !=0) { //---------------------
cout << "Q3: (" << min_x_q3 << ", " << min_y_q3 << ") (" << max_x_q3 << ", " << max_y_q3 << ") " << area_3 << endl;
cout << "Q4: (" << min_x_q4 << ", " << min_y_q4 << ") (" << max_x_q4 << ", " << max_y_q4 << ") " << area_4 << endl;
} else if (vec_x_q1.size() == 0 && vec_x_q2.size() != 0 && vec_x_q3.size() == 0 && vec_x_q4.size() !=0) {
cout << "Q2: (" << min_x_q2 << ", " << min_y_q2 << ") (" << max_x_q2 << ", " << max_y_q2 << ") " << area_2 << endl;
cout << "Q4: (" << min_x_q4 << ", " << min_y_q4 << ") (" << max_x_q4 << ", " << max_y_q4 << ") " << area_4 << endl;
} else if (vec_x_q1.size() == 0 && vec_x_q2.size() != 0 && vec_x_q3.size() != 0 && vec_x_q4.size() ==0) {
cout << "Q2: (" << min_x_q2 << ", " << min_y_q2 << ") (" << max_x_q2 << ", " << max_y_q2 << ") " << area_2 << endl;
cout << "Q3: (" << min_x_q3 << ", " << min_y_q3 << ") (" << max_x_q3 << ", " << max_y_q3 << ") " << area_3 << endl;
} else if (vec_x_q1.size() != 0 && vec_x_q2.size() == 0 && vec_x_q3.size() == 0 && vec_x_q4.size() !=0) {
cout << "Q2: (" << min_x_q2 << ", " << min_y_q2 << ") (" << max_x_q2 << ", " << max_y_q2 << ") " << area_2 << endl;
cout << "Q3: (" << min_x_q3 << ", " << min_y_q3 << ") (" << max_x_q3 << ", " << max_y_q3 << ") " << area_3 << endl;
} else if (vec_x_q1.size() != 0 && vec_x_q2.size() == 0 && vec_x_q3.size() != 0 && vec_x_q4.size() ==0) {
cout << "Q2: (" << min_x_q2 << ", " << min_y_q2 << ") (" << max_x_q2 << ", " << max_y_q2 << ") " << area_2 << endl;
cout << "Q4: (" << min_x_q4 << ", " << min_y_q4 << ") (" << max_x_q4 << ", " << max_y_q4 << ") " << area_4 << endl;
} else if (vec_x_q1.size() != 0 && vec_x_q2.size() != 0 && vec_x_q3.size() == 0 && vec_x_q4.size() ==0) {
cout << "Q3: (" << min_x_q3 << ", " << min_y_q3 << ") (" << max_x_q3 << ", " << max_y_q3 << ") " << area_3 << endl;
cout << "Q4: (" << min_x_q4 << ", " << min_y_q4 << ") (" << max_x_q4 << ", " << max_y_q4 << ") " << area_4 << endl;
}
if (vec_x_q1.size() == 0 && vec_x_q2.size() == 0 && vec_x_q3.size() == 0 && vec_x_q4.size() == 0) {
cout << "No point in any quadrant";
} else if (vec_x_q1.size() != 0 && vec_x_q2.size() != 0 && vec_x_q3.size() != 0 && vec_x_q4.size() !=0) {
cout << "Q1: (" << min_x_q1 << ", " << min_y_q1 << ") (" << max_x_q1 << ", " << max_y_q1 << ") " << area_1 << endl;
cout << "Q2: (" << min_x_q2 << ", " << min_y_q2 << ") (" << max_x_q2 << ", " << max_y_q2 << ") " << area_2 << endl;
cout << "Q3: (" << min_x_q3 << ", " << min_y_q3 << ") (" << max_x_q3 << ", " << max_y_q3 << ") " << area_3 << endl;
cout << "Q4: (" << min_x_q4 << ", " << min_y_q4 << ") (" << max_x_q4 << ", " << max_y_q4 << ") " << area_4 << endl;
} else if (vec_x_q1.size() == 0 && vec_x_q2.size() != 0 && vec_x_q3.size() != 0 && vec_x_q4.size() !=0) {
cout << "Q2: (" << min_x_q2 << ", " << min_y_q2 << ") (" << max_x_q2 << ", " << max_y_q2 << ") " << area_2 << endl;
cout << "Q3: (" << min_x_q3 << ", " << min_y_q3 << ") (" << max_x_q3 << ", " << max_y_q3 << ") " << area_3 << endl;
cout << "Q4: (" << min_x_q4 << ", " << min_y_q4 << ") (" << max_x_q4 << ", " << max_y_q4 << ") " << area_4 << endl;
} else if (vec_x_q1.size() != 0 && vec_x_q2.size() == 0 && vec_x_q3.size() != 0 && vec_x_q4.size() !=0) {
cout << "Q1: (" << min_x_q1 << ", " << min_y_q1 << ") (" << max_x_q1 << ", " << max_y_q1 << ") " << area_1 << endl;
cout << "Q3: (" << min_x_q3 << ", " << min_y_q3 << ") (" << max_x_q3 << ", " << max_y_q3 << ") " << area_3 << endl;
cout << "Q4: (" << min_x_q4 << ", " << min_y_q4 << ") (" << max_x_q4 << ", " << max_y_q4 << ") " << area_4 << endl;
} else if (vec_x_q1.size() != 0 && vec_x_q2.size() != 0 && vec_x_q3.size() == 0 && vec_x_q4.size() !=0) {
cout << "Q1: (" << min_x_q1 << ", " << min_y_q1 << ") (" << max_x_q1 << ", " << max_y_q1 << ") " << area_1 << endl;
cout << "Q2: (" << min_x_q2 << ", " << min_y_q2 << ") (" << max_x_q2 << ", " << max_y_q2 << ") " << area_2 << endl;
cout << "Q4: (" << min_x_q4 << ", " << min_y_q4 << ") (" << max_x_q4 << ", " << max_y_q4 << ") " << area_4 << endl;
} else if (vec_x_q1.size() != 0 && vec_x_q2.size() != 0 && vec_x_q3.size() != 0 && vec_x_q4.size() ==0) {
cout << "Q1: (" << min_x_q1 << ", " << min_y_q1 << ") (" << max_x_q1 << ", " << max_y_q1 << ") " << area_1 << endl;
cout << "Q2: (" << min_x_q2 << ", " << min_y_q2 << ") (" << max_x_q2 << ", " << max_y_q2 << ") " << area_2 << endl;
cout << "Q3: (" << min_x_q3 << ", " << min_y_q3 << ") (" << max_x_q3 << ", " << max_y_q3 << ") " << area_3 << endl;
}
} | # 2069958, 2024-11-02 11:40:04, xxxxPPPPxP (50%)
#include<bits/stdc++.h>
using namespace std;
int main() {
int n; cin >> n;
vector<int> vec_x_q1,vec_y_q1;
vector<int> vec_x_q2,vec_y_q2;
vector<int> vec_x_q3,vec_y_q3;
vector<int> vec_x_q4,vec_y_q4;
int x,y;
for (int i=0;i<n;i++) {
cin >> x >> y;
if (x == 0 || y == 0) {
continue;
} else if (x > 0 && y > 0) {
vec_x_q1.push_back(x);
vec_y_q1.push_back(y);
} else if (x < 0 && y > 0) {
vec_x_q2.push_back(x);
vec_y_q2.push_back(y);
} else if (x < 0 && y < 0) {
vec_x_q3.push_back(x);
vec_y_q3.push_back(y);
} else if (x > 0 && y < 0) {
vec_x_q4.push_back(x);
vec_y_q4.push_back(y);
}
}
if (vec_x_q1.size() == 0 && vec_x_q2.size() == 0 && vec_x_q3.size() == 0 && vec_x_q4.size() == 0) {
cout << "No point in any quadrant";
return 0;
}
if (vec_x_q1.size() != 0) {
sort(vec_x_q1.begin(),vec_x_q1.end());
sort(vec_y_q1.begin(),vec_y_q1.end());
}
if (vec_x_q2.size() != 0){
sort(vec_x_q2.begin(),vec_x_q2.end());
sort(vec_y_q2.begin(),vec_y_q2.end());
}
if (vec_x_q3.size() != 0) {
sort(vec_x_q3.begin(),vec_x_q3.end());
sort(vec_y_q3.begin(),vec_y_q3.end());
}
if (vec_x_q4.size() !=0) {
sort(vec_x_q4.begin(),vec_x_q4.end());
sort(vec_y_q4.begin(),vec_y_q4.end());
}
int max_x_q1 = vec_x_q1[vec_x_q1.size()-1];
int max_y_q1 = vec_y_q1[vec_y_q1.size()-1];
int min_x_q1 = vec_x_q1[0];
int min_y_q1 = vec_y_q1[0];
int area_1 = (max_y_q1-min_y_q1)*(max_x_q1-min_x_q1);
int max_x_q2 = vec_x_q2[vec_x_q2.size()-1];
int max_y_q2 = vec_y_q2[vec_y_q2.size()-1];
int min_x_q2 = vec_x_q2[0];
int min_y_q2 = vec_y_q2[0];
int area_2 = (max_y_q2-min_y_q2)*(max_x_q2-min_x_q2);
int max_x_q3 = vec_x_q3[vec_x_q3.size()-1];
int max_y_q3 = vec_y_q3[vec_y_q3.size()-1];
int min_x_q3 = vec_x_q3[0];
int min_y_q3 = vec_y_q3[0];
int area_3 = (max_y_q3-min_y_q3)*(max_x_q3-min_x_q3);
int max_x_q4 = vec_x_q4[vec_x_q4.size()-1];
int max_y_q4 = vec_y_q4[vec_y_q4.size()-1];
int min_x_q4 = vec_x_q4[0];
int min_y_q4 = vec_y_q4[0];
int area_4 = (max_y_q4-min_y_q4)*(max_x_q4-min_x_q4);
if (vec_x_q1.size() == 0 && vec_x_q2.size() == 0 && vec_x_q3.size() != 0 && vec_x_q4.size() !=0) { //---------------------
cout << "Q3: (" << min_x_q3 << ", " << min_y_q3 << ") (" << max_x_q3 << ", " << max_y_q3 << ") " << area_3 << endl;
cout << "Q4: (" << min_x_q4 << ", " << min_y_q4 << ") (" << max_x_q4 << ", " << max_y_q4 << ") " << area_4 << endl;
} else if (vec_x_q1.size() == 0 && vec_x_q2.size() != 0 && vec_x_q3.size() == 0 && vec_x_q4.size() !=0) {
cout << "Q2: (" << min_x_q2 << ", " << min_y_q2 << ") (" << max_x_q2 << ", " << max_y_q2 << ") " << area_2 << endl;
cout << "Q4: (" << min_x_q4 << ", " << min_y_q4 << ") (" << max_x_q4 << ", " << max_y_q4 << ") " << area_4 << endl;
} else if (vec_x_q1.size() == 0 && vec_x_q2.size() != 0 && vec_x_q3.size() != 0 && vec_x_q4.size() ==0) {
cout << "Q2: (" << min_x_q2 << ", " << min_y_q2 << ") (" << max_x_q2 << ", " << max_y_q2 << ") " << area_2 << endl;
cout << "Q3: (" << min_x_q3 << ", " << min_y_q3 << ") (" << max_x_q3 << ", " << max_y_q3 << ") " << area_3 << endl;
} else if (vec_x_q1.size() != 0 && vec_x_q2.size() == 0 && vec_x_q3.size() == 0 && vec_x_q4.size() !=0) {
cout << "Q2: (" << min_x_q2 << ", " << min_y_q2 << ") (" << max_x_q2 << ", " << max_y_q2 << ") " << area_2 << endl;
cout << "Q3: (" << min_x_q3 << ", " << min_y_q3 << ") (" << max_x_q3 << ", " << max_y_q3 << ") " << area_3 << endl;
} else if (vec_x_q1.size() != 0 && vec_x_q2.size() == 0 && vec_x_q3.size() != 0 && vec_x_q4.size() ==0) {
cout << "Q2: (" << min_x_q2 << ", " << min_y_q2 << ") (" << max_x_q2 << ", " << max_y_q2 << ") " << area_2 << endl;
cout << "Q4: (" << min_x_q4 << ", " << min_y_q4 << ") (" << max_x_q4 << ", " << max_y_q4 << ") " << area_4 << endl;
} else if (vec_x_q1.size() != 0 && vec_x_q2.size() != 0 && vec_x_q3.size() == 0 && vec_x_q4.size() ==0) {
cout << "Q3: (" << min_x_q3 << ", " << min_y_q3 << ") (" << max_x_q3 << ", " << max_y_q3 << ") " << area_3 << endl;
cout << "Q4: (" << min_x_q4 << ", " << min_y_q4 << ") (" << max_x_q4 << ", " << max_y_q4 << ") " << area_4 << endl;
}
if (vec_x_q1.size() == 0 && vec_x_q2.size() == 0 && vec_x_q3.size() == 0 && vec_x_q4.size() == 0) {
cout << "No point in any quadrant";
} else if (vec_x_q1.size() != 0 && vec_x_q2.size() != 0 && vec_x_q3.size() != 0 && vec_x_q4.size() !=0) {
cout << "Q1: (" << min_x_q1 << ", " << min_y_q1 << ") (" << max_x_q1 << ", " << max_y_q1 << ") " << area_1 << endl;
cout << "Q2: (" << min_x_q2 << ", " << min_y_q2 << ") (" << max_x_q2 << ", " << max_y_q2 << ") " << area_2 << endl;
cout << "Q3: (" << min_x_q3 << ", " << min_y_q3 << ") (" << max_x_q3 << ", " << max_y_q3 << ") " << area_3 << endl;
cout << "Q4: (" << min_x_q4 << ", " << min_y_q4 << ") (" << max_x_q4 << ", " << max_y_q4 << ") " << area_4 << endl;
} else if (vec_x_q1.size() == 0 && vec_x_q2.size() != 0 && vec_x_q3.size() != 0 && vec_x_q4.size() !=0) {
cout << "Q2: (" << min_x_q2 << ", " << min_y_q2 << ") (" << max_x_q2 << ", " << max_y_q2 << ") " << area_2 << endl;
cout << "Q3: (" << min_x_q3 << ", " << min_y_q3 << ") (" << max_x_q3 << ", " << max_y_q3 << ") " << area_3 << endl;
cout << "Q4: (" << min_x_q4 << ", " << min_y_q4 << ") (" << max_x_q4 << ", " << max_y_q4 << ") " << area_4 << endl;
} else if (vec_x_q1.size() != 0 && vec_x_q2.size() == 0 && vec_x_q3.size() != 0 && vec_x_q4.size() !=0) {
cout << "Q1: (" << min_x_q1 << ", " << min_y_q1 << ") (" << max_x_q1 << ", " << max_y_q1 << ") " << area_1 << endl;
cout << "Q3: (" << min_x_q3 << ", " << min_y_q3 << ") (" << max_x_q3 << ", " << max_y_q3 << ") " << area_3 << endl;
cout << "Q4: (" << min_x_q4 << ", " << min_y_q4 << ") (" << max_x_q4 << ", " << max_y_q4 << ") " << area_4 << endl;
} else if (vec_x_q1.size() != 0 && vec_x_q2.size() != 0 && vec_x_q3.size() == 0 && vec_x_q4.size() !=0) {
cout << "Q1: (" << min_x_q1 << ", " << min_y_q1 << ") (" << max_x_q1 << ", " << max_y_q1 << ") " << area_1 << endl;
cout << "Q2: (" << min_x_q2 << ", " << min_y_q2 << ") (" << max_x_q2 << ", " << max_y_q2 << ") " << area_2 << endl;
cout << "Q4: (" << min_x_q4 << ", " << min_y_q4 << ") (" << max_x_q4 << ", " << max_y_q4 << ") " << area_4 << endl;
} else if (vec_x_q1.size() != 0 && vec_x_q2.size() != 0 && vec_x_q3.size() != 0 && vec_x_q4.size() ==0) {
cout << "Q1: (" << min_x_q1 << ", " << min_y_q1 << ") (" << max_x_q1 << ", " << max_y_q1 << ") " << area_1 << endl;
cout << "Q2: (" << min_x_q2 << ", " << min_y_q2 << ") (" << max_x_q2 << ", " << max_y_q2 << ") " << area_2 << endl;
cout << "Q3: (" << min_x_q3 << ", " << min_y_q3 << ") (" << max_x_q3 << ", " << max_y_q3 << ") " << area_3 << endl;
}
} |
# 2069100, 2024-11-02 10:12:09, -----P---- (10%)
#include<iostream>
using namespace std;
int main(){
cout << "No point in any quadrant";
} | # 2069645, 2024-11-02 11:07:02, -----P---- (10%)
#include<iostream>
#include<vector>
#include<utility>
#include<set>
#include<cmath>
using namespace std;
int main(){
int n;
cin >> n;
vector<pair<int,int>> q1,q2,q3,q4;
for(int i = 0; i < n; i++){
int x,y;
cin >> x >> y;
if(x == 0 || y == 0){
//dont store data;
}else{
if(x > 0){
if(y > 0){
q1.push_back(make_pair(x,y));
}else{
q4.push_back(make_pair(x,y));
}
}else{
if(y > 0){
q2.push_back(make_pair(x,y));
}else{
q3.push_back(make_pair(x,y));
}
}
}
}
if(q1.size() == 0 && q2.size() == 0 && q3.size() == 0 && q4.size() == 0){
cout << "No point in any quadrant";
}else{
vector<pair<int,int>> result1(1),result2(1),result3(1),result4(1),result5(1),result6(1),result7(1),result8(1);
int maxx1 = 0,maxy1 = 0,maxx2 = 0, maxy2 = 0, maxx3 = 0, maxy3 = 0, maxx4 = 0, maxy4 = 0;
for(int i = 0; i < q1.size(); i++){
for(int j = i+1; j < q1.size(); j++){
int diff = abs(q1[i].first - q1[j].first);
int diff1 = abs(q1[i].second - q1[j].second);
if(diff >= maxx1){
result1[0] = make_pair(q1[i].first,q1[j].first);
}
if(diff1 > maxy1){
result2[0] = make_pair(q1[i].second,q1[j].second);
}
maxx1 = max(diff,maxx1);
maxy1 = max(diff1,maxy1);
}
}
for(int i = 0; i < q2.size(); i++){
for(int j = i+1; j < q2.size(); j++){
int diff = abs(q2[i].first - q2[j].first);
int diff1 = abs(q2[i].second - q2[j].second);
if(diff >= maxx1){
result3[0] = make_pair(q2[i].first,q2[j].first);
}
if(diff1 > maxy1){
result4[0] = make_pair(q2[i].second,q2[j].second);
}
maxx2 = max(diff,maxx2);
maxy2 = max(diff1,maxy2);
}
}
for(int i = 0; i < q3.size(); i++){
for(int j = i+1; j < q3.size(); j++){
int diff = abs(q3[i].first - q3[j].first);
int diff1 = abs(q3[i].second - q3[j].second);
if(diff >= maxx1){
result5[0] = make_pair(q3[i].first,q3[j].first);
}
if(diff1 > maxy1){
result6[0] = make_pair(q3[i].second,q3[j].second);
}
maxx3 = max(diff,maxx3);
maxy3 = max(diff1,maxy3);
}
}
for(int i = 0; i < q4.size(); i++){
for(int j = i+1; j < q4.size(); j++){
int diff = abs(q4[i].first - q4[j].first);
int diff1 = abs(q4[i].second - q4[j].second);
if(diff >= maxx1){
result7[0] = make_pair(q4[i].first,q4[j].first);
}
if(diff1 > maxy1){
result8[0] = make_pair(q4[i].second,q4[j].second);
}
maxx4 = max(diff,maxx4);
maxy4 = max(diff1,maxy4);
}
}
if(q1.size() != 0 ){
cout << "Q1: (" << result1[0].first <<", "<< result2[0].second << ") ("<< result1[0].second;
cout << ", "<< result2[0].second << ") " << maxx1 * maxy1 << endl;
}
if(q2.size()!= 0){
cout << "Q2: (" << result3[0].first <<", "<< result4[0].second << ") ("<< result3[0].second;
cout << ", "<< result4[0].second << ") " << maxx2 * maxy2 << endl;
}
if(q3.size()!= 0){
cout << "Q3: (" << result5[0].first <<", "<< result6[0].second << ") ("<< result5[0].second;
cout << ", "<< result6[0].second << ") " << maxx3 * maxy3 << endl;
}
if(q4.size() != 0){
cout << "Q4: (" << result7[0].first <<", "<< result8[0].second << ") ("<< result7[0].second;
cout << ", "<< result8[0].second << ") " << maxx4 * maxy4 << endl;
}
}
} | # 2069667, 2024-11-02 11:10:10, -----P---- (10%)
#include<iostream>
#include<vector>
#include<utility>
#include<set>
#include<cmath>
using namespace std;
int main(){
int n;
cin >> n;
vector<pair<int,int>> q1,q2,q3,q4;
for(int i = 0; i < n; i++){
int x,y;
cin >> x >> y;
if(x == 0 || y == 0){
//dont store data;
}else{
if(x > 0){
if(y > 0){
q1.push_back(make_pair(x,y));
}else{
q4.push_back(make_pair(x,y));
}
}else{
if(y > 0){
q2.push_back(make_pair(x,y));
}else{
q3.push_back(make_pair(x,y));
}
}
}
}
if(q1.size() == 0 && q2.size() == 0 && q3.size() == 0 && q4.size() == 0){
cout << "No point in any quadrant";
}else{
vector<pair<int,int>> result1(1),result2(1),result3(1),result4(1),result5(1),result6(1),result7(1),result8(1);
int maxx1 = 0,maxy1 = 0,maxx2 = 0, maxy2 = 0, maxx3 = 0, maxy3 = 0, maxx4 = 0, maxy4 = 0;
for(int i = 0; i < q1.size(); i++){
for(int j = i+1; j < q1.size(); j++){
int diff = abs(q1[i].first - q1[j].first);
int diff1 = abs(q1[i].second - q1[j].second);
if(diff >= maxx1){
result1[0] = make_pair(q1[i].first,q1[j].first);
}
if(diff1 >= maxy1){
result2[0] = make_pair(q1[i].second,q1[j].second);
}
maxx1 = max(diff,maxx1);
maxy1 = max(diff1,maxy1);
}
}
for(int i = 0; i < q2.size(); i++){
for(int j = i+1; j < q2.size(); j++){
int diff = abs(q2[i].first - q2[j].first);
int diff1 = abs(q2[i].second - q2[j].second);
if(diff >= maxx2){
result3[0] = make_pair(q2[i].first,q2[j].first);
}
if(diff1 >= maxy2){
result4[0] = make_pair(q2[i].second,q2[j].second);
}
maxx2 = max(diff,maxx2);
maxy2 = max(diff1,maxy2);
}
}
for(int i = 0; i < q3.size(); i++){
for(int j = i+1; j < q3.size(); j++){
int diff = abs(q3[i].first - q3[j].first);
int diff1 = abs(q3[i].second - q3[j].second);
if(diff >= maxx3){
result5[0] = make_pair(q3[i].first,q3[j].first);
}
if(diff1 >= maxy3){
result6[0] = make_pair(q3[i].second,q3[j].second);
}
maxx3 = max(diff,maxx3);
maxy3 = max(diff1,maxy3);
}
}
for(int i = 0; i < q4.size(); i++){
for(int j = i+1; j < q4.size(); j++){
int diff = abs(q4[i].first - q4[j].first);
int diff1 = abs(q4[i].second - q4[j].second);
if(diff >= maxx4){
result7[0] = make_pair(q4[i].first,q4[j].first);
}
if(diff1 >= maxy4){
result8[0] = make_pair(q4[i].second,q4[j].second);
}
maxx4 = max(diff,maxx4);
maxy4 = max(diff1,maxy4);
}
}
if(q1.size() != 0 ){
cout << "Q1: (" << result1[0].first <<", "<< result2[0].second << ") ("<< result1[0].second;
cout << ", "<< result2[0].second << ") " << maxx1 * maxy1 << endl;
}
if(q2.size()!= 0){
cout << "Q2: (" << result3[0].first <<", "<< result4[0].second << ") ("<< result3[0].second;
cout << ", "<< result4[0].second << ") " << maxx2 * maxy2 << endl;
}
if(q3.size()!= 0){
cout << "Q3: (" << result5[0].first <<", "<< result6[0].second << ") ("<< result5[0].second;
cout << ", "<< result6[0].second << ") " << maxx3 * maxy3 << endl;
}
if(q4.size() != 0){
cout << "Q4: (" << result7[0].first <<", "<< result8[0].second << ") ("<< result7[0].second;
cout << ", "<< result8[0].second << ") " << maxx4 * maxy4 << endl;
}
}
} | # 2069928, 2024-11-02 11:37:32, PPPP-P---- (50%)
#include<iostream>
#include<vector>
#include<utility>
#include<set>
#include<cmath>
#include<algorithm>
using namespace std;
int main(){
int n;
cin >> n;
vector<pair<int,int>> q1,q2,q3,q4;
vector<int> min1,min2,min3,min4;
vector<int> max1,max2,max3,max4;
vector<int> mi1,mi2,mi3,mi4,ma1,ma2,ma3,ma4;
for(int i = 0; i < n; i++){
int x,y;
cin >> x >> y;
if(x == 0 || y == 0){
//dont store data;
}else{
if(x > 0){
if(y > 0){
q1.push_back(make_pair(x,y));
min1.push_back(x);
max1.push_back(-x);
mi1.push_back(y);
ma1.push_back(-y);
}else{
q4.push_back(make_pair(x,y));
min4.push_back(x);
max4.push_back(-x);
mi4.push_back(y);
ma4.push_back(-y);
}
}else{
if(y > 0){
q2.push_back(make_pair(x,y));
min2.push_back(x);
max2.push_back(-x);
mi2.push_back(y);
ma2.push_back(-y);
}else{
q3.push_back(make_pair(x,y));
min3.push_back(x);
max3.push_back(-x);
mi3.push_back(y);
ma3.push_back(-y);
}
}
}
}
sort(max1.begin(),max1.end());
sort(max2.begin(),max2.end());
sort(max3.begin(),max3.end());
sort(max4.begin(),max4.end());
sort(min1.begin(),min1.end());
sort(min2.begin(),min2.end());
sort(min3.begin(),min3.end());
sort(min4.begin(),min4.end());
sort(ma1.begin(),ma1.end());
sort(ma2.begin(),ma2.end());
sort(ma3.begin(),ma3.end());
sort(ma4.begin(),ma4.end());
sort(mi1.begin(),mi1.end());
sort(mi2.begin(),mi2.end());
sort(mi3.begin(),mi3.end());
sort(mi4.begin(),mi4.end());
if(q1.size() == 0 && q2.size() == 0 && q3.size() == 0 && q4.size() == 0){
cout << "No point in any quadrant";
}else{
vector<pair<int,int>> result1(1),result2(1),result3(1),result4(1),result5(1),result6(1),result7(1),result8(1);
int maxx1 = 0,maxy1 = 0,maxx2 = 0, maxy2 = 0, maxx3 = 0, maxy3 = 0, maxx4 = 0, maxy4 = 0;
for(int i = 0; i < q1.size(); i++){
for(int j = i+1; j < q1.size(); j++){
int diff = abs(q1[i].first - q1[j].first);
int diff1 = abs(q1[i].second - q1[j].second);
if(diff >= maxx1){
result1[0] = make_pair(q1[i].first,q1[j].first);
}
if(diff1 >= maxy1){
result2[0] = make_pair(q1[i].second,q1[j].second);
}
maxx1 = max(diff,maxx1);
maxy1 = max(diff1,maxy1);
}
}
for(int i = 0; i < q2.size(); i++){
for(int j = i+1; j < q2.size(); j++){
int diff = abs(q2[i].first - q2[j].first);
int diff1 = abs(q2[i].second - q2[j].second);
if(diff >= maxx2){
result3[0] = make_pair(q2[i].first,q2[j].first);
}
if(diff1 >= maxy2){
result4[0] = make_pair(q2[i].second,q2[j].second);
}
maxx2 = max(diff,maxx2);
maxy2 = max(diff1,maxy2);
}
}
for(int i = 0; i < q3.size(); i++){
for(int j = i+1; j < q3.size(); j++){
int diff = abs(q3[i].first - q3[j].first);
int diff1 = abs(q3[i].second - q3[j].second);
if(diff >= maxx3){
result5[0] = make_pair(q3[i].first,q3[j].first);
}
if(diff1 >= maxy3){
result6[0] = make_pair(q3[i].second,q3[j].second);
}
maxx3 = max(diff,maxx3);
maxy3 = max(diff1,maxy3);
}
}
for(int i = 0; i < q4.size(); i++){
for(int j = i+1; j < q4.size(); j++){
int diff = abs(q4[i].first - q4[j].first);
int diff1 = abs(q4[i].second - q4[j].second);
if(diff >= maxx4){
result7[0] = make_pair(q4[i].first,q4[j].first);
}
if(diff1 >= maxy4){
result8[0] = make_pair(q4[i].second,q4[j].second);
}
maxx4 = max(diff,maxx4);
maxy4 = max(diff1,maxy4);
}
}
if(q1.size() != 0 ){
cout << "Q1: (" << min1[0] <<", "<< mi1[0] << ") ("<< -max1[0];
cout << ", "<< -ma1[0] << ") " << maxx1 * maxy1 << endl;
}
if(q2.size()!= 0){
cout << "Q2: (" << min2[0] <<", "<< mi2[0] << ") ("<< -max2[0];
cout << ", "<< -ma2[0] << ") " << maxx2 * maxy2 << endl;
}
if(q3.size()!= 0){
cout << "Q3: (" << min3[0]<<", "<< mi3[0]<< ") ("<< -max3[0];
cout << ", "<< -ma3[0]<< ") " << maxx3 * maxy3 << endl;
}
if(q4.size() != 0){
cout << "Q4: (" << min4[0] <<", "<< mi4[0] << ") ("<< max4[0];
cout << ", "<< ma4[0]<< ") " << maxx4 * maxy4 << endl;
}
}
} | # 2070028, 2024-11-02 11:45:39, PPPP-P---- (50%)
#include<iostream>
#include<vector>
#include<utility>
#include<set>
#include<cmath>
#include<algorithm>
using namespace std;
int main(){
int n;
cin >> n;
vector<pair<int,int>> q1,q2,q3,q4;
vector<int> min1,min2,min3,min4;
vector<int> max1,max2,max3,max4;
vector<int> mi1,mi2,mi3,mi4,ma1,ma2,ma3,ma4;
for(int i = 0; i < n; i++){
int x,y;
cin >> x >> y;
if(x == 0 || y == 0){
//dont store data;
}else{
if(x > 0){
if(y > 0){
q1.push_back(make_pair(x,y));
min1.push_back(x);
max1.push_back(-x);
mi1.push_back(y);
ma1.push_back(-y);
}else{
q4.push_back(make_pair(x,y));
min4.push_back(x);
max4.push_back(-x);
mi4.push_back(y);
ma4.push_back(-y);
}
}else{
if(y > 0){
q2.push_back(make_pair(x,y));
min2.push_back(x);
max2.push_back(-x);
mi2.push_back(y);
ma2.push_back(-y);
}else{
q3.push_back(make_pair(x,y));
min3.push_back(x);
max3.push_back(-x);
mi3.push_back(y);
ma3.push_back(-y);
}
}
}
}
sort(max1.begin(),max1.end());
sort(max2.begin(),max2.end());
sort(max3.begin(),max3.end());
sort(max4.begin(),max4.end());
sort(min1.begin(),min1.end());
sort(min2.begin(),min2.end());
sort(min3.begin(),min3.end());
sort(min4.begin(),min4.end());
sort(ma1.begin(),ma1.end());
sort(ma2.begin(),ma2.end());
sort(ma3.begin(),ma3.end());
sort(ma4.begin(),ma4.end());
sort(mi1.begin(),mi1.end());
sort(mi2.begin(),mi2.end());
sort(mi3.begin(),mi3.end());
sort(mi4.begin(),mi4.end());
if(q1.size() == 0 && q2.size() == 0 && q3.size() == 0 && q4.size() == 0){
cout << "No point in any quadrant";
}else{
vector<pair<int,int>> result1(1),result2(1),result3(1),result4(1),result5(1),result6(1),result7(1),result8(1);
int maxx1 = 0,maxy1 = 0,maxx2 = 0, maxy2 = 0, maxx3 = 0, maxy3 = 0, maxx4 = 0, maxy4 = 0;
for(int i = 0; i < q1.size(); i++){
for(int j = i+1; j < q1.size(); j++){
int diff = abs(q1[i].first - q1[j].first);
int diff1 = abs(q1[i].second - q1[j].second);
if(diff >= maxx1){
result1[0] = make_pair(q1[i].first,q1[j].first);
}
if(diff1 >= maxy1){
result2[0] = make_pair(q1[i].second,q1[j].second);
}
maxx1 = max(diff,maxx1);
maxy1 = max(diff1,maxy1);
}
}
for(int i = 0; i < q2.size(); i++){
for(int j = i+1; j < q2.size(); j++){
int diff = abs(q2[i].first - q2[j].first);
int diff1 = abs(q2[i].second - q2[j].second);
if(diff >= maxx2){
result3[0] = make_pair(q2[i].first,q2[j].first);
}
if(diff1 >= maxy2){
result4[0] = make_pair(q2[i].second,q2[j].second);
}
maxx2 = max(diff,maxx2);
maxy2 = max(diff1,maxy2);
}
}
for(int i = 0; i < q3.size(); i++){
for(int j = i+1; j < q3.size(); j++){
int diff = abs(q3[i].first - q3[j].first);
int diff1 = abs(q3[i].second - q3[j].second);
if(diff >= maxx3){
result5[0] = make_pair(q3[i].first,q3[j].first);
}
if(diff1 >= maxy3){
result6[0] = make_pair(q3[i].second,q3[j].second);
}
maxx3 = max(diff,maxx3);
maxy3 = max(diff1,maxy3);
}
}
for(int i = 0; i < q4.size(); i++){
for(int j = i+1; j < q4.size(); j++){
int diff = abs(q4[i].first - q4[j].first);
int diff1 = abs(q4[i].second - q4[j].second);
if(diff >= maxx4){
result7[0] = make_pair(q4[i].first,q4[j].first);
}
if(diff1 >= maxy4){
result8[0] = make_pair(q4[i].second,q4[j].second);
}
maxx4 = max(diff,maxx4);
maxy4 = max(diff1,maxy4);
}
}
if(q1.size() != 0 && q1.size() != 1){
cout << "Q1: (" << min1[0] <<", "<< mi1[0] << ") ("<< -max1[0];
cout << ", "<< -ma1[0] << ") " << maxx1 * maxy1 << endl;
}
if(q2.size()!= 0 && q2.size() != 1){
cout << "Q2: (" << min2[0] <<", "<< mi2[0] << ") ("<< -max2[0];
cout << ", "<< -ma2[0] << ") " << maxx2 * maxy2 << endl;
}
if(q3.size()!= 0 && q3.size() != 1 ){
cout << "Q3: (" << min3[0]<<", "<< mi3[0]<< ") ("<< -max3[0];
cout << ", "<< -ma3[0]<< ") " << maxx3 * maxy3 << endl;
}
if(q4.size() != 0 && q4.size() != 1 ){
cout << "Q4: (" << min4[0] <<", "<< mi4[0] << ") ("<< max4[0];
cout << ", "<< ma4[0]<< ") " << maxx4 * maxy4 << endl;
}
if(q1.size() == 1){
cout << "Q1: (" << min1[0] <<", "<< mi1[0] << ") " << maxx1 * maxy1 << endl;
}
if(q1.size() == 1){
cout << "Q2: (" << min2[0] <<", "<< mi2[0] << ") " << maxx2 * maxy2 << endl;
}
if(q1.size() == 1){
cout << "Q3: (" << min3[0] <<", "<< mi3[0] << ") " << maxx3 * maxy3 << endl;
}
if(q1.size() == 1){
cout << "Q4: (" << min4[0] <<", "<< mi4[0] << ") " << maxx4 * maxy4 << endl;
}
}
} | # 2070040, 2024-11-02 11:46:36, PPPP-P---- (50%)
#include<iostream>
#include<vector>
#include<utility>
#include<set>
#include<cmath>
#include<algorithm>
using namespace std;
int main(){
int n;
cin >> n;
vector<pair<int,int>> q1,q2,q3,q4;
vector<int> min1,min2,min3,min4;
vector<int> max1,max2,max3,max4;
vector<int> mi1,mi2,mi3,mi4,ma1,ma2,ma3,ma4;
for(int i = 0; i < n; i++){
int x,y;
cin >> x >> y;
if(x == 0 || y == 0){
//dont store data;
}else{
if(x > 0){
if(y > 0){
q1.push_back(make_pair(x,y));
min1.push_back(x);
max1.push_back(-x);
mi1.push_back(y);
ma1.push_back(-y);
}else{
q4.push_back(make_pair(x,y));
min4.push_back(x);
max4.push_back(-x);
mi4.push_back(y);
ma4.push_back(-y);
}
}else{
if(y > 0){
q2.push_back(make_pair(x,y));
min2.push_back(x);
max2.push_back(-x);
mi2.push_back(y);
ma2.push_back(-y);
}else{
q3.push_back(make_pair(x,y));
min3.push_back(x);
max3.push_back(-x);
mi3.push_back(y);
ma3.push_back(-y);
}
}
}
}
sort(max1.begin(),max1.end());
sort(max2.begin(),max2.end());
sort(max3.begin(),max3.end());
sort(max4.begin(),max4.end());
sort(min1.begin(),min1.end());
sort(min2.begin(),min2.end());
sort(min3.begin(),min3.end());
sort(min4.begin(),min4.end());
sort(ma1.begin(),ma1.end());
sort(ma2.begin(),ma2.end());
sort(ma3.begin(),ma3.end());
sort(ma4.begin(),ma4.end());
sort(mi1.begin(),mi1.end());
sort(mi2.begin(),mi2.end());
sort(mi3.begin(),mi3.end());
sort(mi4.begin(),mi4.end());
if(q1.size() == 0 && q2.size() == 0 && q3.size() == 0 && q4.size() == 0){
cout << "No point in any quadrant";
}else{
vector<pair<int,int>> result1(1),result2(1),result3(1),result4(1),result5(1),result6(1),result7(1),result8(1);
int maxx1 = 0,maxy1 = 0,maxx2 = 0, maxy2 = 0, maxx3 = 0, maxy3 = 0, maxx4 = 0, maxy4 = 0;
for(int i = 0; i < q1.size(); i++){
for(int j = i+1; j < q1.size(); j++){
int diff = abs(q1[i].first - q1[j].first);
int diff1 = abs(q1[i].second - q1[j].second);
if(diff >= maxx1){
result1[0] = make_pair(q1[i].first,q1[j].first);
}
if(diff1 >= maxy1){
result2[0] = make_pair(q1[i].second,q1[j].second);
}
maxx1 = max(diff,maxx1);
maxy1 = max(diff1,maxy1);
}
}
for(int i = 0; i < q2.size(); i++){
for(int j = i+1; j < q2.size(); j++){
int diff = abs(q2[i].first - q2[j].first);
int diff1 = abs(q2[i].second - q2[j].second);
if(diff >= maxx2){
result3[0] = make_pair(q2[i].first,q2[j].first);
}
if(diff1 >= maxy2){
result4[0] = make_pair(q2[i].second,q2[j].second);
}
maxx2 = max(diff,maxx2);
maxy2 = max(diff1,maxy2);
}
}
for(int i = 0; i < q3.size(); i++){
for(int j = i+1; j < q3.size(); j++){
int diff = abs(q3[i].first - q3[j].first);
int diff1 = abs(q3[i].second - q3[j].second);
if(diff >= maxx3){
result5[0] = make_pair(q3[i].first,q3[j].first);
}
if(diff1 >= maxy3){
result6[0] = make_pair(q3[i].second,q3[j].second);
}
maxx3 = max(diff,maxx3);
maxy3 = max(diff1,maxy3);
}
}
for(int i = 0; i < q4.size(); i++){
for(int j = i+1; j < q4.size(); j++){
int diff = abs(q4[i].first - q4[j].first);
int diff1 = abs(q4[i].second - q4[j].second);
if(diff >= maxx4){
result7[0] = make_pair(q4[i].first,q4[j].first);
}
if(diff1 >= maxy4){
result8[0] = make_pair(q4[i].second,q4[j].second);
}
maxx4 = max(diff,maxx4);
maxy4 = max(diff1,maxy4);
}
}
if(q1.size() != 0 && q1.size() != 1){
cout << "Q1: (" << min1[0] <<", "<< mi1[0] << ") ("<< -max1[0];
cout << ", "<< -ma1[0] << ") " << maxx1 * maxy1 << endl;
}
if(q2.size()!= 0 && q2.size() != 1){
cout << "Q2: (" << min2[0] <<", "<< mi2[0] << ") ("<< -max2[0];
cout << ", "<< -ma2[0] << ") " << maxx2 * maxy2 << endl;
}
if(q3.size()!= 0 && q3.size() != 1 ){
cout << "Q3: (" << min3[0]<<", "<< mi3[0]<< ") ("<< -max3[0];
cout << ", "<< -ma3[0]<< ") " << maxx3 * maxy3 << endl;
}
if(q4.size() != 0 && q4.size() != 1 ){
cout << "Q4: (" << min4[0] <<", "<< mi4[0] << ") ("<< max4[0];
cout << ", "<< ma4[0]<< ") " << maxx4 * maxy4 << endl;
}
if(q1.size() == 1){
cout << "Q1: (" << min1[0] <<", "<< mi1[0] << ") " << maxx1 * maxy1 << endl;
}
if(q2.size() == 1){
cout << "Q2: (" << min2[0] <<", "<< mi2[0] << ") " << maxx2 * maxy2 << endl;
}
if(q3.size() == 1){
cout << "Q3: (" << min3[0] <<", "<< mi3[0] << ") " << maxx3 * maxy3 << endl;
}
if(q4.size() == 1){
cout << "Q4: (" << min4[0] <<", "<< mi4[0] << ") " << maxx4 * maxy4 << endl;
}
}
} | # 2070071, 2024-11-02 11:49:14, PPPP-P---- (50%)
#include<iostream>
#include<vector>
#include<utility>
#include<set>
#include<cmath>
#include<algorithm>
using namespace std;
int main(){
int n;
cin >> n;
vector<pair<int,int>> q1,q2,q3,q4;
vector<int> min1,min2,min3,min4;
vector<int> max1,max2,max3,max4;
vector<int> mi1,mi2,mi3,mi4,ma1,ma2,ma3,ma4;
for(int i = 0; i < n; i++){
int x,y;
cin >> x >> y;
if(x == 0 || y == 0){
//dont store data;
}else{
if(x > 0){
if(y > 0){
q1.push_back(make_pair(x,y));
min1.push_back(x);
max1.push_back(-x);
mi1.push_back(y);
ma1.push_back(-y);
}else{
q4.push_back(make_pair(x,y));
min4.push_back(x);
max4.push_back(-x);
mi4.push_back(y);
ma4.push_back(-y);
}
}else{
if(y > 0){
q2.push_back(make_pair(x,y));
min2.push_back(x);
max2.push_back(-x);
mi2.push_back(y);
ma2.push_back(-y);
}else{
q3.push_back(make_pair(x,y));
min3.push_back(x);
max3.push_back(-x);
mi3.push_back(y);
ma3.push_back(-y);
}
}
}
}
sort(max1.begin(),max1.end());
sort(max2.begin(),max2.end());
sort(max3.begin(),max3.end());
sort(max4.begin(),max4.end());
sort(min1.begin(),min1.end());
sort(min2.begin(),min2.end());
sort(min3.begin(),min3.end());
sort(min4.begin(),min4.end());
sort(ma1.begin(),ma1.end());
sort(ma2.begin(),ma2.end());
sort(ma3.begin(),ma3.end());
sort(ma4.begin(),ma4.end());
sort(mi1.begin(),mi1.end());
sort(mi2.begin(),mi2.end());
sort(mi3.begin(),mi3.end());
sort(mi4.begin(),mi4.end());
if(q1.size() == 0 && q2.size() == 0 && q3.size() == 0 && q4.size() == 0){
cout << "No point in any quadrant";
}else{
vector<pair<int,int>> result1(1),result2(1),result3(1),result4(1),result5(1),result6(1),result7(1),result8(1);
int maxx1 = 0,maxy1 = 0,maxx2 = 0, maxy2 = 0, maxx3 = 0, maxy3 = 0, maxx4 = 0, maxy4 = 0;
for(int i = 0; i < q1.size(); i++){
for(int j = i+1; j < q1.size(); j++){
int diff = abs(q1[i].first - q1[j].first);
int diff1 = abs(q1[i].second - q1[j].second);
if(diff >= maxx1){
result1[0] = make_pair(q1[i].first,q1[j].first);
}
if(diff1 >= maxy1){
result2[0] = make_pair(q1[i].second,q1[j].second);
}
maxx1 = max(diff,maxx1);
maxy1 = max(diff1,maxy1);
}
}
for(int i = 0; i < q2.size(); i++){
for(int j = i+1; j < q2.size(); j++){
int diff = abs(q2[i].first - q2[j].first);
int diff1 = abs(q2[i].second - q2[j].second);
if(diff >= maxx2){
result3[0] = make_pair(q2[i].first,q2[j].first);
}
if(diff1 >= maxy2){
result4[0] = make_pair(q2[i].second,q2[j].second);
}
maxx2 = max(diff,maxx2);
maxy2 = max(diff1,maxy2);
}
}
for(int i = 0; i < q3.size(); i++){
for(int j = i+1; j < q3.size(); j++){
int diff = abs(q3[i].first - q3[j].first);
int diff1 = abs(q3[i].second - q3[j].second);
if(diff >= maxx3){
result5[0] = make_pair(q3[i].first,q3[j].first);
}
if(diff1 >= maxy3){
result6[0] = make_pair(q3[i].second,q3[j].second);
}
maxx3 = max(diff,maxx3);
maxy3 = max(diff1,maxy3);
}
}
for(int i = 0; i < q4.size(); i++){
for(int j = i+1; j < q4.size(); j++){
int diff = abs(q4[i].first - q4[j].first);
int diff1 = abs(q4[i].second - q4[j].second);
if(diff >= maxx4){
result7[0] = make_pair(q4[i].first,q4[j].first);
}
if(diff1 >= maxy4){
result8[0] = make_pair(q4[i].second,q4[j].second);
}
maxx4 = max(diff,maxx4);
maxy4 = max(diff1,maxy4);
}
}
if(q1.size() != 0 ){
cout << "Q1: (" << min1[0] <<", "<< mi1[0] << ") ("<< -max1[0];
cout << ", "<< -ma1[0] << ") " << maxx1 * maxy1 << endl;
}
if(q2.size()!= 0){
cout << "Q2: (" << min2[0] <<", "<< mi2[0] << ") ("<< -max2[0];
cout << ", "<< -ma2[0] << ") " << maxx2 * maxy2 << endl;
}
if(q3.size()!= 0){
cout << "Q3: (" << min3[0]<<", "<< mi3[0]<< ") ("<< -max3[0];
cout << ", "<< -ma3[0]<< ") " << maxx3 * maxy3 << endl;
}
if(q4.size() != 0 ){
cout << "Q4: (" << min4[0] <<", "<< mi4[0] << ") ("<< max4[0];
cout << ", "<< ma4[0]<< ") " << maxx4 * maxy4 << endl;
}
}
} |
# 2071262, 2024-11-02 14:14:25, -----P---- (10%)
#include <iostream>
#include <map>
using namespace std;
int main(){
map<int, int> Q1, Q2, Q3, Q4;
int n; cin >> n;
while(n--){
int a, b;
cin >> a >> b;
if(a == 0 || b == 0) continue;
else{
if(a > 0 && b > 0) Q1[a] = b;
else if(a < 0 && b > 0) Q2[a] = b;
else if(a < 0 && b < 0) Q3[a] = b;
else if(a > 0 && b < 0) Q4[a] = b;
}
}
// cout << "/////////////////////////////" << endl;
// for (auto &m: Q1){
// cout << m.first << " " << m.second << endl;
// }
if (Q1.empty() && Q2.empty() && Q3.empty() && Q4.empty()) cout << "No point in any quadrant" << endl;
else{
return 0;
}
} | # 2071868, 2024-11-02 15:24:09, xxxxPPPPxP (50%)
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
int main(){
vector<int> fQ1, sQ1, fQ2, sQ2, fQ3, sQ3, fQ4, sQ4;
int n; cin >> n;
while(n--){
int a, b; cin >> a >> b;
if(a == 0 || b == 0){
continue;
}
else if(a > 0 && b > 0){
fQ1.push_back(a);
sQ1.push_back(b);
}
else if(a < 0 && b > 0){
fQ2.push_back(a);
sQ2.push_back(b);
}
else if(a < 0 && b < 0){
fQ3.push_back(a);
sQ3.push_back(b);
}
else if(a > 0 && b < 0){
fQ4.push_back(a);
sQ4.push_back(b);
}
}
if(fQ1.size() == 0 && fQ2.size() == 0 && fQ3.size() == 0 && fQ4.size() == 0){
cout << "No point in any quadrant" << endl;
return 0;
}
else{
sort(fQ1.rbegin(), fQ1.rend()); sort(sQ1.rbegin(), sQ1.rend());
sort(fQ2.rbegin(), fQ2.rend()); sort(sQ2.rbegin(), sQ2.rend());
sort(fQ3.rbegin(), fQ3.rend()); sort(sQ3.rbegin(), sQ3.rend());
sort(fQ4.rbegin(), fQ4.rend()); sort(sQ4.rbegin(), sQ4.rend());
int aQ1 = abs(fQ1[fQ1.size()-1] - fQ1[0]) * abs(sQ1[sQ1.size()-1] - sQ1[0]);
int aQ2 = abs(fQ2[fQ2.size()-1] - fQ2[0]) * abs(sQ2[sQ2.size()-1] - sQ2[0]);
int aQ3 = (abs(fQ3[fQ3.size()-1]) - abs(fQ3[0])) * (abs(sQ3[sQ3.size()-1]) - abs(sQ3[0]));
int aQ4 = abs((abs(fQ4[fQ4.size()-1]) - fQ4[0]) * (abs(sQ4[sQ4.size()-1]) - abs(sQ4[0])));
cout << "Q1: (" << fQ1[fQ1.size()-1] << ", " << sQ1[sQ1.size()-1] << ") (" << fQ1[0] << ", " << sQ1[0] << ") " << aQ1 << endl;
cout << "Q2: (" << fQ2[fQ2.size()-1] << ", " << sQ2[sQ2.size()-1] << ") (" << fQ2[0] << ", " << sQ2[0] << ") " << aQ2 << endl;
cout << "Q3: (" << fQ3[fQ3.size()-1] << ", " << sQ3[sQ3.size()-1] << ") (" << fQ3[0] << ", " << sQ3[0] << ") " << aQ3 << endl;
cout << "Q4: (" << fQ4[fQ4.size()-1] << ", " << sQ4[sQ4.size()-1] << ") (" << fQ4[0] << ", " << sQ4[0] << ") " << aQ4 << endl;
}
} | # 2072005, 2024-11-02 15:32:00, xx-xPPPPxP (50%)
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
int main(){
vector<int> fQ1, sQ1, fQ2, sQ2, fQ3, sQ3, fQ4, sQ4;
int n; cin >> n;
while(n--){
int a, b; cin >> a >> b;
if(a == 0 || b == 0){
continue;
}
else if(a > 0 && b > 0){
fQ1.push_back(a);
sQ1.push_back(b);
}
else if(a < 0 && b > 0){
fQ2.push_back(a);
sQ2.push_back(b);
}
else if(a < 0 && b < 0){
fQ3.push_back(a);
sQ3.push_back(b);
}
else if(a > 0 && b < 0){
fQ4.push_back(a);
sQ4.push_back(b);
}
}
if(fQ1.size() == 0 && fQ2.size() == 0 && fQ3.size() == 0 && fQ4.size() == 0){
cout << "No point in any quadrant" << endl;
return 0;
}
else{
if (fQ1.size() != 0 && sQ1.size() != 0 && fQ2.size() != 0 && sQ2.size() != 0 && fQ4.size() != 0 && sQ4.size() != 0 && fQ3.size() != 0 && sQ3.size() != 0){
sort(fQ1.rbegin(), fQ1.rend()); sort(sQ1.rbegin(), sQ1.rend());
sort(fQ2.rbegin(), fQ2.rend()); sort(sQ2.rbegin(), sQ2.rend());
sort(fQ3.rbegin(), fQ3.rend()); sort(sQ3.rbegin(), sQ3.rend());
sort(fQ4.rbegin(), fQ4.rend()); sort(sQ4.rbegin(), sQ4.rend());
int aQ1 = abs(fQ1[fQ1.size()-1] - fQ1[0]) * abs(sQ1[sQ1.size()-1] - sQ1[0]);
int aQ2 = abs(fQ2[fQ2.size()-1] - fQ2[0]) * abs(sQ2[sQ2.size()-1] - sQ2[0]);
int aQ3 = (abs(fQ3[fQ3.size()-1]) - abs(fQ3[0])) * (abs(sQ3[sQ3.size()-1]) - abs(sQ3[0]));
int aQ4 = abs((abs(fQ4[fQ4.size()-1]) - fQ4[0]) * (abs(sQ4[sQ4.size()-1]) - abs(sQ4[0])));
cout << "Q1: (" << fQ1[fQ1.size()-1] << ", " << sQ1[sQ1.size()-1] << ") (" << fQ1[0] << ", " << sQ1[0] << ") " << aQ1 << endl;
cout << "Q2: (" << fQ2[fQ2.size()-1] << ", " << sQ2[sQ2.size()-1] << ") (" << fQ2[0] << ", " << sQ2[0] << ") " << aQ2 << endl;
cout << "Q3: (" << fQ3[fQ3.size()-1] << ", " << sQ3[sQ3.size()-1] << ") (" << fQ3[0] << ", " << sQ3[0] << ") " << aQ3 << endl;
cout << "Q4: (" << fQ4[fQ4.size()-1] << ", " << sQ4[sQ4.size()-1] << ") (" << fQ4[0] << ", " << sQ4[0] << ") " << aQ4 << endl;
}
else if(fQ1.size() == 0 && sQ1.size() == 0){
sort(fQ1.rbegin(), fQ1.rend()); sort(sQ1.rbegin(), sQ1.rend());
sort(fQ3.rbegin(), fQ3.rend()); sort(sQ3.rbegin(), sQ3.rend());
sort(fQ4.rbegin(), fQ4.rend()); sort(sQ4.rbegin(), sQ4.rend());
int aQ1 = abs(fQ1[fQ1.size()-1] - fQ1[0]) * abs(sQ1[sQ1.size()-1] - sQ1[0]);
int aQ3 = (abs(fQ3[fQ3.size()-1]) - abs(fQ3[0])) * (abs(sQ3[sQ3.size()-1]) - abs(sQ3[0]));
int aQ4 = abs((abs(fQ4[fQ4.size()-1]) - fQ4[0]) * (abs(sQ4[sQ4.size()-1]) - abs(sQ4[0])));
cout << "Q1: (" << fQ1[fQ1.size()-1] << ", " << sQ1[sQ1.size()-1] << ") (" << fQ1[0] << ", " << sQ1[0] << ") " << aQ1 << endl;
cout << "Q3: (" << fQ3[fQ3.size()-1] << ", " << sQ3[sQ3.size()-1] << ") (" << fQ3[0] << ", " << sQ3[0] << ") " << aQ3 << endl;
cout << "Q4: (" << fQ4[fQ4.size()-1] << ", " << sQ4[sQ4.size()-1] << ") (" << fQ4[0] << ", " << sQ4[0] << ") " << aQ4 << endl;
}
else if(fQ2.size() == 0 && sQ2.size() == 0){
sort(fQ1.rbegin(), fQ1.rend()); sort(sQ1.rbegin(), sQ1.rend());
sort(fQ3.rbegin(), fQ3.rend()); sort(sQ3.rbegin(), sQ3.rend());
sort(fQ4.rbegin(), fQ4.rend()); sort(sQ4.rbegin(), sQ4.rend());
int aQ1 = abs(fQ1[fQ1.size()-1] - fQ1[0]) * abs(sQ1[sQ1.size()-1] - sQ1[0]);
int aQ3 = (abs(fQ3[fQ3.size()-1]) - abs(fQ3[0])) * (abs(sQ3[sQ3.size()-1]) - abs(sQ3[0]));
int aQ4 = abs((abs(fQ4[fQ4.size()-1]) - fQ4[0]) * (abs(sQ4[sQ4.size()-1]) - abs(sQ4[0])));
cout << "Q1: (" << fQ1[fQ1.size()-1] << ", " << sQ1[sQ1.size()-1] << ") (" << fQ1[0] << ", " << sQ1[0] << ") " << aQ1 << endl;
cout << "Q3: (" << fQ3[fQ3.size()-1] << ", " << sQ3[sQ3.size()-1] << ") (" << fQ3[0] << ", " << sQ3[0] << ") " << aQ3 << endl;
cout << "Q4: (" << fQ4[fQ4.size()-1] << ", " << sQ4[sQ4.size()-1] << ") (" << fQ4[0] << ", " << sQ4[0] << ") " << aQ4 << endl;
}
// cout << "Q1: (" << fQ1[fQ1.size()-1] << ", " << sQ1[sQ1.size()-1] << ") (" << fQ1[0] << ", " << sQ1[0] << ") " << aQ1 << endl;
// cout << "Q2: (" << fQ2[fQ2.size()-1] << ", " << sQ2[sQ2.size()-1] << ") (" << fQ2[0] << ", " << sQ2[0] << ") " << aQ2 << endl;
// cout << "Q3: (" << fQ3[fQ3.size()-1] << ", " << sQ3[sQ3.size()-1] << ") (" << fQ3[0] << ", " << sQ3[0] << ") " << aQ3 << endl;
// cout << "Q4: (" << fQ4[fQ4.size()-1] << ", " << sQ4[sQ4.size()-1] << ") (" << fQ4[0] << ", " << sQ4[0] << ") " << aQ4 << endl;
}
} |
# 2069461, 2024-11-02 10:48:54, xxxxPx--x- (10%)
#include<iostream>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
void pair_out(std::pair<int, int> &a,std::pair<int, int> &b){
std::cout << "(" << a.first << ", " << a.second << ") (" << b.first << ", " << b.second << ") ";
}
int main(){
int n, x, y;
std::cin >> n;
std::set<int> q1x, q2x, q3x, q4x;
std::set<int> q1y, q2y, q3y, q4y;
while(n--){
std::cin >> x >> y;
if(x == 0 || y == 0){
continue;
}else{
if(x > 0){
if(y > 0){
q1x.insert(x);
q1y.insert(y);
}else{
q4x.insert(x);
q4y.insert(y);
}
}else{
if(y > 0){
q2x.insert(x);
q2y.insert(y);
}else{
q3x.insert(x);
q3y.insert(y);
}
}
}
}
std::pair<int, int> q1s, q1e, q2s, q2e, q3s, q3e, q4s, q4e;
q1s = {*(q1x.begin()), *(q1y.begin())};
q1e = {*(--q1x.end()), *(--q1y.end())};
q2s = {*(q2x.begin()), *(q2y.begin())};
q2e = {*(--q2x.end()), *(--q2y.end())};
q3s = {*(q3x.begin()), *(q3y.begin())};
q3e = {*(--q3x.end()), *(--q3y.end())};
q4s = {*(q4x.begin()), *(q4y.begin())};
q4e = {*(--q4x.end()), *(--q4y.end())};
int q1_a = abs(q1s.first - q1e.first) * abs(q1s.second - q1e.second);
int q2_a = abs(q2s.first - q2e.first) * abs(q2s.second - q2e.second);
int q3_a = abs(q3s.first - q3e.first) * abs(q1s.second - q3e.second);
int q4_a = abs(q4s.first - q4e.first) * abs(q1s.second - q4e.second);
std::cout << "Q1: "; pair_out(q1s, q1e); std::cout << q1_a << std::endl;
std::cout << "Q2: "; pair_out(q2s, q2e); std::cout << q2_a << std::endl;
std::cout << "Q3: "; pair_out(q3s, q3e); std::cout << q3_a << std::endl;
std::cout << "Q4: "; pair_out(q4s, q4e); std::cout << q4_a << std::endl;
} | # 2069527, 2024-11-02 10:55:14, PPP-PP---- (50%)
#include<iostream>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
void pair_out(std::pair<int, int> &a,std::pair<int, int> &b){
std::cout << "(" << a.first << ", " << a.second << ") (" << b.first << ", " << b.second << ") ";
}
int main(){
int n, x, y;
std::cin >> n;
std::set<int> q1x, q2x, q3x, q4x;
std::set<int> q1y, q2y, q3y, q4y;
while(n--){
std::cin >> x >> y;
if(x == 0 || y == 0){
continue;
}else{
if(x > 0){
if(y > 0){
q1x.insert(x);
q1y.insert(y);
}else{
q4x.insert(x);
q4y.insert(y);
}
}else{
if(y > 0){
q2x.insert(x);
q2y.insert(y);
}else{
q3x.insert(x);
q3y.insert(y);
}
}
}
}
std::pair<int, int> q1s, q1e, q2s, q2e, q3s, q3e, q4s, q4e;
if(!q1x.empty()){
q1s = {*(q1x.begin()), *(q1y.begin())};
q1e = {*(--q1x.end()), *(--q1y.end())};
int q1_a = abs(q1s.first - q1e.first) * abs(q1s.second - q1e.second);
std::cout << "Q1: "; pair_out(q1s, q1e); std::cout << q1_a << std::endl;
}
if(!q2x.empty()){
q2s = {*(q2x.begin()), *(q2y.begin())};
q2e = {*(--q2x.end()), *(--q2y.end())};
int q2_a = abs(q2s.first - q2e.first) * abs(q2s.second - q2e.second);
std::cout << "Q2: "; pair_out(q2s, q2e); std::cout << q2_a << std::endl;
}
if(!q3x.empty()){
q3s = {*(q3x.begin()), *(q3y.begin())};
q3e = {*(--q3x.end()), *(--q3y.end())};
int q3_a = abs(q3s.first - q3e.first) * abs(q1s.second - q3e.second);
std::cout << "Q3: "; pair_out(q3s, q3e); std::cout << q3_a << std::endl;
}
if(!q4x.empty()){
q4s = {*(q4x.begin()), *(q4y.begin())};
q4e = {*(--q4x.end()), *(--q4y.end())};
int q4_a = abs(q4s.first - q4e.first) * abs(q1s.second - q4e.second);
std::cout << "Q4: "; pair_out(q4s, q4e); std::cout << q4_a << std::endl;
}
if(q1x.empty() && q2x.empty() && q3x.empty() && q4x.empty()){
std::cout << "No point in any quadrant";
}
} |
# 2069330, 2024-11-02 10:37:03, -----P---- (10%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
double x,y;
vector<pair<double,double>> Q1;
vector<pair<double,double>> Q2;
vector<pair<double,double>> Q3;
vector<pair<double,double>> Q4;
while(n--){
cin >> x >> y;
if(x>0 && y>0){
Q1.push_back(make_pair(x,y));
}else if(x<0 && y>0){
Q2.push_back(make_pair(x,y));
}else if(x<0 && y<0){
Q3.push_back(make_pair(x,y));
}else if(x>0 && y<0){
Q4.push_back(make_pair(x,y));
}
}
if(Q1.empty() && Q2.empty() && Q3.empty() && Q4.empty()){
cout << "No point in any quadrant" ;
}
} | # 2069748, 2024-11-02 11:21:18, ---------- (0%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
int x,y;
vector<pair<int,int>> Q1;
vector<pair<int,int>> Q2;
vector<pair<int,int>> Q3;
vector<pair<int,int>> Q4;
while(n--){
cin >> x >> y;
if(x>0 && y>0){
Q1.push_back(make_pair(x,y));
}else if(x<0 && y>0){
Q2.push_back(make_pair(x,y));
}else if(x<0 && y<0){
Q3.push_back(make_pair(x,y));
}else if(x>0 && y<0){
Q4.push_back(make_pair(x,y));
}
}
if(Q1.empty() && Q2.empty() && Q3.empty() && Q4.empty()){
cout << "No point in any quadrant" ;
}
//max min Q1
int minx=0,miny=0,maxx=0,maxy=0;
for(auto c:Q1){
minx=c.first,miny=c.second;
maxx=c.first,maxy=c.second;
minx = min(minx,c.first);
miny = min(miny,c.second);
maxx = max(maxx,c.first);
maxy = max(maxy,c.second);
}
vector<pair<int,int>> Q1res;
int mul1=(maxx-minx)*(maxy-miny);
Q1res.push_back(make_pair(minx,miny));
Q1res.push_back(make_pair(maxx,maxy));
//Q2
for(auto c:Q2){
minx=c.first,miny=c.second;
maxx=c.first,maxy=c.second;
minx = min(minx,c.first);
miny = min(miny,c.second);
maxx = max(maxx,c.first);
maxy = max(maxy,c.second);
}
vector<pair<int,int>> Q2res;
int mul2=(maxx-minx)*(maxy-miny);
Q2res.push_back(make_pair(minx,miny));
Q2res.push_back(make_pair(maxx,maxy));
//Q3
for(auto c:Q3){
minx=c.first,miny=c.second;
maxx=c.first,maxy=c.second;
minx = min(minx,c.first);
miny = min(miny,c.second);
maxx = max(maxx,c.first);
maxy = max(maxy,c.second);
}
vector<pair<int,int>> Q3res;
int mul3=(maxx-minx)*(maxy-miny);
Q3res.push_back(make_pair(minx,miny));
Q3res.push_back(make_pair(maxx,maxy));
//Q4
for(auto c:Q4){
minx=c.first,miny=c.second;
maxx=c.first,maxy=c.second;
minx = min(minx,c.first);
miny = min(miny,c.second);
maxx = max(maxx,c.first);
maxy = max(maxy,c.second);
}
vector<pair<int,int>> Q4res;
int mul4=(maxx-minx)*(maxy-miny);
Q4res.push_back(make_pair(minx,miny));
Q4res.push_back(make_pair(maxx,maxy));
int k1=0,k2=0,k3=0,k4=0;
cout << "Q1: ";
k1+=Q1res[0].first, k2+=Q1res[0].second, k3+=Q1res[1].first, k4+=Q1res[1].second;
cout << "(" << k1 << ", " << k2 << ") (" << k3 << ", " << k4 << ") " << mul1 << endl;
cout << "Q2: ";
k1+=Q2res[0].first, k2+=Q2res[0].second, k3+=Q2res[1].first, k4+=Q2res[1].second;
cout << "(" << k1 << ", " << k2 << ") (" << k3 << ", " << k4 << ") " << mul2 << endl;
cout << "Q3: ";
k1+=Q3res[0].first, k2+=Q3res[0].second, k3+=Q3res[1].first, k4+=Q3res[1].second;
cout << "(" << k1 << ", " << k2 << ") (" << k3 << ", " << k4 << ") " << mul3 << endl;
cout << "Q4: ";
k1+=Q4res[0].first, k2+=Q4res[0].second, k3+=Q4res[1].first, k4+=Q4res[1].second;
cout << "(" << k1 << ", " << k2 << ") (" << k3 << ", " << k4 << ") " << mul4 << endl;
} | # 2069788, 2024-11-02 11:25:01, xxxx-x--x- (0%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
int x,y;
vector<pair<int,int>> Q1;
vector<pair<int,int>> Q2;
vector<pair<int,int>> Q3;
vector<pair<int,int>> Q4;
while(n--){
cin >> x >> y;
if(x>0 && y>0){
Q1.push_back(make_pair(x,y));
}else if(x<0 && y>0){
Q2.push_back(make_pair(x,y));
}else if(x<0 && y<0){
Q3.push_back(make_pair(x,y));
}else if(x>0 && y<0){
Q4.push_back(make_pair(x,y));
}
}
if(Q1.empty() && Q2.empty() && Q3.empty() && Q4.empty()){
cout << "No point in any quadrant" ;
}
//max min Q1
int minx=0,miny=0,maxx=0,maxy=0;
minx=Q1[0].first,miny=Q1[0].second;
maxx=Q1[0].first,maxy=Q1[0].second;
for(auto c:Q1){
minx = min(minx,c.first);
miny = min(miny,c.second);
maxx = max(maxx,c.first);
maxy = max(maxy,c.second);
}
vector<pair<int,int>> Q1res;
int mul1=(maxx-minx)*(maxy-miny);
Q1res.push_back(make_pair(minx,miny));
Q1res.push_back(make_pair(maxx,maxy));
//Q2
minx=Q2[0].first,miny=Q2[0].second;
maxx=Q2[0].first,maxy=Q2[0].second;
for(auto c:Q2){
minx = min(minx,c.first);
miny = min(miny,c.second);
maxx = max(maxx,c.first);
maxy = max(maxy,c.second);
}
vector<pair<int,int>> Q2res;
int mul2=(maxx-minx)*(maxy-miny);
Q2res.push_back(make_pair(minx,miny));
Q2res.push_back(make_pair(maxx,maxy));
//Q3
minx=Q3[0].first,miny=Q3[0].second;
maxx=Q3[0].first,maxy=Q3[0].second;
for(auto c:Q3){
minx = min(minx,c.first);
miny = min(miny,c.second);
maxx = max(maxx,c.first);
maxy = max(maxy,c.second);
}
vector<pair<int,int>> Q3res;
int mul3=(maxx-minx)*(maxy-miny);
Q3res.push_back(make_pair(minx,miny));
Q3res.push_back(make_pair(maxx,maxy));
//Q4
minx=Q4[0].first,miny=Q4[0].second;
maxx=Q4[0].first,maxy=Q4[0].second;
for(auto c:Q4){
minx = min(minx,c.first);
miny = min(miny,c.second);
maxx = max(maxx,c.first);
maxy = max(maxy,c.second);
}
vector<pair<int,int>> Q4res;
int mul4=(maxx-minx)*(maxy-miny);
Q4res.push_back(make_pair(minx,miny));
Q4res.push_back(make_pair(maxx,maxy));
int k1=0,k2=0,k3=0,k4=0;
cout << "Q1: ";
k1+=Q1res[0].first, k2+=Q1res[0].second, k3+=Q1res[1].first, k4+=Q1res[1].second;
cout << "(" << k1 << ", " << k2 << ") (" << k3 << ", " << k4 << ") " << mul1 << endl;
cout << "Q2: ";
k1+=Q2res[0].first, k2+=Q2res[0].second, k3+=Q2res[1].first, k4+=Q2res[1].second;
cout << "(" << k1 << ", " << k2 << ") (" << k3 << ", " << k4 << ") " << mul2 << endl;
cout << "Q3: ";
k1+=Q3res[0].first, k2+=Q3res[0].second, k3+=Q3res[1].first, k4+=Q3res[1].second;
cout << "(" << k1 << ", " << k2 << ") (" << k3 << ", " << k4 << ") " << mul3 << endl;
cout << "Q4: ";
k1+=Q4res[0].first, k2+=Q4res[0].second, k3+=Q4res[1].first, k4+=Q4res[1].second;
cout << "(" << k1 << ", " << k2 << ") (" << k3 << ", " << k4 << ") " << mul4 << endl;
} | # 2069792, 2024-11-02 11:25:22, xxxx-x--x- (0%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
int x,y;
vector<pair<int,int>> Q1;
vector<pair<int,int>> Q2;
vector<pair<int,int>> Q3;
vector<pair<int,int>> Q4;
while(n--){
cin >> x >> y;
if(x>0 && y>0){
Q1.push_back(make_pair(x,y));
}else if(x<0 && y>0){
Q2.push_back(make_pair(x,y));
}else if(x<0 && y<0){
Q3.push_back(make_pair(x,y));
}else if(x>0 && y<0){
Q4.push_back(make_pair(x,y));
}
}
if(Q1.empty() && Q2.empty() && Q3.empty() && Q4.empty()){
cout << "No point in any quadrant" ;
}
//max min Q1
int minx=0,miny=0,maxx=0,maxy=0;
minx=Q1[0].first,miny=Q1[0].second;
maxx=Q1[0].first,maxy=Q1[0].second;
for(auto c:Q1){
minx = min(minx,c.first);
miny = min(miny,c.second);
maxx = max(maxx,c.first);
maxy = max(maxy,c.second);
}
vector<pair<int,int>> Q1res;
int mul1=(maxx-minx)*(maxy-miny);
Q1res.push_back(make_pair(minx,miny));
Q1res.push_back(make_pair(maxx,maxy));
//Q2
minx=Q2[0].first,miny=Q2[0].second;
maxx=Q2[0].first,maxy=Q2[0].second;
for(auto c:Q2){
minx = min(minx,c.first);
miny = min(miny,c.second);
maxx = max(maxx,c.first);
maxy = max(maxy,c.second);
}
vector<pair<int,int>> Q2res;
int mul2=(maxx-minx)*(maxy-miny);
Q2res.push_back(make_pair(minx,miny));
Q2res.push_back(make_pair(maxx,maxy));
//Q3
minx=Q3[0].first,miny=Q3[0].second;
maxx=Q3[0].first,maxy=Q3[0].second;
for(auto c:Q3){
minx = min(minx,c.first);
miny = min(miny,c.second);
maxx = max(maxx,c.first);
maxy = max(maxy,c.second);
}
vector<pair<int,int>> Q3res;
int mul3=(maxx-minx)*(maxy-miny);
Q3res.push_back(make_pair(minx,miny));
Q3res.push_back(make_pair(maxx,maxy));
//Q4
minx=Q4[0].first,miny=Q4[0].second;
maxx=Q4[0].first,maxy=Q4[0].second;
for(auto c:Q4){
minx = min(minx,c.first);
miny = min(miny,c.second);
maxx = max(maxx,c.first);
maxy = max(maxy,c.second);
}
vector<pair<int,int>> Q4res;
int mul4=(maxx-minx)*(maxy-miny);
Q4res.push_back(make_pair(minx,miny));
Q4res.push_back(make_pair(maxx,maxy));
int k1=0,k2=0,k3=0,k4=0;
cout << "Q1: ";
k1+=Q1res[0].first, k2+=Q1res[0].second, k3+=Q1res[1].first, k4+=Q1res[1].second;
cout << "(" << k1 << ", " << k2 << ") (" << k3 << ", " << k4 << ") " << mul1 << endl;
cout << "Q2: ";
k1+=Q2res[0].first, k2+=Q2res[0].second, k3+=Q2res[1].first, k4+=Q2res[1].second;
cout << "(" << k1 << ", " << k2 << ") (" << k3 << ", " << k4 << ") " << mul2 << endl;
cout << "Q3: ";
k1+=Q3res[0].first, k2+=Q3res[0].second, k3+=Q3res[1].first, k4+=Q3res[1].second;
cout << "(" << k1 << ", " << k2 << ") (" << k3 << ", " << k4 << ") " << mul3 << endl;
cout << "Q4: ";
k1+=Q4res[0].first, k2+=Q4res[0].second, k3+=Q4res[1].first, k4+=Q4res[1].second;
cout << "(" << k1 << ", " << k2 << ") (" << k3 << ", " << k4 << ") " << mul4 << endl;
} | # 2069805, 2024-11-02 11:26:08, xxxx-x--x- (0%)
#include <iostream>
#include <vector>
#include <utility>
using namespace std;
int main(){
int n;
cin >> n;
int x,y;
vector<pair<int,int>> Q1;
vector<pair<int,int>> Q2;
vector<pair<int,int>> Q3;
vector<pair<int,int>> Q4;
while(n--){
cin >> x >> y;
if(x>0 && y>0){
Q1.push_back(make_pair(x,y));
}else if(x<0 && y>0){
Q2.push_back(make_pair(x,y));
}else if(x<0 && y<0){
Q3.push_back(make_pair(x,y));
}else if(x>0 && y<0){
Q4.push_back(make_pair(x,y));
}
}
if(Q1.empty() && Q2.empty() && Q3.empty() && Q4.empty()){
cout << "No point in any quadrant" ;
}
//max min Q1
int minx=0,miny=0,maxx=0,maxy=0;
minx=Q1[0].first,miny=Q1[0].second;
maxx=Q1[0].first,maxy=Q1[0].second;
for(auto c:Q1){
minx = min(minx,c.first);
miny = min(miny,c.second);
maxx = max(maxx,c.first);
maxy = max(maxy,c.second);
}
vector<pair<int,int>> Q1res;
int mul1=(maxx-minx)*(maxy-miny);
Q1res.push_back(make_pair(minx,miny));
Q1res.push_back(make_pair(maxx,maxy));
//Q2
minx=Q2[0].first,miny=Q2[0].second;
maxx=Q2[0].first,maxy=Q2[0].second;
for(auto c:Q2){
minx = min(minx,c.first);
miny = min(miny,c.second);
maxx = max(maxx,c.first);
maxy = max(maxy,c.second);
}
vector<pair<int,int>> Q2res;
int mul2=(maxx-minx)*(maxy-miny);
Q2res.push_back(make_pair(minx,miny));
Q2res.push_back(make_pair(maxx,maxy));
//Q3
minx=Q3[0].first,miny=Q3[0].second;
maxx=Q3[0].first,maxy=Q3[0].second;
for(auto c:Q3){
minx = min(minx,c.first);
miny = min(miny,c.second);
maxx = max(maxx,c.first);
maxy = max(maxy,c.second);
}
vector<pair<int,int>> Q3res;
int mul3=(maxx-minx)*(maxy-miny);
Q3res.push_back(make_pair(minx,miny));
Q3res.push_back(make_pair(maxx,maxy));
//Q4
minx=Q4[0].first,miny=Q4[0].second;
maxx=Q4[0].first,maxy=Q4[0].second;
for(auto c:Q4){
minx = min(minx,c.first);
miny = min(miny,c.second);
maxx = max(maxx,c.first);
maxy = max(maxy,c.second);
}
vector<pair<int,int>> Q4res;
int mul4=(maxx-minx)*(maxy-miny);
Q4res.push_back(make_pair(minx,miny));
Q4res.push_back(make_pair(maxx,maxy));
int k1=0,k2=0,k3=0,k4=0;
cout << "Q1: ";
k1+=Q1res[0].first, k2+=Q1res[0].second, k3+=Q1res[1].first, k4+=Q1res[1].second;
cout << "(" << k1 << ", " << k2 << ") (" << k3 << ", " << k4 << ") " << mul1 << endl;
cout << "Q2: ";
k1+=Q2res[0].first, k2+=Q2res[0].second, k3+=Q2res[1].first, k4+=Q2res[1].second;
cout << "(" << k1 << ", " << k2 << ") (" << k3 << ", " << k4 << ") " << mul2 << endl;
cout << "Q3: ";
k1+=Q3res[0].first, k2+=Q3res[0].second, k3+=Q3res[1].first, k4+=Q3res[1].second;
cout << "(" << k1 << ", " << k2 << ") (" << k3 << ", " << k4 << ") " << mul3 << endl;
cout << "Q4: ";
k1+=Q4res[0].first, k2+=Q4res[0].second, k3+=Q4res[1].first, k4+=Q4res[1].second;
cout << "(" << k1 << ", " << k2 << ") (" << k3 << ", " << k4 << ") " << mul4 << endl;
} | # 2069839, 2024-11-02 11:29:17, xxxxPxPPxP (40%)
#include <iostream>
#include <vector>
#include <utility>
using namespace std;
int main(){
int n;
cin >> n;
int x,y;
vector<pair<int,int>> Q1;
vector<pair<int,int>> Q2;
vector<pair<int,int>> Q3;
vector<pair<int,int>> Q4;
while(n--){
cin >> x >> y;
if(x>0 && y>0){
Q1.push_back(make_pair(x,y));
}else if(x<0 && y>0){
Q2.push_back(make_pair(x,y));
}else if(x<0 && y<0){
Q3.push_back(make_pair(x,y));
}else if(x>0 && y<0){
Q4.push_back(make_pair(x,y));
}
}
if(Q1.empty() && Q2.empty() && Q3.empty() && Q4.empty()){
cout << "No point in any quadrant" ;
}
//max min Q1
int minx=0,miny=0,maxx=0,maxy=0;
minx=Q1[0].first,miny=Q1[0].second;
maxx=Q1[0].first,maxy=Q1[0].second;
for(auto c:Q1){
minx = min(minx,c.first);
miny = min(miny,c.second);
maxx = max(maxx,c.first);
maxy = max(maxy,c.second);
}
vector<pair<int,int>> Q1res;
int mul1=(maxx-minx)*(maxy-miny);
Q1res.push_back(make_pair(minx,miny));
Q1res.push_back(make_pair(maxx,maxy));
//Q2
minx=Q2[0].first,miny=Q2[0].second;
maxx=Q2[0].first,maxy=Q2[0].second;
for(auto c:Q2){
minx = min(minx,c.first);
miny = min(miny,c.second);
maxx = max(maxx,c.first);
maxy = max(maxy,c.second);
}
vector<pair<int,int>> Q2res;
int mul2=(maxx-minx)*(maxy-miny);
Q2res.push_back(make_pair(minx,miny));
Q2res.push_back(make_pair(maxx,maxy));
//Q3
minx=Q3[0].first,miny=Q3[0].second;
maxx=Q3[0].first,maxy=Q3[0].second;
for(auto c:Q3){
minx = min(minx,c.first);
miny = min(miny,c.second);
maxx = max(maxx,c.first);
maxy = max(maxy,c.second);
}
vector<pair<int,int>> Q3res;
int mul3=(maxx-minx)*(maxy-miny);
Q3res.push_back(make_pair(minx,miny));
Q3res.push_back(make_pair(maxx,maxy));
//Q4
minx=Q4[0].first,miny=Q4[0].second;
maxx=Q4[0].first,maxy=Q4[0].second;
for(auto c:Q4){
minx = min(minx,c.first);
miny = min(miny,c.second);
maxx = max(maxx,c.first);
maxy = max(maxy,c.second);
}
vector<pair<int,int>> Q4res;
int mul4=(maxx-minx)*(maxy-miny);
Q4res.push_back(make_pair(minx,miny));
Q4res.push_back(make_pair(maxx,maxy));
int k1=0,k2=0,k3=0,k4=0;
cout << "Q1: ";
k1+=Q1res[0].first, k2+=Q1res[0].second, k3+=Q1res[1].first, k4+=Q1res[1].second;
cout << "(" << k1 << ", " << k2 << ") (" << k3 << ", " << k4 << ") " << mul1 << endl;
k1=0,k2=0,k3=0,k4=0;
cout << "Q2: ";
k1+=Q2res[0].first, k2+=Q2res[0].second, k3+=Q2res[1].first, k4+=Q2res[1].second;
cout << "(" << k1 << ", " << k2 << ") (" << k3 << ", " << k4 << ") " << mul2 << endl;
k1=0,k2=0,k3=0,k4=0;
cout << "Q3: ";
k1+=Q3res[0].first, k2+=Q3res[0].second, k3+=Q3res[1].first, k4+=Q3res[1].second;
cout << "(" << k1 << ", " << k2 << ") (" << k3 << ", " << k4 << ") " << mul3 << endl;
k1=0,k2=0,k3=0,k4=0;
cout << "Q4: ";
k1+=Q4res[0].first, k2+=Q4res[0].second, k3+=Q4res[1].first, k4+=Q4res[1].second;
cout << "(" << k1 << ", " << k2 << ") (" << k3 << ", " << k4 << ") " << mul4 << endl;
} |
# 2069749, 2024-11-02 11:21:19, xxxxPxPPxP (40%)
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,x,y,checkx=0,checky=0;
cin>>n;
vector<int> q1x,q2x,q3x,q4x,q1y,q2y,q3y,q4y;
pair<int,int> lq1,rq1,lq2,rq2,lq3,rq3,lq4,rq4;
while(n--){
cin>>x>>y;
//check0
if(x==0) checkx++;
if(y==0) checky++;
if(x>0 && y>0){
q1x.push_back(x);
q1y.push_back(y);
}else if(x<0 && y>0){
q2x.push_back(x);
q2y.push_back(y);
}else if(x<0 && y<0){
q3x.push_back(x);
q3y.push_back(y);
}else if(x>0 && y<0){
q4x.push_back(x);
q4y.push_back(y);
}
}
sort(q1x.begin(),q1x.end());
sort(q2x.begin(),q2x.end());
sort(q3x.begin(),q3x.end());
sort(q4x.begin(),q4x.end());
sort(q1y.begin(),q1y.end());
sort(q2y.begin(),q2y.end());
sort(q3y.begin(),q3y.end());
sort(q4y.begin(),q4y.end());
lq1=make_pair(q1x[0],q1y[0]);
rq1=make_pair(q1x[q1x.size()-1],q1y[q1y.size()-1]);
lq2=make_pair(q2x[0],q2y[0]);
rq2=make_pair(q2x[q2x.size()-1],q2y[q2y.size()-1]);
lq3=make_pair(q3x[0],q3y[0]);
rq3=make_pair(q3x[q3x.size()-1],q3y[q3y.size()-1]);
lq4=make_pair(q4x[0],q4y[0]);
rq4=make_pair(q4x[q4x.size()-1],q4y[q4y.size()-1]);
if(checkx == n || checky == n) cout<<"No point in any quadrant";
if(!q1x.empty()){
cout<<"Q1: ("<<lq1.first<<", "<<lq1.second<<") ("<<rq1.first<<", "<<rq1.second<<") "<<
(rq1.first-lq1.first)*(rq1.second-lq1.second)<<endl;
}
if(!q2x.empty()){
cout<<"Q2: ("<<lq2.first<<", "<<lq2.second<<") ("<<rq2.first<<", "<<rq2.second<<") "<<
(rq2.first-lq2.first)*(rq2.second-lq2.second)<<endl;
}
if(!q3x.empty()){
cout<<"Q3: ("<<lq3.first<<", "<<lq3.second<<") ("<<rq3.first<<", "<<rq3.second<<") "<<
(rq3.first-lq3.first)*(rq3.second-lq3.second)<<endl;
}
if(!q4x.empty()){
cout<<"Q4: ("<<lq4.first<<", "<<lq4.second<<") ("<<rq4.first<<", "<<rq4.second<<") "<<
(rq4.first-lq4.first)*(rq4.second-lq4.second)<<endl;
}
} | # 2070507, 2024-11-02 12:10:54, xxxx-x--x- (0%)
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,x,y,checkx=0,checky=0;
cin>>n;
vector<int> q1x={},q2x={},q3x={},q4x={},q1y={},q2y={},q3y={},q4y={};
pair<int,int> lq1,rq1,lq2,rq2,lq3,rq3,lq4,rq4;
for(int i=0;i<n;i++){
cin.ignore();
cin>>x>>y;
if(x==0) checkx++;
if(y==0) checky++;
//cout<<x<<" "<<y;
if(x>0 && y>0){
q1x.push_back(x);
q1y.push_back(y);
}
if(x<0 && y>0){
q2x.push_back(x);
q2y.push_back(y);
}
if(x<0 && y<0){
q3x.push_back(x);
q3y.push_back(y);
}
if(x>0 && y<0){
q4x.push_back(x);
q4y.push_back(y);
}
}
if(checkx==n || checky==n){ cout<<"No point in any quadrant";}
sort(q1x.begin(),q1x.end());
sort(q2x.begin(),q2x.end());
sort(q3x.begin(),q3x.end());
sort(q4x.begin(),q4x.end());
sort(q1y.begin(),q1y.end());
sort(q2y.begin(),q2y.end());
sort(q3y.begin(),q3y.end());
sort(q4y.begin(),q4y.end());
for(auto &a:q2x){
cout<<a<<" ";
}cout<<endl;
lq1=make_pair(q1x[0],q1y[0]);
rq1=make_pair(q1x[q1x.size()-1],q1y[q1y.size()-1]);
lq2=make_pair(q2x[0],q2y[0]);
rq2=make_pair(q2x[q2x.size()-1],q2y[q2y.size()-1]);
lq3=make_pair(q3x[0],q3y[0]);
rq3=make_pair(q3x[q3x.size()-1],q3y[q3y.size()-1]);
lq4=make_pair(q4x[0],q4y[0]);
rq4=make_pair(q4x[q4x.size()-1],q4y[q4y.size()-1]);
if(!q1x.empty() && !q1y.empty() ){
cout<<"Q1: ("<<lq1.first<<", "<<lq1.second<<") ("<<rq1.first<<", "<<rq1.second<<") "<<
(rq1.first-lq1.first)*(rq1.second-lq1.second)<<endl;
}
if(!q2x.empty() && !q2y.empty()){
cout<<"Q2: ("<<lq2.first<<", "<<lq2.second<<") ("<<rq2.first<<", "<<rq2.second<<") "<<
(rq2.first-lq2.first)*(rq2.second-lq2.second)<<endl;
}
if(!q3x.empty() && !q3y.empty()){
cout<<"Q3: ("<<lq3.first<<", "<<lq3.second<<") ("<<rq3.first<<", "<<rq3.second<<") "<<
(rq3.first-lq3.first)*(rq3.second-lq3.second)<<endl;
}
if(!q4x.empty() && !q4y.empty()){
cout<<"Q4: ("<<lq4.first<<", "<<lq4.second<<") ("<<rq4.first<<", "<<rq4.second<<") "<<
(rq4.first-lq4.first)*(rq4.second-lq4.second)<<endl;
}
//if((q1x.empty() && q2x.empty() && q3x.empty() && q4x.empty()) || (q1y.empty() && q2y.empty() && q3y.empty() && q4y.empty()) ){ cout<<"No point in any quadrant";}
} |
# 2071872, 2024-11-02 15:24:18, -P-P-P--P- (40%)
#include <iostream>
#include <set>
#include <map>
#include <cmath>
int main(){
int n ;
std::set<int> xq1 , yq1 , xq2 , xq3 , yq2 , yq3 , xq4 ,yq4;
std::cin >> n;
while(n--){
int x , y;
std::cin >> x >> y;
if(x==0||y==0){
}else{
if(x>0&&y>0){
xq1.insert(x);
yq1.insert(y);
}else if(x<0&&y>0){
xq2.insert(x);
yq2.insert(y);
}else if(x<0 && y<0){
xq3.insert(x);
yq3.insert(y);
}else if(x > 0 && y < 0){
xq4.insert(x);
yq4.insert(y);
}
}
}
// for(auto i : yq1){
// std::cout << i <<std::endl;
// }
// std::cout << *(--yq1.end()) ;
if(xq1.size()<2 && yq1.size()<2 && xq2.size()<2 && xq3.size()<2 && yq2.size()<2 && yq3.size()<2 && xq4.size()<2 &&yq4.size()<2){
std::cout << "No point in any quadrant" ;
}else{
if(xq1.size()>=1||yq1.size()>=1){
std::cout << "Q1: " << "(" <<*xq1.begin() <<", "<< *(--yq1.begin()) << ") ";
std::cout << "(" <<*xq1.end()<<", "<< *(--yq1.end())<< ") ";
std::cout << abs(*(--xq1.end()) - *xq1.begin())*abs(*(--yq1.end()) - *yq1.begin()) << std::endl;
}
if(xq2.size()>=1||yq2.size()>=1){
std::cout << "Q2: " << "(" <<*xq2.begin() <<", "<< *yq2.begin() << ") ";
std::cout << "(" <<*(--xq2.end())<<", "<< *(--yq2.end())<< ") ";
std::cout << abs(*(--xq2.end()) - *xq2.begin())*abs(*(--yq2.end()) - *yq2.begin()) << std::endl;
}
if(xq3.size()>=1||yq3.size()>=1){
std::cout << "Q3: " << "(" <<*xq3.begin() <<", "<< *yq3.begin() << ") ";
std::cout << "(" <<*(--xq3.end())<<", "<< *(--yq3.end())<< ") ";
std::cout << abs(*(--xq3.end()) - *xq3.begin())*abs(*(--yq3.end()) - *yq3.begin()) << std::endl;
}
if(xq4.size()>=1||yq4.size()>=1){
std::cout << "Q4: " << "(" <<*xq4.begin() <<", "<< *yq4.begin() << ") ";
std::cout << "(" <<*(--xq4.end())<<", "<< *(--yq4.end())<< ") ";
std::cout << abs(*(--xq4.end()) - *xq4.begin())*abs(*(--yq4.end()) - *yq4.begin()) << std::endl;
}
}
} |
# 2071539, 2024-11-02 14:46:38, xxxx-x--x- (0%)
#include<iostream>
#include<vector>
using namespace std;
int main(){
int N;
cin>>N;
vector<pair<int,int>> q1;
vector<pair<int,int>> q2;
vector<pair<int,int>> q3;
vector<pair<int,int>> q4;
int x,y;
while(N--){
cin>>x>>y;
if(x>0 && y>0) {
q1.push_back({x,y});
} else if(x>0 && y<0){
q4.push_back({x,y});
} else if(x<0 && y<0){
q3.push_back({x,y});
} else if(x<0 && y>0){
q2.push_back({x,y});
}
}
int area1;
int maxx1=q1[0].first, minx1=q1[0].first, maxy1=q1[0].second, miny1=q1[0].second;
for(auto e : q1){
if(e.first>maxx1) maxx1 = e.first;
if(e.first<minx1) minx1 = e.first;
if(e.second>maxy1) maxy1 = e.second;
if(e.second<miny1) miny1 = e.second;
}
area1 = (maxx1-minx1) * (maxy1-miny1);
//cout<<area1<<endl;
int area2;
int maxx2=q2[0].first, minx2=q2[0].first,maxy2=q2[0].second,miny2=q2[0].second;
for(auto e : q2){
if(abs(e.first)>maxx2) maxx2 = e.first;
if(abs(e.first)<minx2) minx2 = e.first;
if(e.second>maxy2) maxy2 = e.second;
if(e.second<miny2) miny2 = e.second;
}
area2 = (maxx2-minx2) * (maxy2-miny2);
//cout<<abs(area2)<<endl;
int area3;
int maxx3=q3[0].first, minx3=q3[0].first, maxy3=q3[0].second, miny3=q3[0].second;
for(auto e : q3){
if(abs(e.first)>maxx3) maxx3 = e.first;
if(abs(e.first)<minx3) minx3 = e.first;
if(abs(e.second)>maxy3) maxy3 = e.second;
if(abs(e.second)<miny3) miny3 = e.second;
}
area3 = (maxx3-minx3) * (maxy3-miny3);
//cout<<abs(area3)<<endl;
int area4;
int maxx4=q4[0].first,minx4=q4[0].first, maxy4=q4[0].second, miny4=q4[0].second;
for(auto e : q4){
if(e.first>maxx4) maxx4 = e.first;
if(e.first<minx4) minx4 = e.first;
if(e.second<miny4) miny4 = e.second;
if(e.second>maxy4) maxy4 = e.second;
}
cout<<maxx4-minx4<<" "<<maxy4-miny4<<endl;
area4 = (maxx4-minx4) * (maxy4-miny4);
//cout<<abs(area4)<<endl;
if(q1.size()!= 0){
cout<<"Q1: ("<<minx1<<", "<<miny1<<") ("<<maxx1<<", "<<maxy1<<") "<<area1<<endl;
}
if(q2.size()!= 0){
cout<<"Q2: ("<<minx2<<", "<<miny2<<") ("<<maxx2<<", "<<maxy2<<") "<<abs(area2)<<endl;
}
if(q3.size()!= 0){
cout<<"Q3: ("<<minx3<<", "<<miny3<<") ("<<maxx3<<", "<<maxy3<<") "<<area3<<endl;
}
if(q4.size()!= 0){
cout<<"Q4: ("<<minx4<<", "<<miny4<<") ("<<maxx4<<", "<<maxy4<<") "<<area4<<endl;
}
} | # 2071547, 2024-11-02 14:47:44, xxxxPx-Px- (20%)
#include<iostream>
#include<vector>
using namespace std;
int main(){
int N;
cin>>N;
vector<pair<int,int>> q1;
vector<pair<int,int>> q2;
vector<pair<int,int>> q3;
vector<pair<int,int>> q4;
int x,y;
while(N--){
cin>>x>>y;
if(x>0 && y>0) {
q1.push_back({x,y});
} else if(x>0 && y<0){
q4.push_back({x,y});
} else if(x<0 && y<0){
q3.push_back({x,y});
} else if(x<0 && y>0){
q2.push_back({x,y});
}
}
int area1;
int maxx1=q1[0].first, minx1=q1[0].first, maxy1=q1[0].second, miny1=q1[0].second;
for(auto e : q1){
if(e.first>maxx1) maxx1 = e.first;
if(e.first<minx1) minx1 = e.first;
if(e.second>maxy1) maxy1 = e.second;
if(e.second<miny1) miny1 = e.second;
}
area1 = (maxx1-minx1) * (maxy1-miny1);
//cout<<area1<<endl;
int area2;
int maxx2=q2[0].first, minx2=q2[0].first,maxy2=q2[0].second,miny2=q2[0].second;
for(auto e : q2){
if(abs(e.first)>maxx2) maxx2 = e.first;
if(abs(e.first)<minx2) minx2 = e.first;
if(e.second>maxy2) maxy2 = e.second;
if(e.second<miny2) miny2 = e.second;
}
area2 = (maxx2-minx2) * (maxy2-miny2);
//cout<<abs(area2)<<endl;
int area3;
int maxx3=q3[0].first, minx3=q3[0].first, maxy3=q3[0].second, miny3=q3[0].second;
for(auto e : q3){
if(abs(e.first)>maxx3) maxx3 = e.first;
if(abs(e.first)<minx3) minx3 = e.first;
if(abs(e.second)>maxy3) maxy3 = e.second;
if(abs(e.second)<miny3) miny3 = e.second;
}
area3 = (maxx3-minx3) * (maxy3-miny3);
//cout<<abs(area3)<<endl;
int area4;
int maxx4=q4[0].first,minx4=q4[0].first, maxy4=q4[0].second, miny4=q4[0].second;
for(auto e : q4){
if(e.first>maxx4) maxx4 = e.first;
if(e.first<minx4) minx4 = e.first;
if(e.second<miny4) miny4 = e.second;
if(e.second>maxy4) maxy4 = e.second;
}
//cout<<maxx4-minx4<<" "<<maxy4-miny4<<endl;
area4 = (maxx4-minx4) * (maxy4-miny4);
//cout<<abs(area4)<<endl;
if(q1.size()!= 0){
cout<<"Q1: ("<<minx1<<", "<<miny1<<") ("<<maxx1<<", "<<maxy1<<") "<<area1<<endl;
}
if(q2.size()!= 0){
cout<<"Q2: ("<<minx2<<", "<<miny2<<") ("<<maxx2<<", "<<maxy2<<") "<<abs(area2)<<endl;
}
if(q3.size()!= 0){
cout<<"Q3: ("<<minx3<<", "<<miny3<<") ("<<maxx3<<", "<<maxy3<<") "<<area3<<endl;
}
if(q4.size()!= 0){
cout<<"Q4: ("<<minx4<<", "<<miny4<<") ("<<maxx4<<", "<<maxy4<<") "<<area4<<endl;
}
} | # 2071850, 2024-11-02 15:22:42, xxxxPP-Px- (30%)
#include<iostream>
#include<vector>
using namespace std;
int main(){
int N;
cin>>N;
vector<pair<int,int>> q1;
vector<pair<int,int>> q2;
vector<pair<int,int>> q3;
vector<pair<int,int>> q4;
int x,y;
while(N--){
cin>>x>>y;
if(x>0 && y>0) {
q1.push_back({x,y});
} else if(x>0 && y<0){
q4.push_back({x,y});
} else if(x<0 && y<0){
q3.push_back({x,y});
} else if(x<0 && y>0){
q2.push_back({x,y});
}
}
if(q1.size() == 0 && q2.size() == 0 && q3.size() == 0 && q4.size() == 0){
cout<<"No point in any quadrant";
} else {
int area1;
int maxx1=q1[0].first, minx1=q1[0].first, maxy1=q1[0].second, miny1=q1[0].second;
for(auto e : q1){
if(e.first>maxx1) maxx1 = e.first;
if(e.first<minx1) minx1 = e.first;
if(e.second>maxy1) maxy1 = e.second;
if(e.second<miny1) miny1 = e.second;
}
area1 = (maxx1-minx1) * (maxy1-miny1);
//cout<<area1<<endl;
int area2;
int maxx2=q2[0].first, minx2=q2[0].first,maxy2=q2[0].second,miny2=q2[0].second;
for(auto e : q2){
if(abs(e.first)>maxx2) maxx2 = e.first;
if(abs(e.first)<minx2) minx2 = e.first;
if(e.second>maxy2) maxy2 = e.second;
if(e.second<miny2) miny2 = e.second;
}
area2 = (maxx2-minx2) * (maxy2-miny2);
//cout<<abs(area2)<<endl;
int area3;
int maxx3=q3[0].first, minx3=q3[0].first, maxy3=q3[0].second, miny3=q3[0].second;
for(auto e : q3){
if(abs(e.first)>maxx3) maxx3 = e.first;
if(abs(e.first)<minx3) minx3 = e.first;
if(abs(e.second)>maxy3) maxy3 = e.second;
if(abs(e.second)<miny3) miny3 = e.second;
}
area3 = (maxx3-minx3) * (maxy3-miny3);
//cout<<abs(area3)<<endl;
int area4;
int maxx4=q4[0].first,minx4=q4[0].first, maxy4=q4[0].second, miny4=q4[0].second;
for(auto e : q4){
if(e.first>maxx4) maxx4 = e.first;
if(e.first<minx4) minx4 = e.first;
if(e.second<miny4) miny4 = e.second;
if(e.second>maxy4) maxy4 = e.second;
}
//cout<<maxx4-minx4<<" "<<maxy4-miny4<<endl;
area4 = (maxx4-minx4) * (maxy4-miny4);
//cout<<abs(area4)<<endl;
if(q1.size()!= 0){
cout<<"Q1: ("<<minx1<<", "<<miny1<<") ("<<maxx1<<", "<<maxy1<<") "<<area1<<endl;
}
if(q2.size()!= 0){
cout<<"Q2: ("<<minx2<<", "<<miny2<<") ("<<maxx2<<", "<<maxy2<<") "<<abs(area2)<<endl;
}
if(q3.size()!= 0){
cout<<"Q3: ("<<minx3<<", "<<miny3<<") ("<<maxx3<<", "<<maxy3<<") "<<area3<<endl;
}
if(q4.size()!= 0){
cout<<"Q4: ("<<minx4<<", "<<miny4<<") ("<<maxx4<<", "<<maxy4<<") "<<area4<<endl;
}
}
} |
# 2071957, 2024-11-02 15:29:51, PP-xxPxxxx (30%)
#include<iostream>
#include<vector>
#include<cmath>
using namespace std;
int main(){
int n;
cin >> n;
vector<vector<int>> q1;
vector<vector<int>> q2;
vector<vector<int>> q3;
vector<vector<int>> q4;
for (int i = 0; i < n ;i ++){
int x, y;
cin >> x >> y;
if (x != 0 && y != 0){
if (x > 0 && y > 0){
q1.push_back({x,y});
}
else if (x < 0 && y > 0)
{
q2.push_back({x,y});
}
else if (x < 0 && y < 0){
q3.push_back({x,y});
}
else if (x > 0 && y < 0)
{
q3.push_back({x,y});
}
}
}
vector<vector<int>> Q1;
vector<vector<int>> Q2;
vector<vector<int>> Q3;
vector<vector<int>> Q4;
int maxX,minX,maxY,minY = 0;
if (q1.size() > 0){
maxX = q1[0][0];
maxY = q1[0][1];
minX = q1[0][0];
minY = q1[0][1];
for (auto q:q1){
if (q[0] > maxX)
maxX = q[0];
if (q[1] > maxY)
maxY = q[1];
if (q[0] < minX)
minX = q[0];
if (q[1] < minY)
minY = q[1];
}
Q1.push_back({minX,minY});
Q1.push_back({maxX,maxY});
int width = abs(abs(maxX) - abs(minX));
int height = abs(abs(maxY) - abs(minY));
Q1.push_back({width*height});
}
if (q2.size() > 0){
maxX = q2[0][0];
maxY = q2[0][1];
minX = q2[0][0];
minY = q2[0][1];
for (auto q:q2){
if (q[0] > maxX)
maxX = q[0];
if (q[1] > maxY)
maxY = q[1];
if (q[0] < minX)
minX = q[0];
if (q[1] < minY)
minY = q[1];
}
Q2.push_back({minX,minY});
Q2.push_back({maxX,maxY});
int width = abs(abs(maxX) - abs(minX));
int height = abs(abs(maxY) - abs(minY));
Q2.push_back({width*height});
}
if (q3.size() > 0){
maxX = q3[0][0];
maxY = q3[0][1];
minX = q3[0][0];
minY = q3[0][1];
for (auto q:q3){
if (q[0] > maxX)
maxX = q[0];
if (q[1] > maxY)
maxY = q[1];
if (q[0] < minX)
minX = q[0];
if (q[1] < minY)
minY = q[1];
}
Q3.push_back({minX,minY});
Q3.push_back({maxX,maxY});
int width = abs(abs(maxX) - abs(minX));
int height = abs(abs(maxY) - abs(minY));
Q3.push_back({width*height});
}
if (q3.size() > 0){
maxX = q4[0][0];
maxY = q4[0][1];
minX = q4[0][0];
minY = q4[0][1];
for (auto q:q4){
if (q[0] > maxX)
maxX = q[0];
if (q[1] > maxY)
maxY = q[1];
if (q[0] < minX)
minX = q[0];
if (q[1] < minY)
minY = q[1];
}
Q4.push_back({minX,minY});
Q4.push_back({maxX,maxY});
int width = abs(abs(maxX) - abs(minX));
int height = abs(abs(maxY) - abs(minY));
Q4.push_back({width*height});
}
if (q1.size() > 0){
cout << "Q1: (" << Q1[0][0] << ", " << Q1[0][1] << ") (" << Q1[1][0]
<< ", " << Q1[1][1] << ") " << Q1[2][0];
}
if (q2.size() > 0){
cout << "Q2: (" << Q2[0][0] << ", " << Q2[0][1] << ") (" << Q2[1][0]
<< ", " << Q2[1][1] << ") " << Q2[2][0];
}
if (q3.size() > 0){
cout << "Q3: (" << Q3[0][0] << ", " << Q3[0][1] << ") (" << Q3[1][0]
<< ", " << Q3[1][1] << ") " << Q3[2][0];
}
if (q4.size() > 0){
cout << "Q4: (" << Q4[0][0] << ", " << Q4[0][1] << ") (" << Q4[1][0]
<< ", " << Q4[1][1] << ") " << Q4[2][0];
}
if (q1.size() == 0 && q2.size() == 0
&& q3.size() == 0 && q4.size() == 0){
cout << "No point in any quadrant";
}
} |
# 2069253, 2024-11-02 10:31:43, -----P---- (10%)
#include <bits/stdc++.h>
using namespace std;
int main()
{
ios :: sync_with_stdio(0);
cin.tie(0);
int n,x,y;
cin >> n;
set <pair<int,int>> q1,q2,q3,q4;
for(int i= 0 ; i< n ; i++)
{
cin >> x >> y;
if(x == 0 || y == 0)
{
continue;
}
else if(x >= 1 && y >= 1)
{
q1.insert(make_pair(x,y));
}
else if(x <= -1 && y >= 1)
{
q2.insert(make_pair(x,y));
}
else if(x <= -1 && y <= -1)
{
q3.insert(make_pair(x,y));
}
else if(x >= 1 && y <= -1)
{
q4.insert(make_pair(x,y));
}
}
if(q1.empty() && q2.empty() && q3.empty() && q4.empty())
{
cout << "No point in any quadrant";
}
return 0;
} | # 2069721, 2024-11-02 11:18:03, P----P---- (20%)
#include <bits/stdc++.h>
using namespace std;
int main()
{
ios :: sync_with_stdio(0);
cin.tie(0);
int n,x,y;
cin >> n;
set <pair<int,int>> q1,q2,q3,q4;
int mnx1=1000, mny1=1000 ,mxx1=0, mxy1=0;
int mnx2=1000, mny2=1000 ,mxx2=0, mxy2=0;
int mnx3=1000, mny3=1000 ,mxx3=0, mxy3=0;
int mnx4=1000, mny4=1000 ,mxx4=0, mxy4=0;
for(int i= 0 ; i< n ; i++)
{
cin >> x >> y;
if(x == 0 || y == 0)
{
continue;
}
else if(x >= 1 && y >= 1)
{
q1.insert(make_pair(x,y));
if(x < mnx1 && x!=0)
{
mnx1 = x;
}
if(x > mxx1 && x!=0)
{
mxx1 = x;
}
if(y < mny1 && y!=0)
{
mny1 = y;
}
if(y > mxy1 && y!=0)
{
mxy1 = y;
}
}
else if(x <= -1 && x!= 0 && y >= 1 && y != 0)
{
q2.insert(make_pair(x,y));
if(x < mnx2 && x!=0)
{
mnx2 = x;
}
if(x > mxx2 && x!=0)
{
mxx2 = x;
}
if(y < mny2 && y!=0)
{
mny2 = y;
}
if(y > mxy2 && y!=0)
{
mxy2 = y;
}
}
else if(x <= -1 && y <= -1)
{
q3.insert(make_pair(x,y));
if(x < mnx3 && x!=0)
{
mnx3 = x;
}
if(x > mxx3 && x!=0)
{
mxx3 = x;
}
if(y < mny3 && y!=0)
{
mny3 = y;
}
if(y > mxy3 && y!=0)
{
mxy3 = y;
}
}
else if(x >= 1 && y <= -1)
{
q4.insert(make_pair(x,y));
if(x < mnx4 && x!=0)
{
mnx4 = x;
}
if(x > mxx4 && x!=0)
{
mxx4 = x;
}
if(y < mny4 && y!=0)
{
mny4 = y;
}
if(y > mxy4 && y!=0)
{
mxy4 = y;
}
}
}
if(q1.empty() && q2.empty() && q3.empty() && q4.empty())
{
cout << "No point in any quadrant";
}
else
{
if (!q1.empty())
{
cout << "Q1: (" << mnx1 << ", " << mny1 << ") (" << mxx1 << ", " << mxy1 << ") " << (mxx1-mnx1)*(mxy1-mny1) << "\n";
}
if (!q2.empty())
{
cout << "Q2: (" << mnx2 << ", " << mny2 << ") (" << mxx2 << ", " << mxy2 << ") " << (mxx2-mnx2)*(mxy2-mny2) << "\n";
}
if (!q3.empty())
{
cout << "Q3: (" << mnx3 << ", " << mny3 << ") (" << mxx3 << ", " << mxy3 << ") " << (mxx3-mnx3)*(mxy3-mny3) << "\n";
}
if (!q4.empty())
{
cout << "Q4: (" << mnx4 << ", " << mny4 << ") (" << mxx4 << ", " << mxy4 << ") " << (mxx4-mnx4)*(mxy4-mny4) << "\n";
}
}
return 0;
} | # 2069776, 2024-11-02 11:23:35, P----P---- (20%)
#include <bits/stdc++.h>
using namespace std;
int main()
{
ios :: sync_with_stdio(0);
cin.tie(0);
int n,x,y;
cin >> n;
set <pair<int,int>> q1,q2,q3,q4;
int mnx1=1000, mny1=1000 ,mxx1=0, mxy1=0;
int mnx2=1000, mny2=1000 ,mxx2=0, mxy2=0;
int mnx3=1000, mny3=1000 ,mxx3=0, mxy3=0;
int mnx4=1000, mny4=1000 ,mxx4=0, mxy4=0;
for(int i= 0 ; i< n ; i++)
{
cin >> x >> y;
if(x == 0 || y == 0)
{
continue;
}
else if(x >= 1 && y >= 1)
{
q1.insert(make_pair(x,y));
if(x < mnx1 )
{
mnx1 = x;
}
if(x > mxx1 )
{
mxx1 = x;
}
if(y < mny1 )
{
mny1 = y;
}
if(y > mxy1 )
{
mxy1 = y;
}
}
else if(x <= -1 && x!= 0 && y >= 1 && y != 0)
{
q2.insert(make_pair(x,y));
if(x < mnx2 )
{
mnx2 = x;
}
if(x > mxx2 )
{
mxx2 = x;
}
if(y < mny2 )
{
mny2 = y;
}
if(y > mxy2 )
{
mxy2 = y;
}
}
else if(x <= -1 && y <= -1)
{
q3.insert(make_pair(x,y));
if(x < mnx3)
{
mnx3 = x;
}
if(x > mxx3)
{
mxx3 = x;
}
if(y < mny3 )
{
mny3 = y;
}
if(y > mxy3 )
{
mxy3 = y;
}
}
else if(x >= 1 && y <= -1)
{
q4.insert(make_pair(x,y));
if(x < mnx4 )
{
mnx4 = x;
}
if(x > mxx4 )
{
mxx4 = x;
}
if(y < mny4 )
{
mny4 = y;
}
if(y > mxy4 )
{
mxy4 = y;
}
}
}
if(q1.empty() && q2.empty() && q3.empty() && q4.empty())
{
cout << "No point in any quadrant";
}
else
{
if (!q1.empty())
{
cout << "Q1: (" << mnx1 << ", " << mny1 << ") (" << mxx1 << ", " << mxy1 << ") " << (mxx1-mnx1)*(mxy1-mny1) << "\n";
}
else if (q1.size() == 1)
{
cout << "Q1: (" << mnx1 << ", " << mny1 << ") (" << mnx1 << ", " << mny1 << ") 0" <<"\n";
}
if (!q2.empty())
{
cout << "Q2: (" << mnx2 << ", " << mny2 << ") (" << mxx2 << ", " << mxy2 << ") " << (mxx2-mnx2)*(mxy2-mny2) << "\n";
}
else if (q2.size() == 1)
{
cout << "Q2: (" << mnx2 << ", " << mny2 << ") (" << mnx2 << ", " << mny2 << ") 0" <<"\n";
}
if (!q3.empty())
{
cout << "Q3: (" << mnx3 << ", " << mny3 << ") (" << mxx3 << ", " << mxy3 << ") " << (mxx3-mnx3)*(mxy3-mny3) << "\n";
}
else if (q3.size() == 1)
{
cout << "Q3: (" << mnx3 << ", " << mny3 << ") (" << mnx3 << ", " << mny3 << ") 0" <<"\n";
}
if (!q4.empty())
{
cout << "Q4: (" << mnx4 << ", " << mny4 << ") (" << mxx4 << ", " << mxy4 << ") " << (mxx4-mnx4)*(mxy4-mny4) << "\n";
}
else if (q3.size() == 1)
{
cout << "Q4: (" << mnx4 << ", " << mny4 << ") (" << mnx4 << ", " << mny4 << ") 0" <<"\n";
}
}
return 0;
} | # 2069860, 2024-11-02 11:30:47, -----P---- (10%)
#include <bits/stdc++.h>
using namespace std;
int main()
{
ios ::sync_with_stdio(0);
cin.tie(0);
int n, x, y;
cin >> n;
set<pair<int, int>> q1, q2, q3, q4;
for (int i = 0; i < n; i++)
{
cin >> x >> y;
if (x == 0 || y == 0)
{
continue;
}
else if (x >= 1 && y >= 1)
{
q1.insert(make_pair(x, y));
}
else if (x <= -1 && y >= 1)
{
q2.insert(make_pair(x, y));
}
else if (x <= -1 && y <= -1)
{
q3.insert(make_pair(x, y));
}
else if (x >= 1 && y <= -1)
{
q4.insert(make_pair(x, y));
}
}
if (q1.empty() && q2.empty() && q3.empty() && q4.empty())
{
cout << "No point in any quadrant";
}
else
{
int mnx1 = 1000, mny1 = 1000, mxx1 = 0, mxy1 = 0;
int mnx2 = 1000, mny2 = 1000, mxx2 = 0, mxy2 = 0;
int mnx3 = 1000, mny3 = 1000, mxx3 = 0, mxy3 = 0;
int mnx4 = 1000, mny4 = 1000, mxx4 = 0, mxy4 = 0;
for (auto a : q1)
{
if (a.first > mxx1)
{
mxx1 = a.first;
}
if (a.second > mxy1)
{
mxy1 = a.second;
}
if (a.first < mnx1)
{
mxx1 = a.first;
}
if (a.second < mny1)
{
mxy1 = a.second;
}
}
for (auto a : q2)
{
if (a.first > mxx2)
{
mxx2 = a.first;
}
if (a.second > mxy2)
{
mxy2 = a.second;
}
if (a.first < mnx2)
{
mxx2 = a.first;
}
if (a.second < mny2)
{
mxy2 = a.second;
}
}
for (auto a : q3)
{
if (a.first > mxx3)
{
mxx3 = a.first;
}
if (a.second > mxy3)
{
mxy3 = a.second;
}
if (a.first < mnx3)
{
mxx3 = a.first;
}
if (a.second < mny3)
{
mxy3 = a.second;
}
}
for (auto a : q4)
{
if (a.first > mxx4)
{
mxx4 = a.first;
}
if (a.second > mxy4)
{
mxy4 = a.second;
}
if (a.first < mnx4)
{
mxx3 = a.first;
}
if (a.second < mny4)
{
mxy4 = a.second;
}
}
if (!q1.empty())
{
cout << "Q1: (" << mnx1 << ", " << mny1 << ") (" << mxx1 << ", " << mxy1 << ") " << (mxx1-mnx1)*(mxy1-mny1) << "\n";
}
else if (q1.size() == 1)
{
cout << "Q1: (" << mnx1 << ", " << mny1 << ") (" << mnx1 << ", " << mny1 << ") 0" <<"\n";
}
if (!q2.empty())
{
cout << "Q2: (" << mnx2 << ", " << mny2 << ") (" << mxx2 << ", " << mxy2 << ") " << (mxx2-mnx2)*(mxy2-mny2) << "\n";
}
else if (q2.size() == 1)
{
cout << "Q2: (" << mnx2 << ", " << mny2 << ") (" << mnx2 << ", " << mny2 << ") 0" <<"\n";
}
if (!q3.empty())
{
cout << "Q3: (" << mnx3 << ", " << mny3 << ") (" << mxx3 << ", " << mxy3 << ") " << (mxx3-mnx3)*(mxy3-mny3) << "\n";
}
else if (q3.size() == 1)
{
cout << "Q3: (" << mnx3 << ", " << mny3 << ") (" << mnx3 << ", " << mny3 << ") 0" <<"\n";
}
if (!q4.empty())
{
cout << "Q4: (" << mnx4 << ", " << mny4 << ") (" << mxx4 << ", " << mxy4 << ") " << (mxx4-mnx4)*(mxy4-mny4) << "\n";
}
else if (q3.size() == 1)
{
cout << "Q4: (" << mnx4 << ", " << mny4 << ") (" << mnx4 << ", " << mny4 << ") 0" <<"\n";
}
}
return 0;
}
int mnx1, mny1, mxx1, mxy1; | # 2069874, 2024-11-02 11:31:31, P----P---- (20%)
#include <bits/stdc++.h>
using namespace std;
int main()
{
ios :: sync_with_stdio(0);
cin.tie(0);
int n,x,y;
cin >> n;
set <pair<int,int>> q1,q2,q3,q4;
int mnx1=1000, mny1=1000 ,mxx1=0, mxy1=0;
int mnx2=1000, mny2=1000 ,mxx2=0, mxy2=0;
int mnx3=1000, mny3=1000 ,mxx3=0, mxy3=0;
int mnx4=1000, mny4=1000 ,mxx4=0, mxy4=0;
for(int i= 0 ; i< n ; i++)
{
cin >> x >> y;
if(x == 0 || y == 0)
{
continue;
}
else if(x >= 1 && y >= 1)
{
q1.insert(make_pair(x,y));
if(x < mnx1 )
{
mnx1 = x;
}
if(x > mxx1 )
{
mxx1 = x;
}
if(y < mny1 )
{
mny1 = y;
}
if(y > mxy1 )
{
mxy1 = y;
}
}
else if(x <= -1 && x!= 0 && y >= 1 && y != 0)
{
q2.insert(make_pair(x,y));
if(x < mnx2 )
{
mnx2 = x;
}
if(x > mxx2 )
{
mxx2 = x;
}
if(y < mny2 )
{
mny2 = y;
}
if(y > mxy2 )
{
mxy2 = y;
}
}
else if(x <= -1 && y <= -1)
{
q3.insert(make_pair(x,y));
if(x < mnx3)
{
mnx3 = x;
}
if(x > mxx3)
{
mxx3 = x;
}
if(y < mny3 )
{
mny3 = y;
}
if(y > mxy3 )
{
mxy3 = y;
}
}
else if(x >= 1 && y <= -1)
{
q4.insert(make_pair(x,y));
if(x < mnx4 )
{
mnx4 = x;
}
if(x > mxx4 )
{
mxx4 = x;
}
if(y < mny4 )
{
mny4 = y;
}
if(y > mxy4 )
{
mxy4 = y;
}
}
}
if(q1.empty() && q2.empty() && q3.empty() && q4.empty())
{
cout << "No point in any quadrant";
}
else
{
if (!q1.empty())
{
cout << "Q1: (" << mnx1 << ", " << mny1 << ") (" << mxx1 << ", " << mxy1 << ") " << (mxx1-mnx1)*(mxy1-mny1) << "\n";
}
else if (q1.size() == 1)
{
cout << "Q1: (" << mnx1 << ", " << mny1 << ") (" << mnx1 << ", " << mny1 << ") 0" <<"\n";
}
if (!q2.empty())
{
cout << "Q2: (" << mnx2 << ", " << mny2 << ") (" << mxx2 << ", " << mxy2 << ") " << (mxx2-mnx2)*(mxy2-mny2) << "\n";
}
else if (q2.size() == 1)
{
cout << "Q2: (" << mnx2 << ", " << mny2 << ") (" << mnx2 << ", " << mny2 << ") 0" <<"\n";
}
if (!q3.empty())
{
cout << "Q3: (" << mnx3 << ", " << mny3 << ") (" << mxx3 << ", " << mxy3 << ") " << (mxx3-mnx3)*(mxy3-mny3) << "\n";
}
else if (q3.size() == 1)
{
cout << "Q3: (" << mnx3 << ", " << mny3 << ") (" << mnx3 << ", " << mny3 << ") 0" <<"\n";
}
if (!q4.empty())
{
cout << "Q4: (" << mnx4 << ", " << mny4 << ") (" << mxx4 << ", " << mxy4 << ") " << (mxx4-mnx4)*(mxy4-mny4) << "\n";
}
else if (q3.size() == 1)
{
cout << "Q4: (" << mnx4 << ", " << mny4 << ") (" << mnx4 << ", " << mny4 << ") 0" <<"\n";
}
}
return 0;
} |
# 2069496, 2024-11-02 10:52:27, -----P---- (10%)
#include<bits/stdc++.h>
using namespace std ;
int main(){
int n ; cin>>n ;
int x,y ;
vector<pair<int,int>> Q1 ;
vector<pair<int,int>> Q2 ;
vector<pair<int,int>> Q3 ;
vector<pair<int,int>> Q4 ;
while(n--){
cin>>x>>y ;
if(x == 0 || y == 0) continue;
if(x>0 && y>0){
Q1.push_back(make_pair(x,y)) ;
}
else if(x<0 && y>0){
Q2.push_back(make_pair(x,y)) ;
}
else if(x<0 && y<0){
Q3.push_back(make_pair(x,y)) ;
}
else if(x>0 && y<0){
Q4.push_back(make_pair(x,y)) ;
}
}
if(Q1.empty() && Q2.empty() &&Q3.empty() && Q4.empty()){
cout<<"No point in any quadrant" ;
return 0 ;
}
} | # 2069723, 2024-11-02 11:18:23, -----P---- (10%)
#include<bits/stdc++.h>
using namespace std ;
pair<int,int> find_most(vector<pair<int,int>> &v , pair<int,int> point){
pair<int,int> res ;
int x = point.first , y = point.second ;
for(auto &p : v){
if(p.first>x && p.second>y){
x = p.first ;
y = p.second ;
}
else if(p.first == x && p.second>y){
y = p.second ;
}
else if(p.first > x && p.second==y){
x = p.first ;
}
}
res = make_pair(x,y) ;
return res ;
}
pair<int,int> find_min(vector<pair<int,int>> &v , pair<int,int> point){
pair<int,int> res ;
int x = point.first , y = point.second ;
for(auto &p : v){
if(p.first<x && p.second<y){
x = p.first ;
y = p.second ;
}
else if(p.first == x && p.second<y){
y = p.second ;
}
else if(p.first < x && p.second==y){
x = p.first ;
}
}
res = make_pair(x,y) ;
return res ;
}
int main(){
int n ; cin>>n ;
int x,y ;
vector<pair<int,int>> Q1 ;
vector<pair<int,int>> Q2 ;
vector<pair<int,int>> Q3 ;
vector<pair<int,int>> Q4 ;
pair<int,int> max1 , min1 , max2 ,min2 , max3 ,min3 ,max4,min4 ;
bool firsttime1 = true ;
bool firsttime2 = true ;
bool firsttime3 = true ;
bool firsttime4 = true ;
while(n--){
cin>>x>>y ;
if(x == 0 || y == 0) continue;
if(x>0 && y>0){
Q1.push_back(make_pair(x,y)) ;
if(firsttime1){
max1 = make_pair(x,y) ;
min1 = make_pair(x,y) ;
firsttime1 = false ;
}
max1 = find_most(Q1,max1) ;
min1 = find_min(Q1,min1) ;
}
else if(x<0 && y>0){
Q2.push_back(make_pair(x,y)) ;
if(firsttime2){
max2 = make_pair(x,y) ;
min2 = make_pair(x,y) ;
firsttime2 = false ;
}
max2 = find_most(Q1,max2) ;
min2 = find_min(Q1,min2) ;
}
else if(x<0 && y<0){
Q3.push_back(make_pair(x,y)) ;
if(firsttime3){
max3 = make_pair(x,y) ;
min3 = make_pair(x,y) ;
firsttime3 = false ;
}
max3 = find_most(Q1,max3) ;
min3 = find_min(Q1,min3) ;
}
else if(x>0 && y<0){
Q4.push_back(make_pair(x,y)) ;
if(firsttime4){
max4 = make_pair(x,y) ;
min4 = make_pair(x,y) ;
firsttime4 = false ;
}
max4 = find_most(Q1,max4) ;
min4 = find_min(Q1,min4) ;
}
}
if(Q1.empty() && Q2.empty() &&Q3.empty() && Q4.empty()){
cout<<"No point in any quadrant" ;
return 0 ;
}
int A1 = abs((max1.first - min1.first) * (max1.second - min1.second)) ;
int A2 = abs((max2.first - min2.first) * (max2.second - min2.second)) ;
int A3 = abs((max3.first - min3.first) * (max3.second - min3.second)) ;
int A4 = abs((max4.first - min4.first) * (max4.second - min4.second)) ;
cout<<"Q1: ("<<min1.first<<", "<<min1.second<<") ("<<max1.first<<", "<<max1.second<<") "<<A1;
cout<<"Q2: ("<<min2.first<<", "<<min2.second<<") ("<<max2.first<<", "<<max2.second<<") "<<A2;
cout<<"Q3: ("<<min3.first<<", "<<min3.second<<") ("<<max3.first<<", "<<max3.second<<") "<<A3;
cout<<"Q4: ("<<min4.first<<", "<<min4.second<<") ("<<max4.first<<", "<<max4.second<<") "<<A4;
return 0 ;
} | # 2069764, 2024-11-02 11:22:39, ----PP---- (20%)
#include<bits/stdc++.h>
using namespace std ;
pair<int,int> find_most(vector<pair<int,int>> &v , pair<int,int> point){
pair<int,int> res ;
int x = point.first , y = point.second ;
for(auto &p : v){
if(p.first>x && p.second>y){
x = p.first ;
y = p.second ;
}
else if(p.first == x && p.second>y){
y = p.second ;
}
else if(p.first > x && p.second==y){
x = p.first ;
}
}
res = make_pair(x,y) ;
return res ;
}
pair<int,int> find_min(vector<pair<int,int>> &v , pair<int,int> point){
pair<int,int> res ;
int x = point.first , y = point.second ;
for(auto &p : v){
if(p.first<x && p.second<y){
x = p.first ;
y = p.second ;
}
else if(p.first == x && p.second<y){
y = p.second ;
}
else if(p.first < x && p.second==y){
x = p.first ;
}
}
res = make_pair(x,y) ;
return res ;
}
int main(){
int n ; cin>>n ;
int x,y ;
vector<pair<int,int>> Q1 ;
vector<pair<int,int>> Q2 ;
vector<pair<int,int>> Q3 ;
vector<pair<int,int>> Q4 ;
pair<int,int> max1 , min1 , max2 ,min2 , max3 ,min3 ,max4,min4 ;
bool firsttime1 = true ;
bool firsttime2 = true ;
bool firsttime3 = true ;
bool firsttime4 = true ;
while(n--){
cin>>x>>y ;
if(x == 0 || y == 0) continue;
if(x>0 && y>0){
Q1.push_back(make_pair(x,y)) ;
if(firsttime1){
max1 = make_pair(x,y) ;
min1 = make_pair(x,y) ;
firsttime1 = false ;
}
max1 = find_most(Q1,max1) ;
min1 = find_min(Q1,min1) ;
}
if(x<0 && y>0){
Q2.push_back(make_pair(x,y)) ;
if(firsttime2){
max2 = make_pair(x,y) ;
min2 = make_pair(x,y) ;
firsttime2 = false ;
}
max2 = find_most(Q1,max2) ;
min2 = find_min(Q1,min2) ;
}
if(x<0 && y<0){
Q3.push_back(make_pair(x,y)) ;
if(firsttime3){
max3 = make_pair(x,y) ;
min3 = make_pair(x,y) ;
firsttime3 = false ;
}
max3 = find_most(Q1,max3) ;
min3 = find_min(Q1,min3) ;
}
if(x>0 && y<0){
Q4.push_back(make_pair(x,y)) ;
if(firsttime4){
max4 = make_pair(x,y) ;
min4 = make_pair(x,y) ;
firsttime4 = false ;
}
max4 = find_most(Q1,max4) ;
min4 = find_min(Q1,min4) ;
}
}
if(Q1.empty() && Q2.empty() &&Q3.empty() && Q4.empty()){
cout<<"No point in any quadrant" ;
return 0 ;
}
int A1 = abs((max1.first - min1.first) * (max1.second - min1.second)) ;
int A2 = abs((max2.first - min2.first) * (max2.second - min2.second)) ;
int A3 = abs((max3.first - min3.first) * (max3.second - min3.second)) ;
int A4 = abs((max4.first - min4.first) * (max4.second - min4.second)) ;
if(Q1.size() != 0){
cout<<"Q1: ("<<min1.first<<", "<<min1.second<<") ("<<max1.first<<", "<<max1.second<<") "<<A1<<endl;
}
if(Q2.size() != 0){
cout<<"Q2: ("<<min2.first<<", "<<min2.second<<") ("<<max2.first<<", "<<max2.second<<") "<<A2<<endl;
}
if(Q3.size() != 0){
cout<<"Q3: ("<<min3.first<<", "<<min3.second<<") ("<<max3.first<<", "<<max3.second<<") "<<A3<<endl;
}
if(Q4.size() != 0){
cout<<"Q4: ("<<min4.first<<", "<<min4.second<<") ("<<max4.first<<", "<<max4.second<<") "<<A4<<endl;
}
return 0 ;
} | # 2070074, 2024-11-02 11:49:20, ----PP---- (20%)
#include<bits/stdc++.h>
using namespace std ;
pair<int,int> find_most(vector<pair<int,int>> &v , pair<int,int> point){
pair<int,int> res = point ;
int x = point.first , y = point.second ;
for(auto &p : v){
if(p.first>x && p.second>y){
x = p.first ;
y = p.second ;
}
else if(p.first == x && p.second>y){
y = p.second ;
}
else if(p.first > x && p.second==y){
x = p.first ;
}
}
res = make_pair(x,y) ;
return res ;
}
pair<int,int> find_min(vector<pair<int,int>> &v , pair<int,int> point){
pair<int,int> res = point ;
int x = point.first , y = point.second ;
for(auto &p : v){
if(p.first<x && p.second<y){
x = p.first ;
y = p.second ;
}
else if(p.first == x && p.second<y){
y = p.second ;
}
else if(p.first < x && p.second==y){
x = p.first ;
}
}
res = make_pair(x,y) ;
return res ;
}
int main(){
int n ; cin>>n ;
int x,y ;
vector<pair<int,int>> Q1 ;
vector<pair<int,int>> Q2 ;
vector<pair<int,int>> Q3 ;
vector<pair<int,int>> Q4 ;
pair<int,int> max1 , min1 , max2 ,min2 , max3 ,min3 ,max4,min4 ;
bool firsttime1 = true ;
bool firsttime2 = true ;
bool firsttime3 = true ;
bool firsttime4 = true ;
while(n--){
cin>>x>>y ;
if(x == 0 || y == 0) continue;
if(x>0 && y>0){
Q1.push_back(make_pair(x,y)) ;
if(firsttime1){
max1 = make_pair(x,y) ;
min1 = make_pair(x,y) ;
firsttime1 = false ;
}
max1 = find_most(Q1,max1) ;
min1 = find_min(Q1,min1) ;
}
if(x<0 && y>0){
Q2.push_back(make_pair(x,y)) ;
if(firsttime2){
max2 = make_pair(x,y) ;
min2 = make_pair(x,y) ;
firsttime2 = false ;
}
max2 = find_most(Q1,max2) ;
min2 = find_min(Q1,min2) ;
}
if(x<0 && y<0){
Q3.push_back(make_pair(x,y)) ;
if(firsttime3){
max3 = make_pair(x,y) ;
min3 = make_pair(x,y) ;
firsttime3 = false ;
}
max3 = find_most(Q1,max3) ;
min3 = find_min(Q1,min3) ;
}
if(x>0 && y<0){
Q4.push_back(make_pair(x,y)) ;
if(firsttime4){
max4 = make_pair(x,y) ;
min4 = make_pair(x,y) ;
firsttime4 = false ;
}
max4 = find_most(Q1,max4) ;
min4 = find_min(Q1,min4) ;
}
}
if(Q1.empty() && Q2.empty() &&Q3.empty() && Q4.empty()){
cout<<"No point in any quadrant" ;
return 0 ;
}
int A1 = abs((max1.first - min1.first) * (max1.second - min1.second)) ;
int A2 = abs((max2.first - min2.first) * (max2.second - min2.second)) ;
int A3 = abs((max3.first - min3.first) * (max3.second - min3.second)) ;
int A4 = abs((max4.first - min4.first) * (max4.second - min4.second)) ;
if(Q1.size() != 0){
cout<<"Q1: ("<<min1.first<<", "<<min1.second<<") ("<<max1.first<<", "<<max1.second<<") "<<A1<<endl;
}
if(Q2.size() != 0){
cout<<"Q2: ("<<min2.first<<", "<<min2.second<<") ("<<max2.first<<", "<<max2.second<<") "<<A2<<endl;
}
if(Q3.size() != 0){
cout<<"Q3: ("<<min3.first<<", "<<min3.second<<") ("<<max3.first<<", "<<max3.second<<") "<<A3<<endl;
}
if(Q4.size() != 0){
cout<<"Q4: ("<<min4.first<<", "<<min4.second<<") ("<<max4.first<<", "<<max4.second<<") "<<A4<<endl;
}
return 0 ;
} | # 2070496, 2024-11-02 12:10:41, xxxx-P--x- (10%)
#include<bits/stdc++.h>
using namespace std ;
vector<tuple<double,int,int>> find_sed(vector<pair<int,int>> &a){
vector<tuple<double,int,int>> res ;
for(auto &e : a){
double c = 0 ;
c = sqrt(e.first*e.first + e.second*e.second) ;
res.push_back(make_tuple(c,e.first,e.second)) ;
}
return res ;
}
int main(){
int n ; cin>>n ;
int x,y ;
vector<pair<int,int>> q1 ;
vector<pair<int,int>> q2 ;
vector<pair<int,int>> q3 ;
vector<pair<int,int>> q4 ;
while(n--){
cin>>x>>y ;
if(x==0 || y==0) continue;
if(x>0 && y>0){
q1.push_back(make_pair(x,y)) ;
}
if(x<0 && y>0){
q2.push_back(make_pair(x,y)) ;
}
if(x<0 && y<0){
q3.push_back(make_pair(x,y)) ;
}
else{
q4.push_back(make_pair(x,y)) ;
}
}
if(q1.empty() && q2.empty() &&q3.empty() && q4.empty()){
cout<<"No point in any quadrant" ;
return 0 ;
}
vector<tuple<double,int,int>> nq1 = find_sed(q1) ;
vector<tuple<double,int,int>> nq2 = find_sed(q2) ;
vector<tuple<double,int,int>> nq3 = find_sed(q3) ;
vector<tuple<double,int,int>> nq4 = find_sed(q4) ;
sort(nq1.begin(),nq1.end()) ;
sort(nq2.begin(),nq2.end()) ;
sort(nq3.begin(),nq3.end()) ;
sort(nq4.begin(),nq4.end()) ;
tuple<double,int,int> min1 = nq1[0] ;
tuple<double,int,int> max1 = nq1[nq1.size()-1] ;
tuple<double,int,int> min2 = nq2[0] ;
tuple<double,int,int> max2 = nq2[nq2.size()-1] ;
tuple<double,int,int> min3 = nq3[0] ;
tuple<double,int,int> max3 = nq3[nq3.size()-1] ;
tuple<double,int,int> min4 = nq4[0] ;
tuple<double,int,int> max4 = nq4[nq4.size()-1] ;
int A1 = (get<1>(max1) - get<1>(min1)) * (get<2>(max1) - get<2>(min1)) ;
int A2 = (get<1>(max2) - get<1>(min2)) * (get<2>(max2) - get<2>(min2)) ;
int A3 = (get<1>(max3) - get<1>(min3)) * (get<2>(max3) - get<2>(min3)) ;
int A4 = (get<1>(max4) - get<1>(min4)) * (get<2>(max4) - get<2>(min4)) ;
if(q1.size() != 0){
cout<<"Q1: ("<<get<1>(min1)<<", "<<get<2>(min1)<<") ("<<get<1>(max1)<<", "<<get<2>(max1)<<") "<<A1<<endl;
}
if(q2.size() != 0){
cout<<"Q2: ("<<get<1>(min2)<<", "<<get<2>(min2)<<") ("<<get<1>(max2)<<", "<<get<2>(max2)<<") "<<A2<<endl;
}
if(q3.size() != 0){
cout<<"Q3: ("<<get<1>(min3)<<", "<<get<2>(min3)<<") ("<<get<1>(max3)<<", "<<get<2>(max3)<<") "<<A3<<endl;
}
if(q4.size() != 0){
cout<<"Q4: ("<<get<1>(min4)<<", "<<get<2>(min4)<<") ("<<get<1>(max4)<<", "<<get<2>(max4)<<") "<<A4<<endl;
}
return 0 ;
} |
# 2071333, 2024-11-02 14:23:53, ---------- (0%)
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
bool cmp(tuple<ll,ll,string> & a,tuple<ll,ll,string> &b){
if(get<0>(a) == get<0>(b)){
if(get<1>(a) == get<1>(b))return get<2>(a) < get<2>(b);
return get<1>(a) < get<1>(b);
}
return get<0>(a) > get<0>(b);
}
int main(){
ll n;
cin >> n;
map<string,map<string,pair<ll,bool>>> ttq;
vector<tuple<ll,ll,string>> list;
while (n--){
ll minute;
string name,result,quiz;
cin >> minute >> name >> quiz >> result;
if(ttq[name][name+quiz].second == false){
if(result == "T"){
ttq[name][name+quiz].first *=20;
ttq[name][name+quiz].first +=minute;
ttq[name][name+quiz].second = true;
}
else{
ttq[name][name+quiz].first++;
}
}
}
for(auto &e:ttq){
ll corect = 0,pe = 0;
for (auto &i:e.second){
if(i.second.second){
corect++;
pe +=i.second.first;
}
}
list.push_back(make_tuple(corect,pe,e.first));
}
sort(list.begin(),list.end(),cmp);
int m = 3;
for (auto &i: list){
cout << get<2>(i) << " " << get<0>(i) << " " << get<1>(i) << endl;
m--;
if(m == 0)break;
}
} | # 2071591, 2024-11-02 14:52:33, -----P---- (10%)
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
ll n;
cin >> n;
while (n--){
ll a,b;
cin >> a >> b;
}
cout<< "No point in any quadrant";
} | # 2071680, 2024-11-02 15:03:20, -----P---- (10%)
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
ll n;
cin >> n;
set<pair<ll,ll>> Q2,Q1,Q3,Q4;
ll q2x = 0,q2y = 0;
ll q1x = 0,q1y = 0;
ll q3x = 0,q3y = 0;
ll q4x = 0,q4y = 0;
while (n--){
ll x,y;
cin >> x >> y;
if(x != 0 && y !=0){
if(x < 0 && y > 0){
q2x = min(x,q2x);
q2y = max(y,q2y);
Q2.insert(make_pair(x,y));
}
if(x > 0 && y > 0){
q1x = max(x,q1x);
q1y = max(y,q1y);
Q1.insert(make_pair(x,y));
}
if(x < 0 && y < 0){
q3x = min(x,q3x);
q3y = min(y,q3y);
Q3.insert(make_pair(x,y));
}
if(x > 0 && y < 0){
q4x = max(x,q4x);
q4y = min(y,q4y);
Q4.insert(make_pair(x,y));
}
}
}
if(q2x == 0 && q2y == 0 && q1x == 0 && q1y == 0 && q3x == 0 && q3y == 0 && q4x == 0 && q4y == 0){
cout<< "No point in any quadrant";
}
else{
}
} | # 2071990, 2024-11-02 15:31:28, ----PP---- (20%)
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
ll n;
cin >> n;
// set<pair<ll,ll>> Q2,Q1,Q3,Q4;
ll q2x = 0,q2y = 0;
ll q1x = 0,q1y = 0;
ll q3x = 0,q3y = 0;
ll q4x = 0,q4y = 0;
pair<ll,ll> Q2 = {LONG_LONG_MIN,LONG_LONG_MAX} ,Q1 = {LONG_LONG_MAX,LONG_LONG_MAX},Q3 = {LONG_LONG_MIN,LONG_LONG_MIN},Q4 = {LONG_LONG_MAX,LONG_LONG_MIN};
while (n--){
ll x,y;
cin >> x >> y;
if(x != 0 && y !=0){
if(x < 0 && y > 0){
q2x = min(x,q2x);
q2y = max(y,q2y);
if(x >= Q2.first && y <= Q2.second){
Q2.first = x;
Q2.second = y;
}
}
if(x > 0 && y > 0){
q1x = max(x,q1x);
q1y = max(y,q1y);
if(x <= Q1.first && y <= Q1.second){
Q1.first = x;
Q1.second = y;
}
}
if(x < 0 && y < 0){
q3x = min(x,q3x);
q3y = min(y,q3y);
if(x >= Q3.first && y >= Q3.second){
Q3.first = x;
Q3.second = y;
}
}
if(x > 0 && y < 0){
q4x = max(x,q4x);
q4y = min(y,q4y);
if(x <= Q4.first && y >= Q4.second){
Q4.first = x;
Q4.second = y;
}
}
}
}
if(q2x == 0 && q2y == 0 && q1x == 0 && q1y == 0 && q3x == 0 && q3y == 0 && q4x == 0 && q4y == 0){
cout<< "No point in any quadrant";
}
else{
if(q1x != 0 && q1y != 0){
cout << "Q1: (" << Q1.first << ", " << Q1.second << ") (" << q1x <<", " << q1y << ") ";
cout << abs(Q1.first-q1x)*abs(Q1.second-q1y) << endl;
}
if(q2x != 0 && q2y != 0){
cout << "Q2: (" << Q2.first << ", " << Q2.second << ") (" << q2x <<", " << q2y << ") ";
cout << abs(abs(Q2.first)-abs(q2x))*abs(abs(Q2.second)-abs(q2y)) << endl;
}
if(q3x != 0 && q3y != 0){
cout << "Q3: (" << Q3.first << ", " << Q3.second << ") (" << q3x <<", " << q3y << ") ";
cout << abs(abs(Q3.first)-abs(q3x))*abs(abs(Q3.second)-abs(q3y)) << endl;
}
if(q4x != 0 && q4y != 0){
cout << "Q4: (" << Q4.first << ", " << Q4.second << ") (" << q4x <<", " << q4y << ") ";
cout << abs(abs(Q4.first)-abs(q4x))*abs(abs(Q4.second)-abs(q4y)) << endl;
}
}
} |
# 2071383, 2024-11-02 14:29:46, ----PP---- (20%)
#include<iostream>
#include<map>
#include<vector>
using namespace std;
int main() {
map<string,vector<pair<int,int>>> total;
int x,y,n;
int xmin,ymin,xmax,ymax;
//set<pair<int,int>> point;
cin>>n;
while(n--){
cin>>x>>y;
if(x>0 &&y>0) {
total["Q1"]=vector<pair<int,int>>();
total["Q1"].push_back(make_pair(x,y));
}
if(x<0 &&y>0) {
total["Q2"]=vector<pair<int,int>>();
total["Q2"].push_back(make_pair(x,y));
}
if(x<0 &&y<0) {
total["Q3"]=vector<pair<int,int>>();
total["Q3"].push_back(make_pair(x,y));
}
if(x>0 &&y<0) {
total["Q4"]=vector<pair<int,int>>();
total["Q4"].push_back(make_pair(x,y));
}
}
vector<pair<int,int>> min,max;
vector<int> pt ;
for(auto c:total) {
xmin = (c.second)[0].first;
xmax=xmin;
ymin = (c.second)[0].second;
ymax=ymin;
for(auto s: c.second){
if(s.first>xmax) xmax==s.first;
if(s.first<xmin) xmin==s.first;
if(s.second>ymax) ymax==s.second;
if(s.second<ymin) ymin==s.second;
}
int tx=xmax-xmin;
int ty=ymax-ymin;
pt.push_back(tx*ty);
min.push_back(make_pair(xmin,ymin));
max.push_back(make_pair(xmax,ymax));
}
auto itr=total.begin();
for(int i=0; i<min.size() && itr!=total.end();i++){
cout<<(*itr).first<<": ("<<min[i].first<<", "<<min[i].second<<") ";
cout<<"("<<max[i].first<<", "<<max[i].second<<") ";
cout<<pt[i];
itr++;
cout<<endl;
}
if(total["Q1"].size()==0 && total["Q2"].size()==0 && total["Q3"].size()==0 && total["Q4"].size()==0){
cout<<"No point in any quadrant";
}
} | # 2071986, 2024-11-02 15:31:21, -x-x-x--x- (0%)
#include<iostream>
#include<map>
#include<vector>
using namespace std;
int main() {
vector<pair<int,int>> Q1,Q2,Q3,Q4;
int x,y,n;
//set<pair<int,int>> point;
cin>>n;
while(n--){
cin>>x>>y;
if(x>0 &&y>0) {
Q1.push_back(make_pair(x,y));
}
if(x<0 &&y>0) {
Q2.push_back(make_pair(x,y));
}
if(x<0 &&y<0) {
Q3.push_back(make_pair(x,y));
}
if(x>0 &&y<0) {
Q4.push_back(make_pair(x,y));
}
}
int xmin=Q1[0].first,ymin=Q1[0].second,xmax=xmin,ymax=ymin;
for(auto c:Q1){
if(c.first>xmax) xmax==c.first;
if(c.second>ymax) ymax==c.second;
if(c.first<xmin) xmin==c.first;
if(c.second<ymin) ymin==c.second;
}
vector<pair<int,int>> min,max;
int tx=xmax-xmin;
int ty=ymax-ymin;
vector<int> pt;
pt.push_back(tx*ty);
min.push_back(make_pair(xmin,ymin));
max.push_back(make_pair(xmax,ymax));
for(auto c:Q2){
if(c.first>xmax) xmax==c.first;
if(c.second>ymax) ymax==c.second;
if(c.first<xmin) xmin==c.first;
if(c.second<ymin) ymin==c.second;
}
tx=xmax-xmin;
ty=ymax-ymin;
pt.push_back(tx*ty);
min.push_back(make_pair(xmin,ymin));
max.push_back(make_pair(xmax,ymax));
for(auto c:Q3){
if(c.first>xmax) xmax==c.first;
if(c.second>ymax) ymax==c.second;
if(c.first<xmin) xmin==c.first;
if(c.second<ymin) ymin==c.second;
}
tx=xmax-xmin;
ty=ymax-ymin;
pt.push_back(tx*ty);
min.push_back(make_pair(xmin,ymin));
max.push_back(make_pair(xmax,ymax));
for(auto c:Q4){
if(c.first>xmax) xmax==c.first;
if(c.second>ymax) ymax==c.second;
if(c.first<xmin) xmin==c.first;
if(c.second<ymin) ymin==c.second;
}
tx=xmax-xmin;
ty=ymax-ymin;
pt.push_back(tx*ty);
min.push_back(make_pair(xmin,ymin));
max.push_back(make_pair(xmax,ymax));
if(Q1.size()==0 && Q2.size()==0 && Q3.size()==0 && Q4.size()==0){
cout<<"No point in any quadrant";
}
else {
cout<<"Q1: ("<<min[0].first<<", "<<min[0].second<<") ";
cout<<"("<<max[0].first<<", "<<max[0].second<<") ";
cout<<pt[0]<<endl;
cout<<"Q2: ("<<min[1].first<<", "<<min[1].second<<") ";
cout<<"("<<max[1].first<<", "<<max[1].second<<") ";
cout<<pt[0]<<endl;
cout<<"Q3: ("<<min[2].first<<", "<<min[2].second<<") ";
cout<<"("<<max[2].first<<", "<<max[2].second<<") ";
cout<<pt[0]<<endl;
cout<<"Q4: ("<<min[3].first<<", "<<min[3].second<<") ";
cout<<"("<<max[3].first<<", "<<max[3].second<<") ";
cout<<pt[0]<<endl;
}
} | # 2072001, 2024-11-02 15:31:47, ----PP---- (20%)
#include<iostream>
#include<map>
#include<vector>
using namespace std;
int main() {
map<string,vector<pair<int,int>>> total;
int x,y,n;
int xmin,ymin,xmax,ymax;
//set<pair<int,int>> point;
cin>>n;
while(n--){
cin>>x>>y;
if(x>0 &&y>0) {
total["Q1"]=vector<pair<int,int>>();
total["Q1"].push_back(make_pair(x,y));
}
if(x<0 &&y>0) {
total["Q2"]=vector<pair<int,int>>();
total["Q2"].push_back(make_pair(x,y));
}
if(x<0 &&y<0) {
total["Q3"]=vector<pair<int,int>>();
total["Q3"].push_back(make_pair(x,y));
}
if(x>0 &&y<0) {
total["Q4"]=vector<pair<int,int>>();
total["Q4"].push_back(make_pair(x,y));
}
}
vector<pair<int,int>> min,max;
vector<int> pt ;
for(auto c:total) {
xmin = (c.second)[0].first;
xmax=xmin;
ymin = (c.second)[0].second;
ymax=ymin;
for(auto s: c.second){
if(s.first>xmax) xmax==s.first;
if(s.first<xmin) xmin==s.first;
if(s.second>ymax) ymax==s.second;
if(s.second<ymin) ymin==s.second;
}
int tx=xmax-xmin;
int ty=ymax-ymin;
pt.push_back(tx*ty);
min.push_back(make_pair(xmin,ymin));
max.push_back(make_pair(xmax,ymax));
}
auto itr=total.begin();
for(int i=0; i<min.size() && itr!=total.end();i++){
cout<<(*itr).first<<": ("<<min[i].first<<", "<<min[i].second<<") ";
cout<<"("<<max[i].first<<", "<<max[i].second<<") ";
cout<<pt[i];
itr++;
cout<<endl;
}
if(total["Q1"].size()==0 && total["Q2"].size()==0 && total["Q3"].size()==0 && total["Q4"].size()==0){
cout<<"No point in any quadrant";
}
} |
# 2071250, 2024-11-02 14:13:06, -----P---- (10%)
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
vector<int> x, y;
for (int i = 0; i < n; i++)
{
int xx, yy;
cin >> xx >> yy;
x.push_back(xx);
y.push_back(yy);
}
// cout << "Q1: " << endl;
cout << "No point in any quadrant" << endl;
} | # 2071847, 2024-11-02 15:22:14, ----PP---- (20%)
#include <bits/stdc++.h>
using namespace std;
void output(string q, int x1, int y1, int x2, int y2);
int main()
{
int n;
cin >> n;
vector<int> q1x, q1y;
vector<int> q2x, q2y;
vector<int> q3x, q3y;
vector<int> q4x, q4y;
for (int i = 0; i < n; i++)
{
int xx, yy;
cin >> xx >> yy;
if (xx > 0 && yy > 0)
{
q1x.push_back(xx);
q1y.push_back(yy);
}
else if (xx < 0 && yy > 0)
{
q2x.push_back(xx);
q2y.push_back(yy);
}
else if (xx < 0 && yy < 0)
{
q3x.push_back(xx);
q3y.push_back(yy);
}
else if (xx > 0 && yy < 0)
{
q4x.push_back(xx);
q4y.push_back(yy);
}
}
if (q1x.empty() && q2x.empty() && q3x.empty() && q4x.empty())
{
cout << "No point in any quadrant" << endl;
return 0;
}
if (!q1x.empty())
{
int x1 = INT16_MAX,
x2 = INT16_MIN,
y1 = INT16_MAX,
y2 = INT16_MIN;
for (size_t i = 0; i < q1x.size(); i++)
{
x1 = min(q1x[i], x1);
x2 = max(q1x[i], x2);
y1 = min(q1y[i], y1);
y2 = max(q1y[i], y2);
}
string q = "Q1: (";
output(q, x1, y1, x2, y2);
}
if (!q2x.empty())
{
int x1 = INT16_MAX,
x2 = INT16_MIN,
y1 = INT16_MAX,
y2 = INT16_MIN;
for (size_t i = 0; i < q2x.size(); i++)
{
x1 = min(q2x[i], x1);
x2 = max(q2x[i], x2);
y1 = min(q2y[i], y1);
y2 = max(q2y[i], y2);
}
string q = "Q2: (";
output(q, x1, y1, x2, y2);
}
if (!q3x.empty())
{
int x1 = INT16_MAX,
x2 = INT16_MIN,
y1 = INT16_MAX,
y2 = INT16_MIN;
for (size_t i = 0; i < q3x.size(); i++)
{
x1 = min(q3x[i], x1);
x2 = max(q3x[i], x2);
y1 = min(q3y[i], y1);
y2 = max(q3y[i], y2);
}
string q = "Q3: (";
output(q, x1, y1, x2, y2);
}
if (!q4x.empty())
{
int x1 = INT16_MAX,
x2 = INT16_MIN,
y1 = INT16_MAX,
y2 = INT16_MIN;
for (size_t i = 0; i < q4x.size(); i++)
{
x1 = min(q4x[i], x1);
x2 = max(q4x[i], x2);
y1 = min(q4y[i], y1);
y2 = max(q4y[i], y2);
}
string q = "Q4: (";
output(q, x1, y1, x2, y2);
}
}
void output(string q, int x1, int y1, int x2, int y2)
{
int p = 0;
cout << q << x1 << ", " << y1 << ") (" << x2 << ", " << y2 << ") " << p << endl;
} | # 2072018, 2024-11-02 15:32:40, ----PP---- (20%)
#include <bits/stdc++.h>
using namespace std;
void output(string q, int x1, int y1, int x2, int y2);
int main()
{
int n;
cin >> n;
vector<int> q1x, q1y;
vector<int> q2x, q2y;
vector<int> q3x, q3y;
vector<int> q4x, q4y;
for (int i = 0; i < n; i++)
{
int xx, yy;
cin >> xx >> yy;
if (xx > 0 && yy > 0)
{
q1x.push_back(xx);
q1y.push_back(yy);
}
else if (xx < 0 && yy > 0)
{
q2x.push_back(xx);
q2y.push_back(yy);
}
else if (xx < 0 && yy < 0)
{
q3x.push_back(xx);
q3y.push_back(yy);
}
else if (xx > 0 && yy < 0)
{
q4x.push_back(xx);
q4y.push_back(yy);
}
}
if (q1x.empty() && q2x.empty() && q3x.empty() && q4x.empty())
{
cout << "No point in any quadrant" << endl;
return 0;
}
if (!q1x.empty())
{
int x1 = INT16_MAX,
x2 = INT16_MIN,
y1 = INT16_MAX,
y2 = INT16_MIN;
for (size_t i = 0; i < q1x.size(); i++)
{
x1 = min(q1x[i], x1);
x2 = max(q1x[i], x2);
y1 = min(q1y[i], y1);
y2 = max(q1y[i], y2);
}
string q = "Q1: (";
output(q, x1, y1, x2, y2);
}
if (!q2x.empty())
{
int x1 = INT16_MAX,
x2 = INT16_MIN,
y1 = INT16_MAX,
y2 = INT16_MIN;
for (size_t i = 0; i < q2x.size(); i++)
{
x1 = min(q2x[i], x1);
x2 = max(q2x[i], x2);
y1 = min(q2y[i], y1);
y2 = max(q2y[i], y2);
}
string q = "Q2: (";
output(q, x1, y1, x2, y2);
}
if (!q3x.empty())
{
int x1 = INT16_MAX,
x2 = INT16_MIN,
y1 = INT16_MAX,
y2 = INT16_MIN;
for (size_t i = 0; i < q3x.size(); i++)
{
x1 = min(q3x[i], x1);
x2 = max(q3x[i], x2);
y1 = min(q3y[i], y1);
y2 = max(q3y[i], y2);
}
string q = "Q3: (";
output(q, x1, y1, x2, y2);
}
if (!q4x.empty())
{
int x1 = INT16_MAX,
x2 = INT16_MIN,
y1 = INT16_MAX,
y2 = INT16_MIN;
for (size_t i = 0; i < q4x.size(); i++)
{
x1 = min(q4x[i], x1);
x2 = max(q4x[i], x2);
y1 = min(q4y[i], y1);
y2 = max(q4y[i], y2);
}
string q = "Q4: (";
output(q, x1, y1, x2, y2);
}
}
void output(string q, int x1, int y1, int x2, int y2)
{
int p = y2-x1 * x1-y1;
if (x1 == x2)
p = 0;
cout << q << x1 << ", " << y1 << ") (" << x2 << ", " << y2 << ") " << p << endl;
} |
# 2069767, 2024-11-02 11:22:48, -----P---- (10%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
vector<pair<int,int> >quad;
vector<pair<int,int> >quad1;
vector<pair<int,int> >quad2;
vector<pair<int,int> >quad3;
vector<pair<int,int> >quad4;
int x, y;
while(n--){
cin>>x>>y;
quad.push_back(make_pair(x,y));
}
for(auto p:quad){
if(p.first>0 && p.second>0){
quad1.push_back(p);
}
else if(p.first<0 && p.second>0){
quad2.push_back(p);
}
else if(p.first<0 && p.second<0){
quad3.push_back(p);
}
else if(p.first>0 && p.second>0){
quad4.push_back(p);
}
}
if(quad1.size()!=0){
cout<<"Q1: ";
for(auto e:quad1){
cout<<"("<<e.first<<", "<<e.second<<")"<<" ";
}
cout<<endl;
}
if(quad2.size()!=0){
cout<<"Q2: ";
for(auto e:quad2){
cout<<"("<<e.first<<", "<<e.second<<")"<<" "<<endl;
}
}
if(quad3.size()!=0){
cout<<"Q3: ";
for(auto e:quad3){
cout<<"("<<e.first<<", "<<e.second<<")"<<" "<<endl;
}
}
if(quad4.size()!=0){
cout<<"Q4: ";
for(auto e:quad4){
cout<<"("<<e.first<<", "<<e.second<<")"<<" "<<endl;
}
}
else if(quad1.size()==0 && quad2.size()==0 && quad3.size()==0 && quad4.size()==0){
cout<<"No point in any quadrant";
}
} | # 2070446, 2024-11-02 12:08:51, ----PP---- (20%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
int area;
int count=0;
int maxx_first=0;
cin>>n;
vector<pair<int,int> >quad;
vector<pair<int,int> >quad1;
vector<pair<int,int> >quad2;
vector<pair<int,int> >quad3;
vector<pair<int,int> >quad4;
int x, y;
while(n--){
cin>>x>>y;
quad.push_back(make_pair(x,y));
}
for(auto p:quad){
if(p.first>0 && p.second>0){
quad1.push_back(p);
sort(quad1.begin(),quad1.end());
}
else if(p.first<0 && p.second>0){
quad2.push_back(p);
}
else if(p.first<0 && p.second<0){
quad3.push_back(p);
}
else if(p.first>0 && p.second<0){
quad4.push_back(p);
}
}
//q1
if(quad1.size()!=0){
cout<<"Q1: ";
if(quad1.size()==1){
for(auto e:quad1){
cout<<"("<<e.first<<", "<<e.second<<")"<<" "<<"("<<e.first<<", "<<e.second<<")"<<" ";
}
}
cout<<area<<endl;
}
//q2
if(quad2.size()!=0){
cout<<"Q2: ";
if(quad2.size()==1){
for(auto e:quad2){
cout<<"("<<e.first<<", "<<e.second<<")"<<" "<<"("<<e.first<<", "<<e.second<<")"<<" ";
}
}
cout<<area<<endl;
}
if(quad3.size()!=0){
cout<<"Q3: ";
if(quad3.size()==1){
for(auto e:quad3){
cout<<"("<<e.first<<", "<<e.second<<")"<<" "<<"("<<e.first<<", "<<e.second<<")"<<" ";
}
}
cout<<area<<endl;
}
if(quad4.size()!=0){
cout<<"Q4: ";
if(quad4.size()==1){
for(auto e:quad4){
cout<<"("<<e.first<<", "<<e.second<<")"<<" "<<"("<<e.first<<", "<<e.second<<")"<<" ";
}
}
cout<<area<<endl;
}
else if(quad1.size()==0 && quad2.size()==0 && quad3.size()==0 && quad4.size()==0){
cout<<"No point in any quadrant";
}
} |
# 2070319, 2024-11-02 12:03:24, xxxx-xP-xP (20%)
#include <bits/stdc++.h>
using namespace std ;
int main () {
//input
int n,x,y = 0 ;
vector < pair <int,int> > point ;
cin >> n ;
for ( int i = 0 ; i < n ; i++ ) {
cin >> x >> y ;
point.push_back( make_pair (x,y) ) ;
}
// -- process --
vector<int>Q1x ;
vector<int>Q1y ;
vector<int>Q2x ;
vector<int>Q2y ;
vector<int>Q3x ;
vector<int>Q3y ;
vector<int>Q4x ;
vector<int>Q4y ;
// get in quadrant
for ( auto p : point ) {
if ( ( p.first > 0 ) && ( p.second > 0 )) {
Q1x.push_back(p.first) ;
Q1y.push_back(p.second) ;
} else if ( ( p.first < 0 ) && ( p.second > 0 ) ) {
Q2x.push_back(p.first) ;
Q2y.push_back(p.second) ;
} else if ( ( p.first < 0 ) && ( p.second < 0 ) ) {
Q3x.push_back(p.first) ;
Q3y.push_back(p.second) ;
} else if ( ( p.first > 0 ) && ( p.second < 0 ) ) {
Q4x.push_back(p.first) ;
Q4y.push_back(p.second) ;
}
}
// find L,R and space
// arrange
sort(Q1x.begin(),Q1x.end()) ;
sort(Q1y.begin(),Q1y.end()) ;
int E1 = Q1x.size() - 1 ;
sort(Q2x.begin(),Q2x.end()) ;
sort(Q2y.begin(),Q2y.end()) ;
int E2 = Q2x.size() - 1 ;
sort(Q3x.begin(),Q3x.end()) ;
sort(Q3y.begin(),Q3y.end()) ;
int E3 = Q3x.size() - 1 ;
sort(Q4x.begin(),Q4x.end()) ;
sort(Q4y.begin(),Q4y.end()) ;
int E4 = Q4x.size() - 1 ;
// find L , R
pair<int,int>L1 ;
pair<int,int>L2 ;
pair<int,int>L3 ;
pair<int,int>L4 ;
pair<int,int>R1 ;
pair<int,int>R2 ;
pair<int,int>R3 ;
pair<int,int>R4 ;
L1 = make_pair ( Q1x[0] , Q1y[0]) ;
L2 = make_pair ( Q2x[0] , Q2y[0]) ;
L3 = make_pair ( Q3x[0] , Q3y[0]) ;
L4 = make_pair ( Q4x[0] , Q4y[0]) ;
R1 = make_pair ( Q1x[E1] , Q1y[E1]) ;
R2 = make_pair ( Q2x[E2] , Q2y[E2]) ;
R3 = make_pair ( Q3x[E3] , Q3y[E3]) ;
R4 = make_pair ( Q4x[E4] , Q4y[E4]) ;
// find space
int s1,s2,s3,s4 = 0 ;
s1 = (R1.first - L1.first)*(R1.second - L1.second) ;
s2 = (R2.first - L2.first)*(R2.second - L2.second) ;
s3 = (R3.first - L3.first)*(R3.second - L3.second) ;
s4 = (R4.first - L4.first)*(R4.second - L4.second) ;
// output
if ( E1!=0 ) {
cout << "Q1: (" << L1.first << ", " << L1.second << ") (" << R1.first << ", " << R1.second << ") " << s1 << endl ;
}
if ( E2!=0 ) {
cout << "Q2: (" << L2.first << ", " << L2.second << ") (" << R2.first << ", " << R2.second << ") " << s2 << endl ;
}
if ( E3!=0 ) {
cout << "Q3: (" << L3.first << ", " << L3.second << ") (" << R3.first << ", " << R3.second << ") " << s3 << endl ;
}
if ( E4!=0 ) {
cout << "Q4: (" << L4.first << ", " << L4.second << ") (" << R4.first << ", " << R4.second << ") " << s4 << endl ;
}
if ((E1 == 0)&&(E2 == 0)&&(E3 == 0)&&(E4 == 0)) {
cout << "No point in any quadrant" << endl ;
}
} |
# 2069181, 2024-11-02 10:23:28, -----P---- (10%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
vector<pair<int,int>> q1;
vector<pair<int,int>> q2;
vector<pair<int,int>> q3;
vector<pair<int,int>> q4;
while (n--)
{
int a,b;
cin>>a>>b;
if(a!=0 && b!=0){
if(a>0 && b>0){
q1.push_back({a,b});
}else if(a>0 && b < 0){
q4.push_back({a,b});
}else if(a<0 && b<0){
q3.push_back({a,b});
}else{
q2.push_back({a,b});
}
}
}
if(q1.empty() && q2.empty() && q3.empty() && q4.empty()){
cout<<"No point in any quadrant";
return 0;
}
} | # 2069783, 2024-11-02 11:24:51, ---------- (0%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
vector<pair<int,int>> q1;
vector<pair<int,int>> q2;
vector<pair<int,int>> q3;
vector<pair<int,int>> q4;
while (n--)
{
int a,b;
cin>>a>>b;
if(a!=0 && b!=0){
if(a>0 && b>0){
q1.push_back({a,b});
}else if(a>0 && b < 0){
q2.push_back({a,b});
}else if(a<0 && b<0){
q3.push_back({a,b});
}else{
q4.push_back({a,b});
}
}
}
int x1q1 = INT_MAX,x2q1 = INT_MIN , y1q1 = INT_MAX, y2q1 = INT_MIN;
for(auto e : q1){
x1q1 = min(x1q1,e.first);
x2q1 = max(x2q1,e.second);
y1q1 = min(y1q1,e.first);
y2q1 = max(y1q1,e.second);
}
int x1q2 = INT_MAX,x2q2 = INT_MIN , y1q2 = INT_MAX, y2q2 = INT_MIN;
for(auto e : q2){
x1q2 = min(x1q2,e.first);
x2q2 = max(x2q2,e.second);
y1q2 = min(y1q2,e.first);
y2q2 = max(y1q2,e.second);
}
int x1q3 = INT_MAX,x2q3 = INT_MIN , y1q3 = INT_MAX, y2q3 = INT_MIN;
for(auto e : q3){
x1q3 = min(x1q3,e.first);
x2q3 = max(x2q3,e.second);
y1q3 = min(y1q3,e.first);
y2q3 = max(y1q3,e.second);
}
int x1q4 = INT_MAX,x2q4 = INT_MIN , y1q4 = INT_MAX, y2q4 = INT_MIN;
for(auto e : q4){
x1q4 = min(x1q4,e.first);
x2q4 = max(x2q4,e.second);
y1q4 = min(y1q4,e.first);
y2q4 = max(y1q4,e.second);
}
int a1,a2,a3,a4;
a1 = abs(x1q1-x2q1)*abs(y1q1-y2q1);
a2 = abs(x1q2-x2q2)*abs(y1q2-y2q3);
a3 = abs(x1q3-x2q3)*abs(y1q3-y2q3);
a4 = abs(x1q4-x2q4)*abs(y1q4-y2q4);
if(a1!=0){
cout<<"Q1: ("<<x1q1<<", "<<y1q1<<") ("<<x2q1<<", "<<y2q1<<") "<<a1<<endl;
}
if(a2!=0){
cout<<"Q2: ("<<x1q2<<", "<<y1q2<<") ("<<x2q2<<", "<<y2q2<<") "<<a2<<endl;
}
if(a3!=0){
cout<<"Q3: ("<<x1q3<<", "<<y1q3<<") ("<<x2q3<<", "<<y2q3<<") "<<a3<<endl;
}
if(a4!=0){
cout<<"Q4: ("<<x1q4<<", "<<y1q4<<") ("<<x2q4<<", "<<y2q4<<") "<<a4<<endl;
}
if(q1.empty() && q2.empty() && q3.empty() && q4.empty()){
cout<<"No point in any quadrant";
return 0;
}
} | # 2069791, 2024-11-02 11:25:17, -----P---- (10%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
vector<pair<int,int>> q1;
vector<pair<int,int>> q2;
vector<pair<int,int>> q3;
vector<pair<int,int>> q4;
while (n--)
{
int a,b;
cin>>a>>b;
if(a!=0 && b!=0){
if(a>0 && b>0){
q1.push_back({a,b});
}else if(a>0 && b < 0){
q2.push_back({a,b});
}else if(a<0 && b<0){
q3.push_back({a,b});
}else{
q4.push_back({a,b});
}
}
}
int x1q1 = INT_MAX,x2q1 = INT_MIN , y1q1 = INT_MAX, y2q1 = INT_MIN;
for(auto e : q1){
x1q1 = min(x1q1,e.first);
x2q1 = max(x2q1,e.second);
y1q1 = min(y1q1,e.first);
y2q1 = max(y1q1,e.second);
}
int x1q2 = INT_MAX,x2q2 = INT_MIN , y1q2 = INT_MAX, y2q2 = INT_MIN;
for(auto e : q2){
x1q2 = min(x1q2,e.first);
x2q2 = max(x2q2,e.second);
y1q2 = min(y1q2,e.first);
y2q2 = max(y1q2,e.second);
}
int x1q3 = INT_MAX,x2q3 = INT_MIN , y1q3 = INT_MAX, y2q3 = INT_MIN;
for(auto e : q3){
x1q3 = min(x1q3,e.first);
x2q3 = max(x2q3,e.second);
y1q3 = min(y1q3,e.first);
y2q3 = max(y1q3,e.second);
}
int x1q4 = INT_MAX,x2q4 = INT_MIN , y1q4 = INT_MAX, y2q4 = INT_MIN;
for(auto e : q4){
x1q4 = min(x1q4,e.first);
x2q4 = max(x2q4,e.second);
y1q4 = min(y1q4,e.first);
y2q4 = max(y1q4,e.second);
}
int a1,a2,a3,a4;
a1 = abs(x1q1-x2q1)*abs(y1q1-y2q1);
a2 = abs(x1q2-x2q2)*abs(y1q2-y2q3);
a3 = abs(x1q3-x2q3)*abs(y1q3-y2q3);
a4 = abs(x1q4-x2q4)*abs(y1q4-y2q4);
if(q1.empty() && q2.empty() && q3.empty() && q4.empty()){
cout<<"No point in any quadrant";
return 0;
}
if(a1!=0){
cout<<"Q1: ("<<x1q1<<", "<<y1q1<<") ("<<x2q1<<", "<<y2q1<<") "<<a1<<endl;
}
if(a2!=0){
cout<<"Q2: ("<<x1q2<<", "<<y1q2<<") ("<<x2q2<<", "<<y2q2<<") "<<a2<<endl;
}
if(a3!=0){
cout<<"Q3: ("<<x1q3<<", "<<y1q3<<") ("<<x2q3<<", "<<y2q3<<") "<<a3<<endl;
}
if(a4!=0){
cout<<"Q4: ("<<x1q4<<", "<<y1q4<<") ("<<x2q4<<", "<<y2q4<<") "<<a4<<endl;
}
} | # 2069891, 2024-11-02 11:33:52, xx-x-x--x- (0%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
vector<pair<int,int>> q1;
vector<pair<int,int>> q2;
vector<pair<int,int>> q3;
vector<pair<int,int>> q4;
while (n--)
{
int a,b;
cin>>a>>b;
if(a!=0 && b!=0){
if(a>0 && b>0){
q1.push_back({a,b});
}else if(a>0 && b < 0){
q2.push_back({a,b});
}else if(a<0 && b<0){
q3.push_back({a,b});
}else{
q4.push_back({a,b});
}
}
}
sort(q1.begin(),q1.end());
int w1 = abs(q1[0].first-q1.back().first);
int h1 = abs(q1[0].second-q1.back().second);
int w2 = abs(q2[0].first-q2.back().first);
int h2 = abs(q2[0].second-q2.back().second);
int w3 = abs(q3[0].first-q3.back().first);
int h3 = abs(q3[0].second-q3.back().second);
int w4 = abs(q4[0].first-q4.back().first);
int h4 = abs(q4[0].second-q4.back().second);
int a1,a2,a3,a4;
a1 = w1*h1;
a2 = w2*h2;
a2 = w3*h3;
a2 = w4*h4;
if(q1.empty() && q2.empty() && q3.empty() && q4.empty()){
cout<<"No point in any quadrant";
return 0;
}
if(a1!=0){
cout<<"Q1: ("<<q1[0].first<<", "<<q1[0].second<<") ("<<q1.back().first<<", "<<q1.back().second<<") "<<a1<<endl;
}
if(a2!=0){
cout<<"Q2: ("<<q2[0].first<<", "<<q2[0].second<<") ("<<q2.back().first<<", "<<q2.back().second<<") "<<a2<<endl;
}
if(a3!=0){
cout<<"Q3: ("<<q3[0].first<<", "<<q3[0].second<<") ("<<q3.back().first<<", "<<q3.back().second<<") "<<a3<<endl;
}
if(a4!=0){
cout<<"Q4: ("<<q4[0].first<<", "<<q4[0].second<<") ("<<q4.back().first<<", "<<q4.back().second<<") "<<a4<<endl;
}
} | # 2069902, 2024-11-02 11:34:58, xxxx-x--x- (0%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
vector<pair<int,int>> q1;
vector<pair<int,int>> q2;
vector<pair<int,int>> q3;
vector<pair<int,int>> q4;
while (n--)
{
int a,b;
cin>>a>>b;
if(a!=0 && b!=0){
if(a>0 && b>0){
q1.push_back({a,b});
}else if(a>0 && b < 0){
q2.push_back({a,b});
}else if(a<0 && b<0){
q3.push_back({a,b});
}else{
q4.push_back({a,b});
}
}
}
sort(q1.begin(),q1.end());
sort(q2.begin(),q2.end());
sort(q3.begin(),q3.end());
sort(q4.begin(),q4.end());
int w1 = abs(q1[0].first-q1.back().first);
int h1 = abs(q1[0].second-q1.back().second);
int w2 = abs(q2[0].first-q2.back().first);
int h2 = abs(q2[0].second-q2.back().second);
int w3 = abs(q3[0].first-q3.back().first);
int h3 = abs(q3[0].second-q3.back().second);
int w4 = abs(q4[0].first-q4.back().first);
int h4 = abs(q4[0].second-q4.back().second);
int a1,a2,a3,a4;
a1 = w1*h1;
a2 = w2*h2;
a2 = w3*h3;
a2 = w4*h4;
if(q1.empty() && q2.empty() && q3.empty() && q4.empty()){
cout<<"No point in any quadrant";
return 0;
}
if(a1!=0){
cout<<"Q1: ("<<q1[0].first<<", "<<q1[0].second<<") ("<<q1.back().first<<", "<<q1.back().second<<") "<<a1<<endl;
}
if(a2!=0){
cout<<"Q2: ("<<q2[0].first<<", "<<q2[0].second<<") ("<<q2.back().first<<", "<<q2.back().second<<") "<<a2<<endl;
}
if(a3!=0){
cout<<"Q3: ("<<q3[0].first<<", "<<q3[0].second<<") ("<<q3.back().first<<", "<<q3.back().second<<") "<<a3<<endl;
}
if(a4!=0){
cout<<"Q4: ("<<q4[0].first<<", "<<q4[0].second<<") ("<<q4.back().first<<", "<<q4.back().second<<") "<<a4<<endl;
}
} | # 2069915, 2024-11-02 11:36:32, xxxx-x--x- (0%)
#include <bits/stdc++.h>
using namespace std;
vector<pair<int,int>> q1;
vector<pair<int,int>> q2;
vector<pair<int,int>> q3;
vector<pair<int,int>> q4;
int main(){
int n;
cin>>n;
while (n--)
{
int a,b;
cin>>a>>b;
if(a!=0 && b!=0){
if(a>0 && b>0){
q1.push_back({a,b});
}else if(a>0 && b < 0){
q2.push_back({a,b});
}else if(a<0 && b<0){
q3.push_back({a,b});
}else{
q4.push_back({a,b});
}
}
}
sort(q1.begin(),q1.end());
sort(q2.begin(),q2.end());
sort(q3.begin(),q3.end());
sort(q4.begin(),q4.end());
int w1 = abs(q1[0].first-q1.back().first);
int h1 = abs(q1[0].second-q1.back().second);
int w2 = abs(q2[0].first-q2.back().first);
int h2 = abs(q2[0].second-q2.back().second);
int w3 = abs(q3[0].first-q3.back().first);
int h3 = abs(q3[0].second-q3.back().second);
int w4 = abs(q4[0].first-q4.back().first);
int h4 = abs(q4[0].second-q4.back().second);
int a1,a2,a3,a4;
a1 = w1*h1;
a2 = w2*h2;
a2 = w3*h3;
a2 = w4*h4;
if(q1.empty() && q2.empty() && q3.empty() && q4.empty()){
cout<<"No point in any quadrant";
return 0;
}
if(a1!=0){
cout<<"Q1: ("<<q1[0].first<<", "<<q1[0].second<<") ("<<q1.back().first<<", "<<q1.back().second<<") "<<a1<<endl;
}
if(a2!=0){
cout<<"Q2: ("<<q2[0].first<<", "<<q2[0].second<<") ("<<q2.back().first<<", "<<q2.back().second<<") "<<a2<<endl;
}
if(a3!=0){
cout<<"Q3: ("<<q3[0].first<<", "<<q3[0].second<<") ("<<q3.back().first<<", "<<q3.back().second<<") "<<a3<<endl;
}
if(a4!=0){
cout<<"Q4: ("<<q4[0].first<<", "<<q4[0].second<<") ("<<q4.back().first<<", "<<q4.back().second<<") "<<a4<<endl;
}
} | # 2069988, 2024-11-02 11:42:57, xxxx-x--x- (0%)
#include <bits/stdc++.h>
using namespace std;
vector<pair<int,int>> q1;
vector<pair<int,int>> q2;
vector<pair<int,int>> q3;
vector<pair<int,int>> q4;
int main(){
int n;
cin>>n;
while (n--)
{
int a,b;
cin>>a>>b;
if(a!=0 && b!=0){
if(a>0 && b>0){
q1.push_back({a,b});
}else if(a>0 && b < 0){
q2.push_back({a,b});
}else if(a<0 && b<0){
q3.push_back({a,b});
}else{
q4.push_back({a,b});
}
}
}
sort(q1.begin(),q1.end());
sort(q2.begin(),q2.end());
sort(q3.begin(),q3.end());
sort(q4.begin(),q4.end());
int w1 = abs(q1[0].first-q1.back().first);
int h1 = abs(q1[0].second-q1.back().second);
int w2 = abs(q2[0].first-q2.back().first);
int h2 = abs(q2[0].second-q2.back().second);
int w3 = abs(q3[0].first-q3.back().first);
int h3 = abs(q3[0].second-q3.back().second);
int w4 = abs(q4[0].first-q4.back().first);
int h4 = abs(q4[0].second-q4.back().second);
int a1,a2,a3,a4;
a1 = w1*h1;
a2 = w2*h2;
a2 = w3*h3;
a2 = w4*h4;
if(q1.empty() && q2.empty() && q3.empty() && q4.empty()){
cout<<"No point in any quadrant";
return 0;
}
if(a1!=0){
cout<<"Q1: ("<<q1[0].first<<", "<<q1[0].second<<") ("<<q1.back().first<<", "<<q1.back().second<<") "<<a1<<endl;
}
if(a2!=0){
cout<<"Q2: ("<<q2[0].first<<", "<<q2[0].second<<") ("<<q2.back().first<<", "<<q2.back().second<<") "<<a2<<endl;
}
if(a3!=0){
cout<<"Q3: ("<<q3[0].first<<", "<<q3[0].second<<") ("<<q3.back().first<<", "<<q3.back().second<<") "<<a3<<endl;
}
if(a4!=0){
cout<<"Q4: ("<<q4[0].first<<", "<<q4[0].second<<") ("<<q4.back().first<<", "<<q4.back().second<<") "<<a4<<endl;
}
} | # 2070058, 2024-11-02 11:48:11, xxxx-x--x- (0%)
#include <bits/stdc++.h>
using namespace std;
vector<pair<int,int>> q1;
vector<pair<int,int>> q2;
vector<pair<int,int>> q3;
vector<pair<int,int>> q4;
int main(){
int n;
cin>>n;
while (n--)
{
int a,b;
cin>>a>>b;
if(a!=0 && b!=0){
if(a>0 && b>0){
q1.push_back({a,b});
}else if(a>0 && b < 0){
q2.push_back({a,b});
}else if(a<0 && b<0){
q3.push_back({a,b});
}else{
q4.push_back({a,b});
}
}
}
sort(q1.begin(),q1.end());
sort(q2.begin(),q2.end());
sort(q3.begin(),q3.end());
sort(q4.begin(),q4.end());
int w1 = abs(q1[0].first - q1[q1.size()-1].first);
int h1 = abs(q1[0].second-q1[q1.size()-1].second);
int w2 = abs(q2[0].first-q2[q2.size()-1].first);
int h2 = abs(q2[0].second-q2[q2.size()-1].second);
int w3 = abs(q3[0].first-q3[q3.size()-1].first);
int h3 = abs(q3[0].second-q3[q3.size()-1].second);
int w4 = abs(q4[0].first-q4[q4.size()-1].first);
int h4 = abs(q4[0].second-q4[q4.size()-1].second);
int a1,a2,a3,a4;
a1 = w1*h1;
a2 = w2*h2;
a2 = w3*h3;
a2 = w4*h4;
if(q1.empty() && q2.empty() && q3.empty() && q4.empty()){
cout<<"No point in any quadrant";
return 0;
}
if(a1!=0){
cout<<"Q1: ("<<q1[0].first<<", "<<q1[0].second<<") ("<<q1.back().first<<", "<<q1.back().second<<") "<<a1<<endl;
}
if(a2!=0){
cout<<"Q2: ("<<q2[0].first<<", "<<q2[0].second<<") ("<<q2.back().first<<", "<<q2.back().second<<") "<<a2<<endl;
}
if(a3!=0){
cout<<"Q3: ("<<q3[0].first<<", "<<q3[0].second<<") ("<<q3.back().first<<", "<<q3.back().second<<") "<<a3<<endl;
}
if(a4!=0){
cout<<"Q4: ("<<q4[0].first<<", "<<q4[0].second<<") ("<<q4.back().first<<", "<<q4.back().second<<") "<<a4<<endl;
}
} | # 2070122, 2024-11-02 11:52:19, Compilation error (0%)
#include <bits/stdc++.h>
using namespace std;
vector<pair<int,int>> q1;
vector<pair<int,int>> q2;
vector<pair<int,int>> q3;
vector<pair<int,int>> q4;
int main(){
int n;
cin>>n;
while (n--)
{
int a,b;
cin>>a>>b;
if(a!=0 && b!=0){
if(a>0 && b>0){
q1.push_back({a,b});
}else if(a>0 && b < 0){
q2.push_back({a,b});
}else if(a<0 && b<0){
q3.push_back({a,b});
}else{
q4.push_back({a,b});
}
}
}
/*sort(q1.begin(),q1.end());
sort(q2.begin(),q2.end());
sort(q3.begin(),q3.end());
sort(q4.begin(),q4.end());
int w1 = abs(q1[0].first - q1[q1.size()-1].first);
int h1 = abs(q1[0].second-q1[q1.size()-1].second);
int w2 = abs(q2[0].first-q2[q2.size()-1].first);
int h2 = abs(q2[0].second-q2[q2.size()-1].second);
int w3 = abs(q3[0].first-q3[q3.size()-1].first);
int h3 = abs(q3[0].second-q3[q3.size()-1].second);
int w4 = abs(q4[0].first-q4[q4.size()-1].first);
int h4 = abs(q4[0].second-q4[q4.size()-1].second);
int a1,a2,a3,a4;
a1 = w1*h1;
a2 = w2*h2;
a2 = w3*h3;
a2 = w4*h4;
*/
if(q1.empty() && q2.empty() && q3.empty() && q4.empty()){
cout<<"No point in any quadrant";
return 0;
}
if(a1!=0){
cout<<"Q1: ("<<q1[0].first<<", "<<q1[0].second<<") ("<<q1.back().first<<", "<<q1.back().second<<") "<<a1<<endl;
}
if(a2!=0){
cout<<"Q2: ("<<q2[0].first<<", "<<q2[0].second<<") ("<<q2.back().first<<", "<<q2.back().second<<") "<<a2<<endl;
}
if(a3!=0){
cout<<"Q3: ("<<q3[0].first<<", "<<q3[0].second<<") ("<<q3.back().first<<", "<<q3.back().second<<") "<<a3<<endl;
}
if(a4!=0){
cout<<"Q4: ("<<q4[0].first<<", "<<q4[0].second<<") ("<<q4.back().first<<", "<<q4.back().second<<") "<<a4<<endl;
}
} | # 2070132, 2024-11-02 11:53:00, xx-x-x--x- (0%)
#include <bits/stdc++.h>
using namespace std;
vector<pair<int,int>> q1;
vector<pair<int,int>> q2;
vector<pair<int,int>> q3;
vector<pair<int,int>> q4;
int main(){
int n;
cin>>n;
while (n--)
{
int a,b;
cin>>a>>b;
if(a!=0 && b!=0){
if(a>0 && b>0){
q1.push_back({a,b});
}else if(a>0 && b < 0){
q2.push_back({a,b});
}else if(a<0 && b<0){
q3.push_back({a,b});
}else{
q4.push_back({a,b});
}
}
}
/*sort(q1.begin(),q1.end());
sort(q2.begin(),q2.end());
sort(q3.begin(),q3.end());
sort(q4.begin(),q4.end());*/
int w1 = abs(q1[0].first - q1[q1.size()-1].first);
int h1 = abs(q1[0].second-q1[q1.size()-1].second);
int w2 = abs(q2[0].first-q2[q2.size()-1].first);
int h2 = abs(q2[0].second-q2[q2.size()-1].second);
int w3 = abs(q3[0].first-q3[q3.size()-1].first);
int h3 = abs(q3[0].second-q3[q3.size()-1].second);
int w4 = abs(q4[0].first-q4[q4.size()-1].first);
int h4 = abs(q4[0].second-q4[q4.size()-1].second);
int a1,a2,a3,a4;
a1 = w1*h1;
a2 = w2*h2;
a2 = w3*h3;
a2 = w4*h4;
if(q1.empty() && q2.empty() && q3.empty() && q4.empty()){
cout<<"No point in any quadrant";
return 0;
}
if(a1!=0){
cout<<"Q1: ("<<q1[0].first<<", "<<q1[0].second<<") ("<<q1.back().first<<", "<<q1.back().second<<") "<<a1<<endl;
}
if(a2!=0){
cout<<"Q2: ("<<q2[0].first<<", "<<q2[0].second<<") ("<<q2.back().first<<", "<<q2.back().second<<") "<<a2<<endl;
}
if(a3!=0){
cout<<"Q3: ("<<q3[0].first<<", "<<q3[0].second<<") ("<<q3.back().first<<", "<<q3.back().second<<") "<<a3<<endl;
}
if(a4!=0){
cout<<"Q4: ("<<q4[0].first<<", "<<q4[0].second<<") ("<<q4.back().first<<", "<<q4.back().second<<") "<<a4<<endl;
}
} | # 2070300, 2024-11-02 12:02:29, xxxx-P--x- (10%)
#include <bits/stdc++.h>
using namespace std;
vector<pair<int,int>> q1;
vector<pair<int,int>> q2;
vector<pair<int,int>> q3;
vector<pair<int,int>> q4;
int main(){
int n;
cin>>n;
while (n--)
{
int a,b;
cin>>a>>b;
if(a!=0 && b!=0){
if(a>0 && b>0){
q1.push_back({a,b});
}else if(a>0 && b < 0){
q2.push_back({a,b});
}else if(a<0 && b<0){
q3.push_back({a,b});
}else{
q4.push_back({a,b});
}
}
}
if(q1.empty() && q2.empty() && q3.empty() && q4.empty()){
cout<<"No point in any quadrant";
return 0;
}
sort(q1.begin(),q1.end());
sort(q2.begin(),q2.end());
sort(q3.begin(),q3.end());
sort(q4.begin(),q4.end());
int w1 = abs(q1[0].first - q1[q1.size()-1].first);
int h1 = abs(q1[0].second-q1[q1.size()-1].second);
int w2 = abs(q2[0].first-q2[q2.size()-1].first);
int h2 = abs(q2[0].second-q2[q2.size()-1].second);
int w3 = abs(q3[0].first-q3[q3.size()-1].first);
int h3 = abs(q3[0].second-q3[q3.size()-1].second);
int w4 = abs(q4[0].first-q4[q4.size()-1].first);
int h4 = abs(q4[0].second-q4[q4.size()-1].second);
int a1,a2,a3,a4;
a1 = w1*h1;
a2 = w2*h2;
a2 = w3*h3;
a2 = w4*h4;
if(a1!=0){
cout<<"Q1: ("<<q1[0].first<<", "<<q1[0].second<<") ("<<q1.back().first<<", "<<q1.back().second<<") "<<a1<<endl;
}
if(a2!=0){
cout<<"Q2: ("<<q2[0].first<<", "<<q2[0].second<<") ("<<q2.back().first<<", "<<q2.back().second<<") "<<a2<<endl;
}
if(a3!=0){
cout<<"Q3: ("<<q3[0].first<<", "<<q3[0].second<<") ("<<q3.back().first<<", "<<q3.back().second<<") "<<a3<<endl;
}
if(a4!=0){
cout<<"Q4: ("<<q4[0].first<<", "<<q4[0].second<<") ("<<q4.back().first<<", "<<q4.back().second<<") "<<a4<<endl;
}
} | # 2070374, 2024-11-02 12:05:52, xxxx-P--x- (10%)
#include <bits/stdc++.h>
using namespace std;
vector<pair<int,int>> q1;
vector<pair<int,int>> q2;
vector<pair<int,int>> q3;
vector<pair<int,int>> q4;
int main(){
int n;
cin>>n;
while (n--)
{
int a,b;
cin>>a>>b;
if(a!=0 && b!=0){
if(a>0 && b>0){
q1.push_back({a,b});
}else if(a>0 && b < 0){
q2.push_back({a,b});
}else if(a<0 && b<0){
q3.push_back({a,b});
}else{
q4.push_back({a,b});
}
}
}
if(q1.empty() && q2.empty() && q3.empty() && q4.empty()){
cout<<"No point in any quadrant";
return 0;
}
sort(q1.begin(),q1.end());
sort(q2.begin(),q2.end());
sort(q3.begin(),q3.end());
sort(q4.begin(),q4.end());
int w1 = abs(q1[0].first) - abs(q1[q1.size()-1].first);
int h1 = abs(q1[0].second) -abs(q1[q1.size()-1].second);
int w2 = abs(q2[0].first) - abs(q2[q2.size()-1].first);
int h2 = abs(q2[0].second)- abs(q2[q2.size()-1].second);
int w3 = abs(q3[0].first)-abs(q3[q3.size()-1].first);
int h3 = abs(q3[0].second)-abs(q3[q3.size()-1].second);
int w4 = abs(q4[0].first)-abs(q4[q4.size()-1].first);
int h4 = abs(q4[0].second)-abs(q4[q4.size()-1].second);
int a1,a2,a3,a4;
a1 = w1*h1;
a2 = w2*h2;
a2 = w3*h3;
a2 = w4*h4;
if(a1!=0){
cout<<"Q1: ("<<q1[0].first<<", "<<q1[0].second<<") ("<<q1.back().first<<", "<<q1.back().second<<") "<<a1<<endl;
}
if(a2!=0){
cout<<"Q2: ("<<q2[0].first<<", "<<q2[0].second<<") ("<<q2.back().first<<", "<<q2.back().second<<") "<<a2<<endl;
}
if(a3!=0){
cout<<"Q3: ("<<q3[0].first<<", "<<q3[0].second<<") ("<<q3.back().first<<", "<<q3.back().second<<") "<<a3<<endl;
}
if(a4!=0){
cout<<"Q4: ("<<q4[0].first<<", "<<q4[0].second<<") ("<<q4.back().first<<", "<<q4.back().second<<") "<<a4<<endl;
}
} | # 2070491, 2024-11-02 12:10:30, -----P---- (10%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
vector<pair<int,int>> q1;
vector<pair<int,int>> q2;
vector<pair<int,int>> q3;
vector<pair<int,int>> q4;
while (n--)
{
int a,b;
cin>>a>>b;
if(a!=0 && b!=0){
if(a>0 && b>0){
q1.push_back({a,b});
}else if(a>0 && b < 0){
q2.push_back({a,b});
}else if(a<0 && b<0){
q3.push_back({a,b});
}else{
q4.push_back({a,b});
}
}
}
int x1q1 = INT_MAX,x2q1 = INT_MIN , y1q1 = INT_MAX, y2q1 = INT_MIN;
for(auto e : q1){
x1q1 = min(x1q1,e.first);
x2q1 = max(x2q1,e.second);
y1q1 = min(y1q1,e.first);
y2q1 = max(y1q1,e.second);
}
int x1q2 = INT_MAX,x2q2 = INT_MIN , y1q2 = INT_MAX, y2q2 = INT_MIN;
for(auto e : q2){
x1q2 = min(x1q2,e.first);
x2q2 = max(x2q2,e.second);
y1q2 = min(y1q2,e.first);
y2q2 = max(y1q2,e.second);
}
int x1q3 = INT_MAX,x2q3 = INT_MIN , y1q3 = INT_MAX, y2q3 = INT_MIN;
for(auto e : q3){
x1q3 = min(x1q3,e.first);
x2q3 = max(x2q3,e.second);
y1q3 = min(y1q3,e.first);
y2q3 = max(y1q3,e.second);
}
int x1q4 = INT_MAX,x2q4 = INT_MIN , y1q4 = INT_MAX, y2q4 = INT_MIN;
for(auto e : q4){
x1q4 = min(x1q4,e.first);
x2q4 = max(x2q4,e.second);
y1q4 = min(y1q4,e.first);
y2q4 = max(y1q4,e.second);
}
int a1,a2,a3,a4;
a1 = abs(x1q1-x2q1)*abs(y1q1-y2q1);
a2 = abs(x1q2-x2q2)*abs(y1q2-y2q3);
a3 = abs(x1q3-x2q3)*abs(y1q3-y2q3);
a4 = abs(x1q4-x2q4)*abs(y1q4-y2q4);
if(q1.empty() && q2.empty() && q3.empty() && q4.empty()){
cout<<"No point in any quadrant";
return 0;
}
if(a1!=0){
cout<<"Q1: ("<<x1q1<<", "<<y1q1<<") ("<<x2q1<<", "<<y2q1<<") "<<a1<<endl;
}
if(a2!=0){
cout<<"Q2: ("<<x1q2<<", "<<y1q2<<") ("<<x2q2<<", "<<y2q2<<") "<<a2<<endl;
}
if(a3!=0){
cout<<"Q3: ("<<x1q3<<", "<<y1q3<<") ("<<x2q3<<", "<<y2q3<<") "<<a3<<endl;
}
if(a4!=0){
cout<<"Q4: ("<<x1q4<<", "<<y1q4<<") ("<<x2q4<<", "<<y2q4<<") "<<a4<<endl;
}
} |
# 2069056, 2024-11-02 10:07:46, -----P---- (10%)
#include<iostream>
#include<vector>
using namespace std;
int main()
{
int n;
vector<int> qx1 , qy1 , qx2 , qy2 , qx3 , qy3 , qx4 , qy4;
cin >> n;
int x[n] , y[n];
for(int i = 0 ; i < n ; i++)
{
cin >> x[i] >> y[i];
if(x[i] > 0 && y[i] > 0)
{
qx1.push_back(x[i]);
qy1.push_back(y[i]);
}
else if(x[i] > 0 && y[i] < 0)
{
qx4.push_back(x[i]);
qy4.push_back(y[i]);
}
else if(x[i] < 0 && y[i] < 0)
{
qx3.push_back(x[i]);
qy3.push_back(y[i]);
}
else if(x[i] < 0 && y[i] > 0)
{
qx2.push_back(x[i]);
qy2.push_back(y[i]);
}
}
if(qx1.empty() && qx2.empty() && qx3.empty() && qx4.empty())
{
cout << "No point in any quadrant";
}
return 0;
} | # 2069301, 2024-11-02 10:35:04, xxxx-x--x- (0%)
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
int n;
vector<int> qx1 , qy1 , qx2 , qy2 , qx3 , qy3 , qx4 , qy4;
cin >> n;
int x[n] , y[n];
for(int i = 0 ; i < n ; i++)
{
cin >> x[i] >> y[i];
if(x[i] > 0 && y[i] > 0)
{
qx1.push_back(x[i]);
qy1.push_back(y[i]);
}
else if(x[i] > 0 && y[i] < 0)
{
qx4.push_back(x[i]);
qy4.push_back(y[i]);
}
else if(x[i] < 0 && y[i] < 0)
{
qx3.push_back(x[i]);
qy3.push_back(y[i]);
}
else if(x[i] < 0 && y[i] > 0)
{
qx2.push_back(x[i]);
qy2.push_back(y[i]);
}
}
int maxq1[2] , maxq2[2] , maxq3[2] , maxq4[2] , minq1[2] , minq2[2] , minq3[2] , minq4[2];
maxq1[0] = *max_element(qx1.begin() , qx1.end());
maxq1[1] = *max_element(qy1.begin() , qy1.end());
maxq2[0] = *max_element(qx2.begin() , qx2.end());
maxq2[1] = *max_element(qy2.begin() , qy2.end());
maxq3[0] = *max_element(qx3.begin() , qx3.end());
maxq3[1] = *max_element(qy3.begin() , qy3.end());
maxq4[0] = *max_element(qx4.begin() , qx4.end());
maxq4[1] = *max_element(qy4.begin() , qy4.end());
minq1[0] = *min_element(qx1.begin() , qx1.end());
minq1[1] = *min_element(qy1.begin() , qy1.end());
minq2[0] = *min_element(qx2.begin() , qx2.end());
minq2[1] = *min_element(qy2.begin() , qy2.end());
minq3[0] = *min_element(qx3.begin() , qx3.end());
minq3[1] = *min_element(qy3.begin() , qy3.end());
minq4[0] = *min_element(qx4.begin() , qx4.end());
minq4[1] = *min_element(qy4.begin() , qy4.end());
if(qx1.empty() && qx2.empty() && qx3.empty() && qx4.empty())
{
cout << "No point in any quadrant";
}
if(qx1.begin() != qx1.end())
{
cout << "Q1: (" << minq1[0] << ", " << minq1[1] << ") (" << maxq1[0] << ", " << maxq1[1] << ") " << (maxq1[0] - minq1[0]) * (maxq1[1] - minq1[1]);
}
if(qx2.begin() != qx2.end())
{
cout << "Q2: (" << minq2[0] << ", " << minq2[1] << ") (" << maxq2[0] << ", " << maxq2[1] << ") " << (maxq2[0] - minq2[0]) * (maxq2[1] - minq2[1]);
}
if(qx3.begin() != qx3.end())
{
cout << "Q3: (" << minq3[0] << ", " << minq3[1] << ") (" << maxq3[0] << ", " << maxq3[1] << ") " << (maxq3[0] - minq3[0]) * (maxq3[1] - minq3[1]);
}
if(qx4.begin() != qx4.end())
{
cout << "Q4: (" << minq4[0] << ", " << minq4[1] << ") (" << maxq4[0] << ", " << maxq4[1] << ") " << (maxq4[0] - minq4[0]) * (maxq4[1] - minq4[1]);
}
return 0;
} | # 2069943, 2024-11-02 11:38:48, -----P---- (10%)
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
int n;
vector<int> qx1 , qy1 , qx2 , qy2 , qx3 , qy3 , qx4 , qy4;
cin >> n;
int x[n] , y[n];
for(int i = 0 ; i < n ; i++)
{
cin >> x[i] >> y[i];
if(x[i] > 0 && y[i] > 0)
{
qx1.push_back(x[i]);
qy1.push_back(y[i]);
}
else if(x[i] > 0 && y[i] < 0)
{
qx4.push_back(x[i]);
qy4.push_back(y[i]);
}
else if(x[i] < 0 && y[i] < 0)
{
qx3.push_back(x[i]);
qy3.push_back(y[i]);
}
else if(x[i] < 0 && y[i] > 0)
{
qx2.push_back(x[i]);
qy2.push_back(y[i]);
}
}
int maxqx1 = 0 , minqx1 = qx1[0] , maxqx2 = qx2[0] , minqx2 = 0 , maxqx3 = qx3[0] , minqx3 = 0 , maxqx4 = 0 , minqx4 = qx4[0];
int maxqy1 = 0 , minqy1 = qy1[0] , maxqy2 = qy2[0] , minqy2 = 0 , maxqy3 = qy3[0] , minqy3 = 0 , maxqy4 = 0 , minqy4 = qy4[0];
for(long unsigned int i = 0 ; i < sizeof(qx1) ; i++)
{
if(maxqx1 < qx1[i] && minqx1 > maxqx1)
{
minqx1 = maxqx1;
maxqx1 = qx1[i];
}
else if(maxqx1 < qx1[i] && minqx1 < maxqx1)
{
maxqx1 = qx1[i];
}
else if(minqx1 < qx1[i])
{
minqx1 = qx1[i];
}
}
for(long unsigned int i = 0 ; i < sizeof(qx2) ; i++)
{
if(maxqx2 < qx2[i] && minqx2 > maxqx2)
{
minqx2 = maxqx2;
maxqx2 = qx2[i];
}
else if(maxqx2 < qx2[i] && minqx2 < maxqx2)
{
maxqx2 = qx2[i];
}
else if(minqx2 < qx2[i])
{
minqx2 = qx2[i];
}
}
for(long unsigned int i = 0 ; i < sizeof(qx3) ; i++)
{
if(maxqx3 < qx3[i] && minqx3 > maxqx3)
{
minqx3 = maxqx3;
maxqx3 = qx3[i];
}
else if(maxqx3 < qx3[i] && minqx3 < maxqx3)
{
maxqx3 = qx3[i];
}
else if(minqx3 < qx3[i])
{
minqx3 = qx3[i];
}
}
for(long unsigned int i = 0 ; i < sizeof(qx4) ; i++)
{
if(maxqx4 < qx4[i] && minqx4 > maxqx4)
{
minqx4 = maxqx4;
maxqx4 = qx4[i];
}
else if(maxqx4 < qx4[i] && minqx4 < maxqx4)
{
maxqx4 = qx4[i];
}
else if(minqx4 < qx4[i])
{
minqx4 = qx4[i];
}
}
for(long unsigned int i = 0 ; i < sizeof(qy1) ; i++)
{
if(maxqy1 < qy1[i] && minqy1 > maxqy1)
{
minqy1 = maxqy1;
maxqy1 = qy1[i];
}
else if(maxqy1 < qy1[i] && minqy1 < maxqy1)
{
maxqy1 = qy1[i];
}
else if(minqy1 < qy1[i])
{
minqy1 = qy1[i];
}
}
for(long unsigned int i = 0 ; i < sizeof(qy2) ; i++)
{
if(maxqy2 < qy2[i] && minqy2 > maxqy2)
{
minqy2 = maxqy2;
maxqy2 = qy2[i];
}
else if(maxqy2 < qy2[i] && minqy2 < maxqy2)
{
maxqy2 = qy2[i];
}
else if(minqy2 < qy2[i])
{
minqy2 = qy2[i];
}
}
for(long unsigned int i = 0 ; i < sizeof(qy3) ; i++)
{
if(maxqy3 < qy3[i] && minqy3 > maxqy3)
{
minqy3 = maxqy3;
maxqy3 = qy3[i];
}
else if(maxqy3 < qy3[i] && minqy3 < maxqy3)
{
maxqy3 = qy3[i];
}
else if(minqy3 < qy3[i])
{
minqy3 = qy3[i];
}
}
for(long unsigned int i = 0 ; i < sizeof(qy4) ; i++)
{
if(maxqy4 < qy4[i] && minqy4 > maxqy4)
{
minqy4 = maxqy4;
maxqy4 = qy4[i];
}
else if(maxqy4 < qy4[i] && minqy4 < maxqy4)
{
maxqy4 = qy4[i];
}
else if(minqy4 < qy4[i])
{
minqy4 = qy4[i];
}
}
if(qx1.empty() && qx2.empty() && qx3.empty() && qx4.empty())
{
cout << "No point in any quadrant";
}
return 0;
} | # 2069963, 2024-11-02 11:40:45, -x-x-x--x- (0%)
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
int n;
vector<int> qx1 , qy1 , qx2 , qy2 , qx3 , qy3 , qx4 , qy4;
cin >> n;
int x[n] , y[n];
for(int i = 0 ; i < n ; i++)
{
cin >> x[i] >> y[i];
if(x[i] > 0 && y[i] > 0)
{
qx1.push_back(x[i]);
qy1.push_back(y[i]);
}
else if(x[i] > 0 && y[i] < 0)
{
qx4.push_back(x[i]);
qy4.push_back(y[i]);
}
else if(x[i] < 0 && y[i] < 0)
{
qx3.push_back(x[i]);
qy3.push_back(y[i]);
}
else if(x[i] < 0 && y[i] > 0)
{
qx2.push_back(x[i]);
qy2.push_back(y[i]);
}
}
int maxqx1 = 0 , minqx1 = qx1[0] , maxqx2 = qx2[0] , minqx2 = 0 , maxqx3 = qx3[0] , minqx3 = 0 , maxqx4 = 0 , minqx4 = qx4[0];
int maxqy1 = 0 , minqy1 = qy1[0] , maxqy2 = qy2[0] , minqy2 = 0 , maxqy3 = qy3[0] , minqy3 = 0 , maxqy4 = 0 , minqy4 = qy4[0];
for(long unsigned int i = 0 ; i < sizeof(qx1) ; i++)
{
if(maxqx1 < qx1[i] && minqx1 > maxqx1)
{
minqx1 = maxqx1;
maxqx1 = qx1[i];
}
else if(maxqx1 < qx1[i] && minqx1 < maxqx1)
{
maxqx1 = qx1[i];
}
else if(minqx1 < qx1[i])
{
minqx1 = qx1[i];
}
}
for(long unsigned int i = 0 ; i < sizeof(qx2) ; i++)
{
if(maxqx2 < qx2[i] && minqx2 > maxqx2)
{
minqx2 = maxqx2;
maxqx2 = qx2[i];
}
else if(maxqx2 < qx2[i] && minqx2 < maxqx2)
{
maxqx2 = qx2[i];
}
else if(minqx2 < qx2[i])
{
minqx2 = qx2[i];
}
}
for(long unsigned int i = 0 ; i < sizeof(qx3) ; i++)
{
if(maxqx3 < qx3[i] && minqx3 > maxqx3)
{
minqx3 = maxqx3;
maxqx3 = qx3[i];
}
else if(maxqx3 < qx3[i] && minqx3 < maxqx3)
{
maxqx3 = qx3[i];
}
else if(minqx3 < qx3[i])
{
minqx3 = qx3[i];
}
}
for(long unsigned int i = 0 ; i < sizeof(qx4) ; i++)
{
if(maxqx4 < qx4[i] && minqx4 > maxqx4)
{
minqx4 = maxqx4;
maxqx4 = qx4[i];
}
else if(maxqx4 < qx4[i] && minqx4 < maxqx4)
{
maxqx4 = qx4[i];
}
else if(minqx4 < qx4[i])
{
minqx4 = qx4[i];
}
}
for(long unsigned int i = 0 ; i < sizeof(qy1) ; i++)
{
if(maxqy1 < qy1[i] && minqy1 > maxqy1)
{
minqy1 = maxqy1;
maxqy1 = qy1[i];
}
else if(maxqy1 < qy1[i] && minqy1 < maxqy1)
{
maxqy1 = qy1[i];
}
else if(minqy1 < qy1[i])
{
minqy1 = qy1[i];
}
}
for(long unsigned int i = 0 ; i < sizeof(qy2) ; i++)
{
if(maxqy2 < qy2[i] && minqy2 > maxqy2)
{
minqy2 = maxqy2;
maxqy2 = qy2[i];
}
else if(maxqy2 < qy2[i] && minqy2 < maxqy2)
{
maxqy2 = qy2[i];
}
else if(minqy2 < qy2[i])
{
minqy2 = qy2[i];
}
}
for(long unsigned int i = 0 ; i < sizeof(qy3) ; i++)
{
if(maxqy3 < qy3[i] && minqy3 > maxqy3)
{
minqy3 = maxqy3;
maxqy3 = qy3[i];
}
else if(maxqy3 < qy3[i] && minqy3 < maxqy3)
{
maxqy3 = qy3[i];
}
else if(minqy3 < qy3[i])
{
minqy3 = qy3[i];
}
}
for(long unsigned int i = 0 ; i < sizeof(qy4) ; i++)
{
if(maxqy4 < qy4[i] && minqy4 > maxqy4)
{
minqy4 = maxqy4;
maxqy4 = qy4[i];
}
else if(maxqy4 < qy4[i] && minqy4 < maxqy4)
{
maxqy4 = qy4[i];
}
else if(minqy4 < qy4[i])
{
minqy4 = qy4[i];
}
}
if(qx1.empty() && qx2.empty() && qx3.empty() && qx4.empty())
{
cout << "No point in any quadrant";
}
if(qx1.begin() != qx1.end())
{
cout << "Q1: (" << minqx1 << ", " << minqy1 << ") (" << maxqx1 << ", " << maxqy1 << ") " << (maxqx1 - minqx1) * (maxqy1 - minqy1);
}
return 0;
} | # 2069971, 2024-11-02 11:41:40, -x-x-x--x- (0%)
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
int n;
vector<int> qx1 , qy1 , qx2 , qy2 , qx3 , qy3 , qx4 , qy4;
cin >> n;
int x[n] , y[n];
for(int i = 0 ; i < n ; i++)
{
cin >> x[i] >> y[i];
if(x[i] > 0 && y[i] > 0)
{
qx1.push_back(x[i]);
qy1.push_back(y[i]);
}
else if(x[i] > 0 && y[i] < 0)
{
qx4.push_back(x[i]);
qy4.push_back(y[i]);
}
else if(x[i] < 0 && y[i] < 0)
{
qx3.push_back(x[i]);
qy3.push_back(y[i]);
}
else if(x[i] < 0 && y[i] > 0)
{
qx2.push_back(x[i]);
qy2.push_back(y[i]);
}
}
int maxqx1 = 0 , minqx1 = qx1[0] , maxqx2 = qx2[0] , minqx2 = 0 , maxqx3 = qx3[0] , minqx3 = 0 , maxqx4 = 0 , minqx4 = qx4[0];
int maxqy1 = 0 , minqy1 = qy1[0] , maxqy2 = qy2[0] , minqy2 = 0 , maxqy3 = qy3[0] , minqy3 = 0 , maxqy4 = 0 , minqy4 = qy4[0];
for(long unsigned int i = 0 ; i < sizeof(qx1) ; i++)
{
if(maxqx1 < qx1[i] && minqx1 > maxqx1)
{
minqx1 = maxqx1;
maxqx1 = qx1[i];
}
else if(maxqx1 < qx1[i] && minqx1 < maxqx1)
{
maxqx1 = qx1[i];
}
else if(minqx1 < qx1[i])
{
minqx1 = qx1[i];
}
}
for(long unsigned int i = 0 ; i < sizeof(qx2) ; i++)
{
if(maxqx2 < qx2[i] && minqx2 > maxqx2)
{
minqx2 = maxqx2;
maxqx2 = qx2[i];
}
else if(maxqx2 < qx2[i] && minqx2 < maxqx2)
{
maxqx2 = qx2[i];
}
else if(minqx2 < qx2[i])
{
minqx2 = qx2[i];
}
}
for(long unsigned int i = 0 ; i < sizeof(qx3) ; i++)
{
if(maxqx3 < qx3[i] && minqx3 > maxqx3)
{
minqx3 = maxqx3;
maxqx3 = qx3[i];
}
else if(maxqx3 < qx3[i] && minqx3 < maxqx3)
{
maxqx3 = qx3[i];
}
else if(minqx3 < qx3[i])
{
minqx3 = qx3[i];
}
}
for(long unsigned int i = 0 ; i < sizeof(qx4) ; i++)
{
if(maxqx4 < qx4[i] && minqx4 > maxqx4)
{
minqx4 = maxqx4;
maxqx4 = qx4[i];
}
else if(maxqx4 < qx4[i] && minqx4 < maxqx4)
{
maxqx4 = qx4[i];
}
else if(minqx4 < qx4[i])
{
minqx4 = qx4[i];
}
}
for(long unsigned int i = 0 ; i < sizeof(qy1) ; i++)
{
if(maxqy1 < qy1[i] && minqy1 > maxqy1)
{
minqy1 = maxqy1;
maxqy1 = qy1[i];
}
else if(maxqy1 < qy1[i] && minqy1 < maxqy1)
{
maxqy1 = qy1[i];
}
else if(minqy1 < qy1[i])
{
minqy1 = qy1[i];
}
}
for(long unsigned int i = 0 ; i < sizeof(qy2) ; i++)
{
if(maxqy2 < qy2[i] && minqy2 > maxqy2)
{
minqy2 = maxqy2;
maxqy2 = qy2[i];
}
else if(maxqy2 < qy2[i] && minqy2 < maxqy2)
{
maxqy2 = qy2[i];
}
else if(minqy2 < qy2[i])
{
minqy2 = qy2[i];
}
}
for(long unsigned int i = 0 ; i < sizeof(qy3) ; i++)
{
if(maxqy3 < qy3[i] && minqy3 > maxqy3)
{
minqy3 = maxqy3;
maxqy3 = qy3[i];
}
else if(maxqy3 < qy3[i] && minqy3 < maxqy3)
{
maxqy3 = qy3[i];
}
else if(minqy3 < qy3[i])
{
minqy3 = qy3[i];
}
}
for(long unsigned int i = 0 ; i < sizeof(qy4) ; i++)
{
if(maxqy4 < qy4[i] && minqy4 > maxqy4)
{
minqy4 = maxqy4;
maxqy4 = qy4[i];
}
else if(maxqy4 < qy4[i] && minqy4 < maxqy4)
{
maxqy4 = qy4[i];
}
else if(minqy4 < qy4[i])
{
minqy4 = qy4[i];
}
}
if(qx1.empty() && qx2.empty() && qx3.empty() && qx4.empty())
{
cout << "No point in any quadrant";
}
if(qx1.empty() == 0)
{
cout << "Q1: (" << minqx1 << ", " << minqy1 << ") (" << maxqx1 << ", " << maxqy1 << ") " << (maxqx1 - minqx1) * (maxqy1 - minqy1);
}
return 0;
} | # 2069987, 2024-11-02 11:42:57, -x-x-x--x- (0%)
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
int n;
vector<int> qx1 , qy1 , qx2 , qy2 , qx3 , qy3 , qx4 , qy4;
cin >> n;
int x[n] , y[n];
for(int i = 0 ; i < n ; i++)
{
cin >> x[i] >> y[i];
if(x[i] > 0 && y[i] > 0)
{
qx1.push_back(x[i]);
qy1.push_back(y[i]);
}
else if(x[i] > 0 && y[i] < 0)
{
qx4.push_back(x[i]);
qy4.push_back(y[i]);
}
else if(x[i] < 0 && y[i] < 0)
{
qx3.push_back(x[i]);
qy3.push_back(y[i]);
}
else if(x[i] < 0 && y[i] > 0)
{
qx2.push_back(x[i]);
qy2.push_back(y[i]);
}
}
int maxqx1 = 0 , minqx1 = qx1[0] , maxqx2 = qx2[0] , minqx2 = 0 , maxqx3 = qx3[0] , minqx3 = 0 , maxqx4 = 0 , minqx4 = qx4[0];
int maxqy1 = 0 , minqy1 = qy1[0] , maxqy2 = qy2[0] , minqy2 = 0 , maxqy3 = qy3[0] , minqy3 = 0 , maxqy4 = 0 , minqy4 = qy4[0];
for(long unsigned int i = 0 ; i < sizeof(qx1) ; i++)
{
if(maxqx1 < qx1[i] && minqx1 > maxqx1)
{
minqx1 = maxqx1;
maxqx1 = qx1[i];
}
else if(maxqx1 < qx1[i] && minqx1 < maxqx1)
{
maxqx1 = qx1[i];
}
else if(minqx1 < qx1[i])
{
minqx1 = qx1[i];
}
}
for(long unsigned int i = 0 ; i < sizeof(qx2) ; i++)
{
if(maxqx2 < qx2[i] && minqx2 > maxqx2)
{
minqx2 = maxqx2;
maxqx2 = qx2[i];
}
else if(maxqx2 < qx2[i] && minqx2 < maxqx2)
{
maxqx2 = qx2[i];
}
else if(minqx2 < qx2[i])
{
minqx2 = qx2[i];
}
}
for(long unsigned int i = 0 ; i < sizeof(qx3) ; i++)
{
if(maxqx3 < qx3[i] && minqx3 > maxqx3)
{
minqx3 = maxqx3;
maxqx3 = qx3[i];
}
else if(maxqx3 < qx3[i] && minqx3 < maxqx3)
{
maxqx3 = qx3[i];
}
else if(minqx3 < qx3[i])
{
minqx3 = qx3[i];
}
}
for(long unsigned int i = 0 ; i < sizeof(qx4) ; i++)
{
if(maxqx4 < qx4[i] && minqx4 > maxqx4)
{
minqx4 = maxqx4;
maxqx4 = qx4[i];
}
else if(maxqx4 < qx4[i] && minqx4 < maxqx4)
{
maxqx4 = qx4[i];
}
else if(minqx4 < qx4[i])
{
minqx4 = qx4[i];
}
}
for(long unsigned int i = 0 ; i < sizeof(qy1) ; i++)
{
if(maxqy1 < qy1[i] && minqy1 > maxqy1)
{
minqy1 = maxqy1;
maxqy1 = qy1[i];
}
else if(maxqy1 < qy1[i] && minqy1 < maxqy1)
{
maxqy1 = qy1[i];
}
else if(minqy1 < qy1[i])
{
minqy1 = qy1[i];
}
}
for(long unsigned int i = 0 ; i < sizeof(qy2) ; i++)
{
if(maxqy2 < qy2[i] && minqy2 > maxqy2)
{
minqy2 = maxqy2;
maxqy2 = qy2[i];
}
else if(maxqy2 < qy2[i] && minqy2 < maxqy2)
{
maxqy2 = qy2[i];
}
else if(minqy2 < qy2[i])
{
minqy2 = qy2[i];
}
}
for(long unsigned int i = 0 ; i < sizeof(qy3) ; i++)
{
if(maxqy3 < qy3[i] && minqy3 > maxqy3)
{
minqy3 = maxqy3;
maxqy3 = qy3[i];
}
else if(maxqy3 < qy3[i] && minqy3 < maxqy3)
{
maxqy3 = qy3[i];
}
else if(minqy3 < qy3[i])
{
minqy3 = qy3[i];
}
}
for(long unsigned int i = 0 ; i < sizeof(qy4) ; i++)
{
if(maxqy4 < qy4[i] && minqy4 > maxqy4)
{
minqy4 = maxqy4;
maxqy4 = qy4[i];
}
else if(maxqy4 < qy4[i] && minqy4 < maxqy4)
{
maxqy4 = qy4[i];
}
else if(minqy4 < qy4[i])
{
minqy4 = qy4[i];
}
}
if(qx1.empty() && qx2.empty() && qx3.empty() && qx4.empty())
{
cout << "No point in any quadrant";
}
if(maxqx1 != 0)
{
cout << "Q1: (" << minqx1 << ", " << minqy1 << ") (" << maxqx1 << ", " << maxqy1 << ") " << (maxqx1 - minqx1) * (maxqy1 - minqy1);
}
return 0;
} | # 2069993, 2024-11-02 11:43:37, -x-x-x--x- (0%)
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
int n;
vector<int> qx1 , qy1 , qx2 , qy2 , qx3 , qy3 , qx4 , qy4;
cin >> n;
int x[n] , y[n];
for(int i = 0 ; i < n ; i++)
{
cin >> x[i] >> y[i];
if(x[i] > 0 && y[i] > 0)
{
qx1.push_back(x[i]);
qy1.push_back(y[i]);
}
else if(x[i] > 0 && y[i] < 0)
{
qx4.push_back(x[i]);
qy4.push_back(y[i]);
}
else if(x[i] < 0 && y[i] < 0)
{
qx3.push_back(x[i]);
qy3.push_back(y[i]);
}
else if(x[i] < 0 && y[i] > 0)
{
qx2.push_back(x[i]);
qy2.push_back(y[i]);
}
}
int maxqx1 = 0 , minqx1 = qx1[0] , maxqx2 = qx2[0] , minqx2 = 0 , maxqx3 = qx3[0] , minqx3 = 0 , maxqx4 = 0 , minqx4 = qx4[0];
int maxqy1 = 0 , minqy1 = qy1[0] , maxqy2 = qy2[0] , minqy2 = 0 , maxqy3 = qy3[0] , minqy3 = 0 , maxqy4 = 0 , minqy4 = qy4[0];
for(long unsigned int i = 0 ; i < sizeof(qx1) ; i++)
{
if(maxqx1 < qx1[i] && minqx1 > maxqx1)
{
minqx1 = maxqx1;
maxqx1 = qx1[i];
}
else if(maxqx1 < qx1[i] && minqx1 < maxqx1)
{
maxqx1 = qx1[i];
}
else if(minqx1 < qx1[i])
{
minqx1 = qx1[i];
}
}
for(long unsigned int i = 0 ; i < sizeof(qx2) ; i++)
{
if(maxqx2 < qx2[i] && minqx2 > maxqx2)
{
minqx2 = maxqx2;
maxqx2 = qx2[i];
}
else if(maxqx2 < qx2[i] && minqx2 < maxqx2)
{
maxqx2 = qx2[i];
}
else if(minqx2 < qx2[i])
{
minqx2 = qx2[i];
}
}
for(long unsigned int i = 0 ; i < sizeof(qx3) ; i++)
{
if(maxqx3 < qx3[i] && minqx3 > maxqx3)
{
minqx3 = maxqx3;
maxqx3 = qx3[i];
}
else if(maxqx3 < qx3[i] && minqx3 < maxqx3)
{
maxqx3 = qx3[i];
}
else if(minqx3 < qx3[i])
{
minqx3 = qx3[i];
}
}
for(long unsigned int i = 0 ; i < sizeof(qx4) ; i++)
{
if(maxqx4 < qx4[i] && minqx4 > maxqx4)
{
minqx4 = maxqx4;
maxqx4 = qx4[i];
}
else if(maxqx4 < qx4[i] && minqx4 < maxqx4)
{
maxqx4 = qx4[i];
}
else if(minqx4 < qx4[i])
{
minqx4 = qx4[i];
}
}
for(long unsigned int i = 0 ; i < sizeof(qy1) ; i++)
{
if(maxqy1 < qy1[i] && minqy1 > maxqy1)
{
minqy1 = maxqy1;
maxqy1 = qy1[i];
}
else if(maxqy1 < qy1[i] && minqy1 < maxqy1)
{
maxqy1 = qy1[i];
}
else if(minqy1 < qy1[i])
{
minqy1 = qy1[i];
}
}
for(long unsigned int i = 0 ; i < sizeof(qy2) ; i++)
{
if(maxqy2 < qy2[i] && minqy2 > maxqy2)
{
minqy2 = maxqy2;
maxqy2 = qy2[i];
}
else if(maxqy2 < qy2[i] && minqy2 < maxqy2)
{
maxqy2 = qy2[i];
}
else if(minqy2 < qy2[i])
{
minqy2 = qy2[i];
}
}
for(long unsigned int i = 0 ; i < sizeof(qy3) ; i++)
{
if(maxqy3 < qy3[i] && minqy3 > maxqy3)
{
minqy3 = maxqy3;
maxqy3 = qy3[i];
}
else if(maxqy3 < qy3[i] && minqy3 < maxqy3)
{
maxqy3 = qy3[i];
}
else if(minqy3 < qy3[i])
{
minqy3 = qy3[i];
}
}
for(long unsigned int i = 0 ; i < sizeof(qy4) ; i++)
{
if(maxqy4 < qy4[i] && minqy4 > maxqy4)
{
minqy4 = maxqy4;
maxqy4 = qy4[i];
}
else if(maxqy4 < qy4[i] && minqy4 < maxqy4)
{
maxqy4 = qy4[i];
}
else if(minqy4 < qy4[i])
{
minqy4 = qy4[i];
}
}
if(qx1.empty() && qx2.empty() && qx3.empty() && qx4.empty())
{
cout << "No point in any quadrant";
}
if(maxqx1 != 0)
{
cout << "Q1: (" << minqx1 << "," << minqy1 << ") (" << maxqx1 << "," << maxqy1 << ") " << (maxqx1 - minqx1) * (maxqy1 - minqy1);
}
return 0;
} | # 2070031, 2024-11-02 11:45:51, xxxx-x--x- (0%)
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
int n;
vector<int> qx1 , qy1 , qx2 , qy2 , qx3 , qy3 , qx4 , qy4;
cin >> n;
int x[n] , y[n];
for(int i = 0 ; i < n ; i++)
{
cin >> x[i] >> y[i];
if(x[i] > 0 && y[i] > 0)
{
qx1.push_back(x[i]);
qy1.push_back(y[i]);
}
else if(x[i] > 0 && y[i] < 0)
{
qx4.push_back(x[i]);
qy4.push_back(y[i]);
}
else if(x[i] < 0 && y[i] < 0)
{
qx3.push_back(x[i]);
qy3.push_back(y[i]);
}
else if(x[i] < 0 && y[i] > 0)
{
qx2.push_back(x[i]);
qy2.push_back(y[i]);
}
}
int maxqx1 = 0 , minqx1 = qx1[0] , maxqx2 = qx2[0] , minqx2 = 0 , maxqx3 = qx3[0] , minqx3 = 0 , maxqx4 = 0 , minqx4 = qx4[0];
int maxqy1 = 0 , minqy1 = qy1[0] , maxqy2 = qy2[0] , minqy2 = 0 , maxqy3 = qy3[0] , minqy3 = 0 , maxqy4 = 0 , minqy4 = qy4[0];
for(long unsigned int i = 0 ; i < sizeof(qx1) ; i++)
{
if(maxqx1 < qx1[i] && minqx1 > maxqx1)
{
minqx1 = maxqx1;
maxqx1 = qx1[i];
}
else if(maxqx1 < qx1[i] && minqx1 < maxqx1)
{
maxqx1 = qx1[i];
}
else if(minqx1 < qx1[i])
{
minqx1 = qx1[i];
}
}
for(long unsigned int i = 0 ; i < sizeof(qx2) ; i++)
{
if(maxqx2 < qx2[i] && minqx2 > maxqx2)
{
minqx2 = maxqx2;
maxqx2 = qx2[i];
}
else if(maxqx2 < qx2[i] && minqx2 < maxqx2)
{
maxqx2 = qx2[i];
}
else if(minqx2 < qx2[i])
{
minqx2 = qx2[i];
}
}
for(long unsigned int i = 0 ; i < sizeof(qx3) ; i++)
{
if(maxqx3 < qx3[i] && minqx3 > maxqx3)
{
minqx3 = maxqx3;
maxqx3 = qx3[i];
}
else if(maxqx3 < qx3[i] && minqx3 < maxqx3)
{
maxqx3 = qx3[i];
}
else if(minqx3 < qx3[i])
{
minqx3 = qx3[i];
}
}
for(long unsigned int i = 0 ; i < sizeof(qx4) ; i++)
{
if(maxqx4 < qx4[i] && minqx4 > maxqx4)
{
minqx4 = maxqx4;
maxqx4 = qx4[i];
}
else if(maxqx4 < qx4[i] && minqx4 < maxqx4)
{
maxqx4 = qx4[i];
}
else if(minqx4 < qx4[i])
{
minqx4 = qx4[i];
}
}
for(long unsigned int i = 0 ; i < sizeof(qy1) ; i++)
{
if(maxqy1 < qy1[i] && minqy1 > maxqy1)
{
minqy1 = maxqy1;
maxqy1 = qy1[i];
}
else if(maxqy1 < qy1[i] && minqy1 < maxqy1)
{
maxqy1 = qy1[i];
}
else if(minqy1 < qy1[i])
{
minqy1 = qy1[i];
}
}
for(long unsigned int i = 0 ; i < sizeof(qy2) ; i++)
{
if(maxqy2 < qy2[i] && minqy2 > maxqy2)
{
minqy2 = maxqy2;
maxqy2 = qy2[i];
}
else if(maxqy2 < qy2[i] && minqy2 < maxqy2)
{
maxqy2 = qy2[i];
}
else if(minqy2 < qy2[i])
{
minqy2 = qy2[i];
}
}
for(long unsigned int i = 0 ; i < sizeof(qy3) ; i++)
{
if(maxqy3 < qy3[i] && minqy3 > maxqy3)
{
minqy3 = maxqy3;
maxqy3 = qy3[i];
}
else if(maxqy3 < qy3[i] && minqy3 < maxqy3)
{
maxqy3 = qy3[i];
}
else if(minqy3 < qy3[i])
{
minqy3 = qy3[i];
}
}
for(long unsigned int i = 0 ; i < sizeof(qy4) ; i++)
{
if(maxqy4 < qy4[i] && minqy4 > maxqy4)
{
minqy4 = maxqy4;
maxqy4 = qy4[i];
}
else if(maxqy4 < qy4[i] && minqy4 < maxqy4)
{
maxqy4 = qy4[i];
}
else if(minqy4 < qy4[i])
{
minqy4 = qy4[i];
}
}
if(qx1.empty() && qx2.empty() && qx3.empty() && qx4.empty())
{
cout << "No point in any quadrant";
}
if(maxqx1 != 0)
{
cout << "Q1: (" << minqx1 << ", " << minqy1 << ") (" << maxqx1 << ", " << maxqy1 << ") " << (maxqx1 - minqx1) * (maxqy1 - minqy1);
}
if(maxqx2 != 0)
{
cout << "Q2: (" << minqx2 << ", " << minqy2 << ") (" << maxqx2 << ", " << maxqy2 << ") " << (maxqx2 - minqx2) * (maxqy2 - minqy2);
}
if(maxqx3 != 0)
{
cout << "Q3: (" << minqx3 << ", " << minqy3 << ") (" << maxqx3 << ", " << maxqy3 << ") " << (maxqx3 - minqx3) * (maxqy3 - minqy3);
}
if(maxqx4 != 0)
{
cout << "Q4: (" << minqx4 << ", " << minqy4 << ") (" << maxqx4 << ", " << maxqy4 << ") " << (maxqx4 - minqx4) * (maxqy4 - minqy4);
}
return 0;
} | # 2070047, 2024-11-02 11:47:04, xxxx-x--x- (0%)
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
int n;
vector<int> qx1 , qy1 , qx2 , qy2 , qx3 , qy3 , qx4 , qy4;
cin >> n;
int x[n] , y[n];
for(int i = 0 ; i < n ; i++)
{
cin >> x[i] >> y[i];
if(x[i] > 0 && y[i] > 0)
{
qx1.push_back(x[i]);
qy1.push_back(y[i]);
}
else if(x[i] > 0 && y[i] < 0)
{
qx4.push_back(x[i]);
qy4.push_back(y[i]);
}
else if(x[i] < 0 && y[i] < 0)
{
qx3.push_back(x[i]);
qy3.push_back(y[i]);
}
else if(x[i] < 0 && y[i] > 0)
{
qx2.push_back(x[i]);
qy2.push_back(y[i]);
}
}
int maxqx1 = 0 , minqx1 = qx1[0] , maxqx2 = qx2[0] , minqx2 = 0 , maxqx3 = qx3[0] , minqx3 = 0 , maxqx4 = 0 , minqx4 = qx4[0];
int maxqy1 = 0 , minqy1 = qy1[0] , maxqy2 = qy2[0] , minqy2 = 0 , maxqy3 = qy3[0] , minqy3 = 0 , maxqy4 = 0 , minqy4 = qy4[0];
for(long unsigned int i = 0 ; i < sizeof(qx1) ; i++)
{
if(maxqx1 < qx1[i] && minqx1 > maxqx1)
{
minqx1 = maxqx1;
maxqx1 = qx1[i];
}
else if(maxqx1 < qx1[i] && minqx1 < maxqx1)
{
maxqx1 = qx1[i];
}
else if(minqx1 < qx1[i])
{
minqx1 = qx1[i];
}
}
for(long unsigned int i = 0 ; i < sizeof(qx2) ; i++)
{
if(maxqx2 < qx2[i] && minqx2 > maxqx2)
{
minqx2 = maxqx2;
maxqx2 = qx2[i];
}
else if(maxqx2 < qx2[i] && minqx2 < maxqx2)
{
maxqx2 = qx2[i];
}
else if(minqx2 < qx2[i])
{
minqx2 = qx2[i];
}
}
for(long unsigned int i = 0 ; i < sizeof(qx3) ; i++)
{
if(maxqx3 < qx3[i] && minqx3 > maxqx3)
{
minqx3 = maxqx3;
maxqx3 = qx3[i];
}
else if(maxqx3 < qx3[i] && minqx3 < maxqx3)
{
maxqx3 = qx3[i];
}
else if(minqx3 < qx3[i])
{
minqx3 = qx3[i];
}
}
for(long unsigned int i = 0 ; i < sizeof(qx4) ; i++)
{
if(maxqx4 < qx4[i] && minqx4 > maxqx4)
{
minqx4 = maxqx4;
maxqx4 = qx4[i];
}
else if(maxqx4 < qx4[i] && minqx4 < maxqx4)
{
maxqx4 = qx4[i];
}
else if(minqx4 < qx4[i])
{
minqx4 = qx4[i];
}
}
for(long unsigned int i = 0 ; i < sizeof(qy1) ; i++)
{
if(maxqy1 < qy1[i] && minqy1 > maxqy1)
{
minqy1 = maxqy1;
maxqy1 = qy1[i];
}
else if(maxqy1 < qy1[i] && minqy1 < maxqy1)
{
maxqy1 = qy1[i];
}
else if(minqy1 < qy1[i])
{
minqy1 = qy1[i];
}
}
for(long unsigned int i = 0 ; i < sizeof(qy2) ; i++)
{
if(maxqy2 < qy2[i] && minqy2 > maxqy2)
{
minqy2 = maxqy2;
maxqy2 = qy2[i];
}
else if(maxqy2 < qy2[i] && minqy2 < maxqy2)
{
maxqy2 = qy2[i];
}
else if(minqy2 < qy2[i])
{
minqy2 = qy2[i];
}
}
for(long unsigned int i = 0 ; i < sizeof(qy3) ; i++)
{
if(maxqy3 < qy3[i] && minqy3 > maxqy3)
{
minqy3 = maxqy3;
maxqy3 = qy3[i];
}
else if(maxqy3 < qy3[i] && minqy3 < maxqy3)
{
maxqy3 = qy3[i];
}
else if(minqy3 < qy3[i])
{
minqy3 = qy3[i];
}
}
for(long unsigned int i = 0 ; i < sizeof(qy4) ; i++)
{
if(maxqy4 < qy4[i] && minqy4 > maxqy4)
{
minqy4 = maxqy4;
maxqy4 = qy4[i];
}
else if(maxqy4 < qy4[i] && minqy4 < maxqy4)
{
maxqy4 = qy4[i];
}
else if(minqy4 < qy4[i])
{
minqy4 = qy4[i];
}
}
if(qx1.empty() && qx2.empty() && qx3.empty() && qx4.empty())
{
cout << "No point in any quadrant";
}
if(maxqx1 != 0)
{
cout << "Q1: (" << minqx1 << ", " << minqy1 << ") (" << maxqx1 << ", " << maxqy1 << ") " << " " << (maxqx1 - minqx1) * (maxqy1 - minqy1);
}
if(maxqx2 != 0)
{
cout << "Q2: (" << minqx2 << ", " << minqy2 << ") (" << maxqx2 << ", " << maxqy2 << ") " << " " << (maxqx2 - minqx2) * (maxqy2 - minqy2);
}
if(maxqx3 != 0)
{
cout << "Q3: (" << minqx3 << ", " << minqy3 << ") (" << maxqx3 << ", " << maxqy3 << ") " << " " << (maxqx3 - minqx3) * (maxqy3 - minqy3);
}
if(maxqx4 != 0)
{
cout << "Q4: (" << minqx4 << ", " << minqy4 << ") (" << maxqx4 << ", " << maxqy4 << ") " << " " << (maxqx4 - minqx4) * (maxqy4 - minqy4);
}
return 0;
} | # 2070439, 2024-11-02 12:08:39, xxxx-x--x- (0%)
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
int n;
vector<int> qx1 , qy1 , qx2 , qy2 , qx3 , qy3 , qx4 , qy4;
cin >> n;
int x[n] , y[n];
for(int i = 0 ; i < n ; i++)
{
cin >> x[i] >> y[i];
if(x[i] > 0 && y[i] > 0)
{
qx1.push_back(x[i]);
qy1.push_back(y[i]);
}
else if(x[i] > 0 && y[i] < 0)
{
qx4.push_back(x[i]);
qy4.push_back(y[i]);
}
else if(x[i] < 0 && y[i] < 0)
{
qx3.push_back(x[i]);
qy3.push_back(y[i]);
}
else if(x[i] < 0 && y[i] > 0)
{
qx2.push_back(x[i]);
qy2.push_back(y[i]);
}
}
int maxqx1 = 0 , minqx1 = qx1[0] , maxqx2 = qx2[0] , minqx2 = 0 , maxqx3 = qx3[0] , minqx3 = 0 , maxqx4 = 0 , minqx4 = qx4[0];
int maxqy1 = 0 , minqy1 = qy1[0] , maxqy2 = qy2[0] , minqy2 = 0 , maxqy3 = qy3[0] , minqy3 = 0 , maxqy4 = 0 , minqy4 = qy4[0];
for(long unsigned int i = 0 ; i < qx1.size() ; i++)
{
if(maxqx1 < qx1[i] && minqx1 > maxqx1)
{
minqx1 = maxqx1;
maxqx1 = qx1[i];
}
else if(maxqx1 < qx1[i] && minqx1 < maxqx1)
{
maxqx1 = qx1[i];
}
else if(minqx1 < qx1[i])
{
minqx1 = qx1[i];
}
}
for(long unsigned int i = 0 ; i < sizeof(qx2) ; i++)
{
if(maxqx2 < qx2[i] && minqx2 > maxqx2)
{
minqx2 = maxqx2;
maxqx2 = qx2[i];
}
else if(maxqx2 < qx2[i] && minqx2 < maxqx2)
{
maxqx2 = qx2[i];
}
else if(minqx2 < qx2[i])
{
minqx2 = qx2[i];
}
}
for(long unsigned int i = 0 ; i < sizeof(qx3) ; i++)
{
if(maxqx3 < qx3[i] && minqx3 > maxqx3)
{
minqx3 = maxqx3;
maxqx3 = qx3[i];
}
else if(maxqx3 < qx3[i] && minqx3 < maxqx3)
{
maxqx3 = qx3[i];
}
else if(minqx3 < qx3[i])
{
minqx3 = qx3[i];
}
}
for(long unsigned int i = 0 ; i < sizeof(qx4) ; i++)
{
if(maxqx4 < qx4[i] && minqx4 > maxqx4)
{
minqx4 = maxqx4;
maxqx4 = qx4[i];
}
else if(maxqx4 < qx4[i] && minqx4 < maxqx4)
{
maxqx4 = qx4[i];
}
else if(minqx4 < qx4[i])
{
minqx4 = qx4[i];
}
}
for(long unsigned int i = 0 ; i < sizeof(qy1) ; i++)
{
if(maxqy1 < qy1[i] && minqy1 > maxqy1)
{
minqy1 = maxqy1;
maxqy1 = qy1[i];
}
else if(maxqy1 < qy1[i] && minqy1 < maxqy1)
{
maxqy1 = qy1[i];
}
else if(minqy1 < qy1[i])
{
minqy1 = qy1[i];
}
}
for(long unsigned int i = 0 ; i < sizeof(qy2) ; i++)
{
if(maxqy2 < qy2[i] && minqy2 > maxqy2)
{
minqy2 = maxqy2;
maxqy2 = qy2[i];
}
else if(maxqy2 < qy2[i] && minqy2 < maxqy2)
{
maxqy2 = qy2[i];
}
else if(minqy2 < qy2[i])
{
minqy2 = qy2[i];
}
}
for(long unsigned int i = 0 ; i < sizeof(qy3) ; i++)
{
if(maxqy3 < qy3[i] && minqy3 > maxqy3)
{
minqy3 = maxqy3;
maxqy3 = qy3[i];
}
else if(maxqy3 < qy3[i] && minqy3 < maxqy3)
{
maxqy3 = qy3[i];
}
else if(minqy3 < qy3[i])
{
minqy3 = qy3[i];
}
}
for(long unsigned int i = 0 ; i < sizeof(qy4) ; i++)
{
if(maxqy4 < qy4[i] && minqy4 > maxqy4)
{
minqy4 = maxqy4;
maxqy4 = qy4[i];
}
else if(maxqy4 < qy4[i] && minqy4 < maxqy4)
{
maxqy4 = qy4[i];
}
else if(minqy4 < qy4[i])
{
minqy4 = qy4[i];
}
}
if(qx1.empty() && qx2.empty() && qx3.empty() && qx4.empty())
{
cout << "No point in any quadrant";
}
if(maxqx1 != 0)
{
cout << "Q1: (" << minqx1 << ", " << minqy1 << ") (" << maxqx1 << ", " << maxqy1 << ") " << " " << (maxqx1 - minqx1) * (maxqy1 - minqy1);
}
if(maxqx2 != 0)
{
cout << "Q2: (" << minqx2 << ", " << minqy2 << ") (" << maxqx2 << ", " << maxqy2 << ") " << " " << (maxqx2 - minqx2) * (maxqy2 - minqy2);
}
if(maxqx3 != 0)
{
cout << "Q3: (" << minqx3 << ", " << minqy3 << ") (" << maxqx3 << ", " << maxqy3 << ") " << " " << (maxqx3 - minqx3) * (maxqy3 - minqy3);
}
if(maxqx4 != 0)
{
cout << "Q4: (" << minqx4 << ", " << minqy4 << ") (" << maxqx4 << ", " << maxqy4 << ") " << " " << (maxqx4 - minqx4) * (maxqy4 - minqy4);
}
return 0;
} | # 2070484, 2024-11-02 12:10:12, xxxx-x--x- (0%)
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
int n;
vector<int> qx1 , qy1 , qx2 , qy2 , qx3 , qy3 , qx4 , qy4;
cin >> n;
int x[n] , y[n];
for(int i = 0 ; i < n ; i++)
{
cin >> x[i] >> y[i];
if(x[i] > 0 && y[i] > 0)
{
qx1.push_back(x[i]);
qy1.push_back(y[i]);
}
else if(x[i] > 0 && y[i] < 0)
{
qx4.push_back(x[i]);
qy4.push_back(y[i]);
}
else if(x[i] < 0 && y[i] < 0)
{
qx3.push_back(x[i]);
qy3.push_back(y[i]);
}
else if(x[i] < 0 && y[i] > 0)
{
qx2.push_back(x[i]);
qy2.push_back(y[i]);
}
}
int maxqx1 = 0 , minqx1 = qx1[0] , maxqx2 = qx2[0] , minqx2 = 0 , maxqx3 = qx3[0] , minqx3 = 0 , maxqx4 = 0 , minqx4 = qx4[0];
int maxqy1 = 0 , minqy1 = qy1[0] , maxqy2 = qy2[0] , minqy2 = 0 , maxqy3 = qy3[0] , minqy3 = 0 , maxqy4 = 0 , minqy4 = qy4[0];
for(long unsigned int i = 0 ; i < qx1.size() ; i++)
{
if(maxqx1 < qx1[i] && minqx1 > maxqx1)
{
minqx1 = maxqx1;
maxqx1 = qx1[i];
}
else if(maxqx1 < qx1[i] && minqx1 < maxqx1)
{
maxqx1 = qx1[i];
}
else if(minqx1 < qx1[i])
{
minqx1 = qx1[i];
}
}
for(long unsigned int i = 0 ; i < qx2.size() ; i++)
{
if(maxqx2 < qx2[i] && minqx2 > maxqx2)
{
minqx2 = maxqx2;
maxqx2 = qx2[i];
}
else if(maxqx2 < qx2[i] && minqx2 < maxqx2)
{
maxqx2 = qx2[i];
}
else if(minqx2 < qx2[i])
{
minqx2 = qx2[i];
}
}
for(long unsigned int i = 0 ; i < qx3.size() ; i++)
{
if(maxqx3 < qx3[i] && minqx3 > maxqx3)
{
minqx3 = maxqx3;
maxqx3 = qx3[i];
}
else if(maxqx3 < qx3[i] && minqx3 < maxqx3)
{
maxqx3 = qx3[i];
}
else if(minqx3 < qx3[i])
{
minqx3 = qx3[i];
}
}
for(long unsigned int i = 0 ; i < qx4.size() ; i++)
{
if(maxqx4 < qx4[i] && minqx4 > maxqx4)
{
minqx4 = maxqx4;
maxqx4 = qx4[i];
}
else if(maxqx4 < qx4[i] && minqx4 < maxqx4)
{
maxqx4 = qx4[i];
}
else if(minqx4 < qx4[i])
{
minqx4 = qx4[i];
}
}
for(long unsigned int i = 0 ; i < qy1.size() ; i++)
{
if(maxqy1 < qy1[i] && minqy1 > maxqy1)
{
minqy1 = maxqy1;
maxqy1 = qy1[i];
}
else if(maxqy1 < qy1[i] && minqy1 < maxqy1)
{
maxqy1 = qy1[i];
}
else if(minqy1 < qy1[i])
{
minqy1 = qy1[i];
}
}
for(long unsigned int i = 0 ; i < qy2.size() ; i++)
{
if(maxqy2 < qy2[i] && minqy2 > maxqy2)
{
minqy2 = maxqy2;
maxqy2 = qy2[i];
}
else if(maxqy2 < qy2[i] && minqy2 < maxqy2)
{
maxqy2 = qy2[i];
}
else if(minqy2 < qy2[i])
{
minqy2 = qy2[i];
}
}
for(long unsigned int i = 0 ; i < qy3.size() ; i++)
{
if(maxqy3 < qy3[i] && minqy3 > maxqy3)
{
minqy3 = maxqy3;
maxqy3 = qy3[i];
}
else if(maxqy3 < qy3[i] && minqy3 < maxqy3)
{
maxqy3 = qy3[i];
}
else if(minqy3 < qy3[i])
{
minqy3 = qy3[i];
}
}
for(long unsigned int i = 0 ; i < qy4.size() ; i++)
{
if(maxqy4 < qy4[i] && minqy4 > maxqy4)
{
minqy4 = maxqy4;
maxqy4 = qy4[i];
}
else if(maxqy4 < qy4[i] && minqy4 < maxqy4)
{
maxqy4 = qy4[i];
}
else if(minqy4 < qy4[i])
{
minqy4 = qy4[i];
}
}
if(qx1.empty() && qx2.empty() && qx3.empty() && qx4.empty())
{
cout << "No point in any quadrant";
}
if(maxqx1 != 0)
{
cout << "Q1: (" << minqx1 << ", " << minqy1 << ") (" << maxqx1 << ", " << maxqy1 << ") " << " " << (maxqx1 - minqx1) * (maxqy1 - minqy1);
}
if(maxqx2 != 0)
{
cout << "Q2: (" << minqx2 << ", " << minqy2 << ") (" << maxqx2 << ", " << maxqy2 << ") " << " " << (maxqx2 - minqx2) * (maxqy2 - minqy2);
}
if(maxqx3 != 0)
{
cout << "Q3: (" << minqx3 << ", " << minqy3 << ") (" << maxqx3 << ", " << maxqy3 << ") " << " " << (maxqx3 - minqx3) * (maxqy3 - minqy3);
}
if(maxqx4 != 0)
{
cout << "Q4: (" << minqx4 << ", " << minqy4 << ") (" << maxqx4 << ", " << maxqy4 << ") " << " " << (maxqx4 - minqx4) * (maxqy4 - minqy4);
}
return 0;
} | # 2070494, 2024-11-02 12:10:38, xxxx-x--x- (0%)
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
int n;
vector<int> qx1 , qy1 , qx2 , qy2 , qx3 , qy3 , qx4 , qy4;
cin >> n;
int x[n] , y[n];
for(int i = 0 ; i < n ; i++)
{
cin >> x[i] >> y[i];
if(x[i] > 0 && y[i] > 0)
{
qx1.push_back(x[i]);
qy1.push_back(y[i]);
}
else if(x[i] > 0 && y[i] < 0)
{
qx4.push_back(x[i]);
qy4.push_back(y[i]);
}
else if(x[i] < 0 && y[i] < 0)
{
qx3.push_back(x[i]);
qy3.push_back(y[i]);
}
else if(x[i] < 0 && y[i] > 0)
{
qx2.push_back(x[i]);
qy2.push_back(y[i]);
}
}
int maxqx1 = 0 , minqx1 = qx1[0] , maxqx2 = qx2[0] , minqx2 = 0 , maxqx3 = qx3[0] , minqx3 = 0 , maxqx4 = 0 , minqx4 = qx4[0];
int maxqy1 = 0 , minqy1 = qy1[0] , maxqy2 = qy2[0] , minqy2 = 0 , maxqy3 = qy3[0] , minqy3 = 0 , maxqy4 = 0 , minqy4 = qy4[0];
for(long unsigned int i = 0 ; i < qx1.size() ; i++)
{
if(maxqx1 < qx1[i] && minqx1 > maxqx1)
{
minqx1 = maxqx1;
maxqx1 = qx1[i];
}
else if(maxqx1 < qx1[i] && minqx1 < maxqx1)
{
maxqx1 = qx1[i];
}
else if(minqx1 < qx1[i])
{
minqx1 = qx1[i];
}
}
for(long unsigned int i = 0 ; i < qx2.size() ; i++)
{
if(maxqx2 < qx2[i] && minqx2 > maxqx2)
{
minqx2 = maxqx2;
maxqx2 = qx2[i];
}
else if(maxqx2 < qx2[i] && minqx2 < maxqx2)
{
maxqx2 = qx2[i];
}
else if(minqx2 < qx2[i])
{
minqx2 = qx2[i];
}
}
for(long unsigned int i = 0 ; i < qx3.size() ; i++)
{
if(maxqx3 < qx3[i] && minqx3 > maxqx3)
{
minqx3 = maxqx3;
maxqx3 = qx3[i];
}
else if(maxqx3 < qx3[i] && minqx3 < maxqx3)
{
maxqx3 = qx3[i];
}
else if(minqx3 < qx3[i])
{
minqx3 = qx3[i];
}
}
for(long unsigned int i = 0 ; i < qx4.size() ; i++)
{
if(maxqx4 < qx4[i] && minqx4 > maxqx4)
{
minqx4 = maxqx4;
maxqx4 = qx4[i];
}
else if(maxqx4 < qx4[i] && minqx4 < maxqx4)
{
maxqx4 = qx4[i];
}
else if(minqx4 < qx4[i])
{
minqx4 = qx4[i];
}
}
for(long unsigned int i = 0 ; i < qy1.size() ; i++)
{
if(maxqy1 < qy1[i] && minqy1 > maxqy1)
{
minqy1 = maxqy1;
maxqy1 = qy1[i];
}
else if(maxqy1 < qy1[i] && minqy1 < maxqy1)
{
maxqy1 = qy1[i];
}
else if(minqy1 < qy1[i])
{
minqy1 = qy1[i];
}
}
for(long unsigned int i = 0 ; i < qy2.size() ; i++)
{
if(maxqy2 < qy2[i] && minqy2 > maxqy2)
{
minqy2 = maxqy2;
maxqy2 = qy2[i];
}
else if(maxqy2 < qy2[i] && minqy2 < maxqy2)
{
maxqy2 = qy2[i];
}
else if(minqy2 < qy2[i])
{
minqy2 = qy2[i];
}
}
for(long unsigned int i = 0 ; i < qy3.size() ; i++)
{
if(maxqy3 < qy3[i] && minqy3 > maxqy3)
{
minqy3 = maxqy3;
maxqy3 = qy3[i];
}
else if(maxqy3 < qy3[i] && minqy3 < maxqy3)
{
maxqy3 = qy3[i];
}
else if(minqy3 < qy3[i])
{
minqy3 = qy3[i];
}
}
for(long unsigned int i = 0 ; i < qy4.size() ; i++)
{
if(maxqy4 < qy4[i] && minqy4 > maxqy4)
{
minqy4 = maxqy4;
maxqy4 = qy4[i];
}
else if(maxqy4 < qy4[i] && minqy4 < maxqy4)
{
maxqy4 = qy4[i];
}
else if(minqy4 < qy4[i])
{
minqy4 = qy4[i];
}
}
if(qx1.empty() && qx2.empty() && qx3.empty() && qx4.empty())
{
cout << "No point in any quadrant";
}
if(maxqx1 != 0)
{
cout << "Q1: (" << minqx1 << ", " << minqy1 << ") (" << maxqx1 << ", " << maxqy1 << ") " << " " << (maxqx1 - minqx1) * (maxqy1 - minqy1);
}
if(minqx2 != 0)
{
cout << "Q2: (" << minqx2 << ", " << minqy2 << ") (" << maxqx2 << ", " << maxqy2 << ") " << " " << (maxqx2 - minqx2) * (maxqy2 - minqy2);
}
if(minqx3 != 0)
{
cout << "Q3: (" << minqx3 << ", " << minqy3 << ") (" << maxqx3 << ", " << maxqy3 << ") " << " " << (maxqx3 - minqx3) * (maxqy3 - minqy3);
}
if(maxqx4 != 0)
{
cout << "Q4: (" << minqx4 << ", " << minqy4 << ") (" << maxqx4 << ", " << maxqy4 << ") " << " " << (maxqx4 - minqx4) * (maxqy4 - minqy4);
}
return 0;
} |
# 2069358, 2024-11-02 10:39:22, -----P---- (10%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
int a,b;
cin >> n;
for(int i =0; i < n; ++i){
cin >> a >> b;
}
cout << "No point in any quadrant";
} | # 2069894, 2024-11-02 11:34:09, -----P---- (10%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n, a, b;
vector<int> x1,y1,x2,y2,x3,y3,x4,y4;
cin >> n;
for(int i =0; i < n; ++i){
cin >> a >> b;
if(a > 0 && b >0){
x1.push_back(a);
y1.push_back(b);
}else if(a < 0 && b > 0){
x2.push_back(a);
y2.push_back(b);
}else if(a < 0 && b < 0){
x3.push_back(a);
y3.push_back(b);
}else if(a > 0 && b < 0){
x4.push_back(a);
y4.push_back(b);
}
}
int max1x = x1[0];
int min1x = x1[0];
int max1y = y1[0];
int min1y = y1[0];
for(int i; i < x1.size(); ++i){
if(max1x < x1[i]){
max1x = x1[i];
}
if(min1x > x1[i]){
min1x = x1[i];
}
if(max1y < y1[i]){
max1y = y1[i];
}
if(min1y > y1[i]){
min1y = y1[i];
}
}
int max2x = x2[0];
int min2x = x2[0];
int max2y = y2[0];
int min2y = y2[0];
for(int i; i < x2.size(); ++i){
if(max2x < x2[i]){
max2x = x2[i];
}
if(min2x > x2[i]){
min2x = x2[i];
}
if(max2y < y2[i]){
max2y = y2[i];
}
if(min2y > y2[i]){
min2y = y2[i];
}
}
int max3x = x3[0];
int min3x = x3[0];
int max3y = y3[0];
int min3y = y3[0];
for(int i; i < x3.size(); ++i){
if(max3x < x3[i]){
max3x = x3[i];
}
if(min3x > x3[i]){
min3x = x3[i];
}
if(max3y < y3[i]){
max3y = y3[i];
}
if(min3y > y3[i]){
min3y = y3[i];
}
}
int max4x = x4[0];
int min4x = x4[0];
int max4y = y4[0];
int min4y = y4[0];
for(int i; i < x4.size(); ++i){
if(max4x < x4[i]){
max4x = x4[i];
}
if(min4x > x4[i]){
min4x = x4[i];
}
if(max4y < y4[i]){
max4y = y4[i];
}
if(min4y > y4[i]){
min4y = y4[i];
}
}
int h1 = max1y - min1y, l1 = max1x - min1x;
int h2 = max2y - min2y, l2 = max2x - min2x;
int h3 = max3y - min3y, l3 = max3x -min3x;
int h4 = max4y - min4y, l4 = max4x -min4x;
int Area1 = h1*l1;
int Area2 = h2*l2;
int Area3 = h3*l3;
int Area4 = h4*l4;
if(x1.size()== 0 && x2.size() == 0 && x3.size() == 0 && x4.size() == 0){
cout << "No point in any quadrant";
}else if(x1.size() != 0){
cout << "Q1:" << "(" << "," << ")" << "(" << "," << ")" <<endl;
}else if(x2.size() != 0){
cout << "Q2:"<< "(" << "," << ")" << "(" << "," << ")" <<endl;
}else if(x3.size() != 0){
cout << "Q3:"<< "(" << "," << ")" << "(" << "," << ")" <<endl;
}else if(x4.size() != 0){
cout << "Q4:"<< "(" << "," << ")" << "(" << "," << ")" <<endl;
}
} | # 2069981, 2024-11-02 11:42:36, xxxx-x--x- (0%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n, a, b;
vector<int> x1,y1,x2,y2,x3,y3,x4,y4;
cin >> n;
for(int i =0; i < n; ++i){
cin >> a >> b;
if(a > 0 && b >0){
x1.push_back(a);
y1.push_back(b);
}else if(a < 0 && b > 0){
x2.push_back(a);
y2.push_back(b);
}else if(a < 0 && b < 0){
x3.push_back(a);
y3.push_back(b);
}else if(a > 0 && b < 0){
x4.push_back(a);
y4.push_back(b);
}
}
int max1x = x1[0];
int min1x = x1[0];
int max1y = y1[0];
int min1y = y1[0];
for(int i; i < x1.size(); ++i){
if(max1x < x1[i]){
max1x = x1[i];
}
if(min1x > x1[i]){
min1x = x1[i];
}
if(max1y < y1[i]){
max1y = y1[i];
}
if(min1y > y1[i]){
min1y = y1[i];
}
}
int max2x = x2[0];
int min2x = x2[0];
int max2y = y2[0];
int min2y = y2[0];
for(int i; i < x2.size(); ++i){
if(max2x < x2[i]){
max2x = x2[i];
}
if(min2x > x2[i]){
min2x = x2[i];
}
if(max2y < y2[i]){
max2y = y2[i];
}
if(min2y > y2[i]){
min2y = y2[i];
}
}
int max3x = x3[0];
int min3x = x3[0];
int max3y = y3[0];
int min3y = y3[0];
for(int i; i < x3.size(); ++i){
if(max3x < x3[i]){
max3x = x3[i];
}
if(min3x > x3[i]){
min3x = x3[i];
}
if(max3y < y3[i]){
max3y = y3[i];
}
if(min3y > y3[i]){
min3y = y3[i];
}
}
int max4x = x4[0];
int min4x = x4[0];
int max4y = y4[0];
int min4y = y4[0];
for(int i; i < x4.size(); ++i){
if(max4x < x4[i]){
max4x = x4[i];
}
if(min4x > x4[i]){
min4x = x4[i];
}
if(max4y < y4[i]){
max4y = y4[i];
}
if(min4y > y4[i]){
min4y = y4[i];
}
}
int h1 = max1y - min1y, l1 = max1x - min1x;
int h2 = max2y - min2y, l2 = (-1*min2x) - (-1*max2x);
int h3 = (-1*min3y) - (-1*max3y), l3 = (-1*min3x) - (-1*max3x);
int h4 = (-1*min3y) - (-1*max3y), l4 = max4x -min4x;
int Area1 = h1*l1;
int Area2 = h2*l2;
int Area3 = h3*l3;
int Area4 = h4*l4;
if(x1.size()== 0 && x2.size() == 0 && x3.size() == 0 && x4.size() == 0){
cout << "No point in any quadrant";
}else if(x1.size() != 0){
cout << "Q1:" << "(" << min1x << ", " << min1y << ")" << "(" << max1x << ", " << max1y << ")" <<endl;
}else if(x2.size() != 0){
cout << "Q2:"<< "(" << min2x << ", " << min2y << ")" << "(" << max2x << ", " << max2y << ")" <<endl;
}else if(x3.size() != 0){
cout << "Q3:"<< "(" << min3x << ", " << min3y << ")" << "(" << max3x << ", " << max3y << ")" <<endl;
}else if(x4.size() != 0){
cout << "Q4:"<< "(" << min4x << ", " << min4y << ")" << "(" << max4x << ", " << max4y << ")" <<endl;
}
} | # 2070330, 2024-11-02 12:03:57, xxxx-x--x- (0%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n, a, b;
vector<int> x1,y1,x2,y2,x3,y3,x4,y4;
cin >> n;
for(int i =0; i < n; ++i){
cin >> a >> b;
if(a > 0 && b >0){
x1.push_back(a);
y1.push_back(b);
}else if(a < 0 && b > 0){
x2.push_back(a);
y2.push_back(b);
}else if(a < 0 && b < 0){
x3.push_back(a);
y3.push_back(b);
}else if(a > 0 && b < 0){
x4.push_back(a);
y4.push_back(b);
}
}
int max1x = x1[0];
int min1x = x1[0];
int max1y = y1[0];
int min1y = y1[0];
for(int i; i < x1.size(); ++i){
if(max1x < x1[i]){
max1x = x1[i];
}
if(min1x > x1[i]){
min1x = x1[i];
}
if(max1y < y1[i]){
max1y = y1[i];
}
if(min1y > y1[i]){
min1y = y1[i];
}
}
int max2x = x2[0];
int min2x = x2[0];
int max2y = y2[0];
int min2y = y2[0];
for(int i; i < x2.size(); ++i){
if(max2x < x2[i]){
max2x = x2[i];
}
if(min2x > x2[i]){
min2x = x2[i];
}
if(max2y < y2[i]){
max2y = y2[i];
}
if(min2y > y2[i]){
min2y = y2[i];
}
}
int max3x = x3[0];
int min3x = x3[0];
int max3y = y3[0];
int min3y = y3[0];
for(int i; i < x3.size(); ++i){
if(max3x < x3[i]){
max3x = x3[i];
}
if(min3x > x3[i]){
min3x = x3[i];
}
if(max3y < y3[i]){
max3y = y3[i];
}
if(min3y > y3[i]){
min3y = y3[i];
}
}
int max4x = x4[0];
int min4x = x4[0];
int max4y = y4[0];
int min4y = y4[0];
for(int i; i < x4.size(); ++i){
if(max4x < x4[i]){
max4x = x4[i];
}
if(min4x > x4[i]){
min4x = x4[i];
}
if(max4y < y4[i]){
max4y = y4[i];
}
if(min4y > y4[i]){
min4y = y4[i];
}
}
int h1 = max1y - min1y, l1 = max1x - min1x;
int h2 = max2y - min2y, l2 = (-1*min2x) - (-1*max2x);
int h3 = (-1*min3y) - (-1*max3y), l3 = (-1*min3x) - (-1*max3x);
int h4 = (-1*min3y) - (-1*max3y), l4 = max4x -min4x;
int Area1 = h1*l1;
int Area2 = h2*l2;
int Area3 = h3*l3;
int Area4 = h4*l4;
if(x1.size()== 0 && x2.size() == 0 && x3.size() == 0 && x4.size() == 0){
cout << "No point in any quadrant";
}else if(x1.size() != 0){
cout << "Q1:" << "(" << min1x << ", " << min1y << ")" << "(" << max1x << ", " << max1y << ")" <<endl;
}else if(x2.size() != 0){
cout << "Q2:"<< "(" << min2x << ", " << min2y << ")" << "(" << max2x << ", " << max1y << ")" <<endl;
}else if(x3.size() != 0){
cout << "Q3:"<< "(" << min3x << ", " << min3y << ")" << "(" << max3x << ", " << max1y << ")" <<endl;
}else if(x4.size() != 0){
cout << "Q4:"<< "(" << min4x << ", " << min4y << ")" << "(" << max4x << ", " << max4y << ")" <<endl;
}
} | # 2070427, 2024-11-02 12:08:08, xxxx-x--x- (0%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n, a, b;
vector<int> x1,y1,x2,y2,x3,y3,x4,y4;
cin >> n;
for(int i =0; i < n; ++i){
cin >> a >> b;
if(a > 0 && b >0){
x1.push_back(a);
y1.push_back(b);
}else if(a < 0 && b > 0){
x2.push_back(a);
y2.push_back(b);
}else if(a < 0 && b < 0){
x3.push_back(a);
y3.push_back(b);
}else if(a > 0 && b < 0){
x4.push_back(a);
y4.push_back(b);
}
}
int max1x = x1[0];
int min1x = x1[0];
int max1y = y1[0];
int min1y = y1[0];
for(long long i; i < x1.size(); ++i){
if(max1x < x1[i]){
max1x = x1[i];
}
if(min1x > x1[i]){
min1x = x1[i];
}
if(max1y < y1[i]){
max1y = y1[i];
}
if(min1y > y1[i]){
min1y = y1[i];
}
}
int max2x = x2[0];
int min2x = x2[0];
int max2y = y2[0];
int min2y = y2[0];
for(long long i; i < x2.size(); ++i){
if(max2x < x2[i]){
max2x = x2[i];
}
if(min2x > x2[i]){
min2x = x2[i];
}
if(max2y < y2[i]){
max2y = y2[i];
}
if(min2y > y2[i]){
min2y = y2[i];
}
}
int max3x = x3[0];
int min3x = x3[0];
int max3y = y3[0];
int min3y = y3[0];
for(long long i; i < x3.size(); ++i){
if(max3x < x3[i]){
max3x = x3[i];
}
if(min3x > x3[i]){
min3x = x3[i];
}
if(max3y < y3[i]){
max3y = y3[i];
}
if(min3y > y3[i]){
min3y = y3[i];
}
}
int max4x = x4[0];
int min4x = x4[0];
int max4y = y4[0];
int min4y = y4[0];
for(long long i; i < x4.size(); ++i){
if(max4x < x4[i]){
max4x = x4[i];
}
if(min4x > x4[i]){
min4x = x4[i];
}
if(max4y < y4[i]){
max4y = y4[i];
}
if(min4y > y4[i]){
min4y = y4[i];
}
}
int h1 = max1y - min1y, l1 = max1x - min1x;
int h2 = max2y - min2y, l2 = (-1*min2x) - (-1*max2x);
int h3 = (-1*min3y) - (-1*max3y), l3 = (-1*min3x) - (-1*max3x);
int h4 = (-1*min3y) - (-1*max3y), l4 = max4x -min4x;
int A1 = h1*l1;
int A2 = h2*l2;
int A3 = h3*l3;
int A4 = h4*l4;
if(x1.size()== 0 && x2.size() == 0 && x3.size() == 0 && x4.size() == 0){
cout << "No point in any quadrant";
}else if(x1.size() != 0){
cout << "Q1:" << "(" << min1x << ", " << min1y << ")" << "(" << max1x << ", " << max1y << ") "<< A1 <<endl;
}else if(x2.size() != 0){
cout << "Q2:"<< "(" << min2x << ", " << min2y << ")" << "(" << max2x << ", " << max1y << ") " << A2 <<endl;
}else if(x3.size() != 0){
cout << "Q3:"<< "(" << min3x << ", " << min3y << ")" << "(" << max3x << ", " << max1y << ") " << A3 <<endl;
}else if(x4.size() != 0){
cout << "Q4:"<< "(" << min4x << ", " << min4y << ")" << "(" << max4x << ", " << max4y << ") " << A4 <<endl;
}
} | # 2070444, 2024-11-02 12:08:43, xxxx-x--x- (0%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n, a, b;
vector<int> x1,y1,x2,y2,x3,y3,x4,y4;
cin >> n;
for(int i =0; i < n; ++i){
cin >> a >> b;
if(a > 0 && b >0){
x1.push_back(a);
y1.push_back(b);
}else if(a < 0 && b > 0){
x2.push_back(a);
y2.push_back(b);
}else if(a < 0 && b < 0){
x3.push_back(a);
y3.push_back(b);
}else if(a > 0 && b < 0){
x4.push_back(a);
y4.push_back(b);
}
}
int max1x = x1[0];
int min1x = x1[0];
int max1y = y1[0];
int min1y = y1[0];
for(long long i; i < x1.size(); ++i){
if(max1x < x1[i]){
max1x = x1[i];
}
if(min1x > x1[i]){
min1x = x1[i];
}
if(max1y < y1[i]){
max1y = y1[i];
}
if(min1y > y1[i]){
min1y = y1[i];
}
}
int max2x = x2[0];
int min2x = x2[0];
int max2y = y2[0];
int min2y = y2[0];
for(long long i; i < x2.size(); ++i){
if(max2x < x2[i]){
max2x = x2[i];
}
if(min2x > x2[i]){
min2x = x2[i];
}
if(max2y < y2[i]){
max2y = y2[i];
}
if(min2y > y2[i]){
min2y = y2[i];
}
}
int max3x = x3[0];
int min3x = x3[0];
int max3y = y3[0];
int min3y = y3[0];
for(long long i; i < x3.size(); ++i){
if(max3x < x3[i]){
max3x = x3[i];
}
if(min3x > x3[i]){
min3x = x3[i];
}
if(max3y < y3[i]){
max3y = y3[i];
}
if(min3y > y3[i]){
min3y = y3[i];
}
}
int max4x = x4[0];
int min4x = x4[0];
int max4y = y4[0];
int min4y = y4[0];
for(long long i; i < x4.size(); ++i){
if(max4x < x4[i]){
max4x = x4[i];
}
if(min4x > x4[i]){
min4x = x4[i];
}
if(max4y < y4[i]){
max4y = y4[i];
}
if(min4y > y4[i]){
min4y = y4[i];
}
}
int h1 = max1y - min1y, l1 = max1x - min1x;
int h2 = max2y - min2y, l2 = (-1*min2x) - (-1*max2x);
int h3 = (-1*min3y) - (-1*max3y), l3 = (-1*min3x) - (-1*max3x);
int h4 = (-1*min3y) - (-1*max3y), l4 = max4x -min4x;
int A1 = h1*l1;
int A2 = h2*l2;
int A3 = h3*l3;
int A4 = h4*l4;
if(x1.size()== 0 && x2.size() == 0 && x3.size() == 0 && x4.size() == 0){
cout << "No point in any quadrant";
}
if(x1.size() != 0){
cout << "Q1:" << "(" << min1x << ", " << min1y << ")" << "(" << max1x << ", " << max1y << ") "<< A1 <<endl;
}
if(x2.size() != 0){
cout << "Q2:"<< "(" << min2x << ", " << min2y << ")" << "(" << max2x << ", " << max1y << ") " << A2 <<endl;
}
if(x3.size() != 0){
cout << "Q3:"<< "(" << min3x << ", " << min3y << ")" << "(" << max3x << ", " << max1y << ") " << A3 <<endl;
}
if(x4.size() != 0){
cout << "Q4:"<< "(" << min4x << ", " << min4y << ")" << "(" << max4x << ", " << max4y << ") " << A4 <<endl;
}
} |
# 2068889, 2024-11-02 09:51:05, -----P---- (10%)
#include <iostream>
using namespace std;
int main() {
int input;
while (cin >> input){
//Do nothing
}
cout << "No point in any quadrant" << endl;
} | # 2069753, 2024-11-02 11:21:34, ---------- (0%)
#include <iostream>
#include <set>
using namespace std;
int main() {
int n;
cin >> n;
set<pair<int,int>> Q1,Q2,Q3,Q4;
for (int i = 0; i < n; i++){
int inputX,inputY;
cin >> inputX >> inputY;
if (inputX == 0 || inputY == 0){
//Do nothing
} else if (inputX > 0 && inputY > 0){
Q1.insert({inputX,inputY});
} else if (inputX < 0 && inputY > 0){
Q2.insert({inputX,inputY});
} else if (inputX < 0 && inputY < 0){
Q3.insert({inputX,inputY});
} else if (inputX > 0 && inputY < 0){
Q4.insert({inputX,inputY});
}
}
//max min
int Xmax,Xmin = Q1.begin()->first;
int Ymax,Ymin = Q1.begin()->second;
for (auto itr = Q1.begin(); itr != Q1.end(); itr++){
if ((itr->first) > Xmax){
Xmax = itr->first;
}
if ((itr->first) < Xmin){
Xmin = itr->first;
}
if ((itr->second) > Ymax){
Ymax = itr->second;
}
if ((itr->second) < Ymin){
Ymin = itr->second;
}
}
int Q1area = Xmin*Ymax;
cout << "Q1: (" << Xmin << ", " << Ymin << ") (" << Xmax << ", " << Ymax << ") " << Q1area << endl;
} | # 2069758, 2024-11-02 11:22:11, -----P---- (10%)
#include <iostream>
using namespace std;
int main() {
int input;
while (cin >> input){
//Do nothing
}
cout << "No point in any quadrant" << endl;
} | # 2070201, 2024-11-02 11:57:25, -----P---- (10%)
#include <iostream>
#include <set>
using namespace std;
int findmaxofX(set<pair<int,int>> Quadrant){
int max = Quadrant.begin()->first;
for (auto itr = Quadrant.begin(); itr != Quadrant.end(); itr++){
if ((itr->first) > max){
max = itr->first;
}
}
return max;
}
int findminofX(set<pair<int,int>> Quadrant){
int min = Quadrant.begin()->first;
for (auto itr = Quadrant.begin(); itr != Quadrant.end(); itr++){
if ((itr->first) < min){
min = itr->first;
}
}
return min;
}
int findmaxofY(set<pair<int,int>> Quadrant){
int max = Quadrant.begin()->second;
for (auto itr = Quadrant.begin(); itr != Quadrant.end(); itr++){
if ((itr->second) > max){
max = itr->second;
}
}
return max;
}
int findminofY(set<pair<int,int>> Quadrant){
int min = Quadrant.begin()->second;
for (auto itr = Quadrant.begin(); itr != Quadrant.end(); itr++){
if ((itr->second) < min){
min = itr->second;
}
}
return min;
}
int main() {
int n;
cin >> n;
set<pair<int,int>> Q1,Q2,Q3,Q4;
bool haveVAR = false;
for (int i = 0; i < n; i++){
int inputX,inputY;
cin >> inputX >> inputY;
if (inputX == 0 || inputY == 0){
continue;
} else if (inputX > 0 && inputY > 0){
Q1.insert({inputX,inputY});
haveVAR = true;
} else if (inputX < 0 && inputY > 0){
Q2.insert({inputX,inputY});
haveVAR = true;
} else if (inputX < 0 && inputY < 0){
Q3.insert({inputX,inputY});
haveVAR = true;
} else if (inputX > 0 && inputY < 0){
Q4.insert({inputX,inputY});
haveVAR = true;
}
}
if (haveVAR){
int Q1area = findminofX(Q1)*findmaxofY(Q1);
cout << "Q1: (" << findminofX(Q1) << ", " << findminofY(Q1) << ") (" << findmaxofX(Q1) << ", " << findmaxofY(Q1) << ") " << Q1area << endl;
} else {
cout << "No point in any quadrant" << endl;
}
} | # 2070343, 2024-11-02 12:04:45, -----P---- (10%)
#include <iostream>
#include <set>
using namespace std;
int findmaxofX(set<pair<int,int>> Quadrant){
int max = Quadrant.begin()->first;
for (auto itr = Quadrant.begin(); itr != Quadrant.end(); itr++){
if ((itr->first) > max){
max = itr->first;
}
}
return max;
}
int findminofX(set<pair<int,int>> Quadrant){
int min = Quadrant.begin()->first;
for (auto itr = Quadrant.begin(); itr != Quadrant.end(); itr++){
if ((itr->first) < min){
min = itr->first;
}
}
return min;
}
int findmaxofY(set<pair<int,int>> Quadrant){
int max = Quadrant.begin()->second;
for (auto itr = Quadrant.begin(); itr != Quadrant.end(); itr++){
if ((itr->second) > max){
max = itr->second;
}
}
return max;
}
int findminofY(set<pair<int,int>> Quadrant){
int min = Quadrant.begin()->second;
for (auto itr = Quadrant.begin(); itr != Quadrant.end(); itr++){
if ((itr->second) < min){
min = itr->second;
}
}
return min;
}
int main() {
int n;
cin >> n;
set<pair<int,int>> Q1,Q2,Q3,Q4;
bool haveVAR = false;
for (int i = 0; i < n; i++){
int inputX,inputY;
cin >> inputX >> inputY;
if (inputX == 0 || inputY == 0){
continue;
} else if (inputX > 0 && inputY > 0){
Q1.insert({inputX,inputY});
haveVAR = true;
} else if (inputX < 0 && inputY > 0){
Q2.insert({inputX,inputY});
haveVAR = true;
} else if (inputX < 0 && inputY < 0){
Q3.insert({inputX,inputY});
haveVAR = true;
} else if (inputX > 0 && inputY < 0){
Q4.insert({inputX,inputY});
haveVAR = true;
}
}
if (haveVAR){
int Q1area = findminofX(Q1)*findmaxofY(Q1);
cout << "Q1: (" << findminofX(Q1) << ", " << findminofY(Q1) << ") (" << findmaxofX(Q1) << ", " << findmaxofY(Q1) << ") " << Q1area << endl;
int Q2area = (abs(findminofX(Q2))+findmaxofX(Q2))*(findmaxofY(Q2)-findminofY(Q2));
cout << "Q2: (" << findminofX(Q2) << ", " << findminofY(Q2) << ") (" << findmaxofX(Q2) << ", " << findmaxofY(Q2) << ") " << Q2area << endl;
} else {
cout << "No point in any quadrant" << endl;
}
} | # 2070521, 2024-11-02 12:11:15, -----P---- (10%)
#include <iostream>
#include <set>
using namespace std;
int findmaxofX(set<pair<int,int>> Quadrant){
int max = Quadrant.begin()->first;
for (auto itr = Quadrant.begin(); itr != Quadrant.end(); itr++){
if ((itr->first) > max){
max = itr->first;
}
}
return max;
}
int findminofX(set<pair<int,int>> Quadrant){
int min = Quadrant.begin()->first;
for (auto itr = Quadrant.begin(); itr != Quadrant.end(); itr++){
if ((itr->first) < min){
min = itr->first;
}
}
return min;
}
int findmaxofY(set<pair<int,int>> Quadrant){
int max = Quadrant.begin()->second;
for (auto itr = Quadrant.begin(); itr != Quadrant.end(); itr++){
if ((itr->second) > max){
max = itr->second;
}
}
return max;
}
int findminofY(set<pair<int,int>> Quadrant){
int min = Quadrant.begin()->second;
for (auto itr = Quadrant.begin(); itr != Quadrant.end(); itr++){
if ((itr->second) < min){
min = itr->second;
}
}
return min;
}
int main() {
int n;
cin >> n;
set<pair<int,int>> Q1,Q2,Q3,Q4;
bool haveVAR = false;
for (int i = 0; i < n; i++){
int inputX,inputY;
cin >> inputX >> inputY;
if (inputX == 0 || inputY == 0){
continue;
} else if (inputX > 0 && inputY > 0){
Q1.insert({inputX,inputY});
haveVAR = true;
} else if (inputX < 0 && inputY > 0){
Q2.insert({inputX,inputY});
haveVAR = true;
} else if (inputX < 0 && inputY < 0){
Q3.insert({inputX,inputY});
haveVAR = true;
} else if (inputX > 0 && inputY < 0){
Q4.insert({inputX,inputY});
haveVAR = true;
}
}
if (haveVAR){
int Q1area = findminofX(Q1)*findmaxofY(Q1);
cout << "Q1: (" << findminofX(Q1) << ", " << findminofY(Q1) << ") (" << findmaxofX(Q1) << ", " << findmaxofY(Q1) << ") " << Q1area << endl;
int Q2area = (abs(findminofX(Q2))+findmaxofX(Q2))*(findmaxofY(Q2)-findminofY(Q2));
cout << "Q2: (" << findminofX(Q2) << ", " << findminofY(Q2) << ") (" << findmaxofX(Q2) << ", " << findmaxofY(Q2) << ") " << Q2area << endl;
int Q3area = (abs(findminofY(Q3)*findmaxofX(Q3)));
cout << "Q3: (" << findminofX(Q3) << ", " << findminofY(Q3) << ") (" << findmaxofX(Q3) << ", " << findmaxofY(Q3) << ") " << Q3area << endl;
int Q4area = (findmaxofX(Q4)-findminofX(Q4))*(findminofY(Q4)+findmaxofY(Q4));
cout << "Q4: (" << findminofX(Q4) << ", " << findminofY(Q4) << ") (" << findmaxofX(Q4) << ", " << findmaxofY(Q4) << ") " << Q4area << endl;
} else {
cout << "No point in any quadrant" << endl;
}
} |
# 2069454, 2024-11-02 10:48:29, xx-x-x--x- (0%)
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <utility>
#include <algorithm>
#include <cmath>
#include <string>
using namespace std;
int main(){
double n,x,y,a,b;
cin>>n;
vector<pair<int,int>> q1;
vector<pair<int,int>> q2;
vector<pair<int,int>> q3;
vector<pair<int,int>> q4;
vector<pair<int,int>> last;
while(n--){
cin>>x>>y;
if(x > 0 && y > 0){
q1.push_back({x,y});
}else if(x < 0 && y > 0){
q2.push_back({x,y});
}else if(x < 0 && y < 0){
q3.push_back({x,y});
}else if(x > 0 && y < 0){
q4.push_back({x,y});
}
}
x=0; y=0;
x = q1[0].first; y = q1[0].second;
a = q1[0].first; b = q1[0].second;
for(int i =1;i< q1.size();i++){
if(q1[i].first < x ){
x = q1[i].first;
}
if(q1[i].second < y){
y = q1[i].second;
}
if(q1[i].first> a){
a = q1[i].first;
}
if(q1[i].second> b){
b = q1[i].second;
}
}
last.push_back({x,y});
last.push_back({a,b});
vector<int> result;
int rx,ry ;
rx = x -a;
ry = y -b;
result.push_back(rx*ry);
// x = q2[0].first;
// y = q2[0].second;
// a = q2[0].first;
// b = q2[0].second;
// for(int i =1;i< q2.size();i++){
// if(q2[i].first < x ){
// x = q2[i].first;
// }
// if(q2[i].second < y){
// y = q2[i].second;
// }
// if(q2[i].first> a){
// a = q2[i].first;
// }
// if(q2[i].second> b){
// b = q2[i].second;
// }
// }
cout<<q2[0].first<<q2[0].second<<endl;
} | # 2070372, 2024-11-02 12:05:50, xxxx-x--x- (0%)
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <utility>
#include <algorithm>
#include <cmath>
#include <string>
using namespace std;
int main(){
double n,x,y,a,b;
cin>>n;
vector<pair<int,int>> q1;
vector<pair<int,int>> q2;
vector<pair<int,int>> q3;
vector<pair<int,int>> q4;
vector<pair<int,int>> last;
while(n--){
cin>>x>>y;
if(x > 0 && y > 0){
q1.push_back({x,y});
}else if(x < 0 && y > 0){
q2.push_back({x,y});
}else if(x < 0 && y < 0){
q3.push_back({x,y});
}else if(x > 0 && y < 0){
q4.push_back({x,y});
}
}
x=0; y=0;
x = q1[0].first;
y = q1[0].second;
a = q1[0].first;
b = q1[0].second;
for(int i =1;i< q1.size();i++){
if(q1[i].first < x ){
x = q1[i].first;
}
if(q1[i].second < y){
y = q1[i].second;
}
if(q1[i].first> a){
a = q1[i].first;
}
if(q1[i].second> b){
b = q1[i].second;
}
}
last.push_back({x,y});
last.push_back({a,b});
vector<int> result;
int rx,ry ;
rx = x -a;
ry = y -b;
result.push_back(rx*ry);
x = q2[0].first;
y = q2[0].second;
a= q2[0].first;
b= q2[0].second;
for (size_t i = 1; i < q2.size(); i++)
{
if(q2[i].first < x ){
x = q2[i].first;
}
if(q2[i].second < y){
y = q2[i].second;
}
if(q2[i].first> a){
a = q2[i].first;
}
if(q2[i].second> b){
b = q2[i].second;
}
}
last.push_back({x,y});
last.push_back({a,b});
rx = x -a;
ry = y -b;
result.push_back(rx*ry);
x = q3[0].first;
y = q3[0].second;
a= q3[0].first;
b= q3[0].second;
for (size_t i = 1; i < q3.size(); i++)
{
if(q3[i].first < x ){
x = q3[i].first;
}
if(q3[i].second < y){
y = q3[i].second;
}
if(q3[i].first> a){
a = q3[i].first;
}
if(q3[i].second> b){
b = q3[i].second;
}
}
last.push_back({x,y});
last.push_back({a,b});
rx = x -a;
ry = y -b;
result.push_back(rx*ry);
x = q4[0].first;
y = q4[0].second;
a= q4[0].first;
b= q4[0].second;
for (size_t i = 1; i < q4.size(); i++)
{
if(q4[i].first < x ){
x = q4[i].first;
}
if(q4[i].second < y){
y = q4[i].second;
}
if(q4[i].first> a){
a = q4[i].first;
}
if(q4[i].second> b){
b = q4[i].second;
}
}
last.push_back({x,y});
last.push_back({a,b});
rx = x -a;
ry = y -b;
result.push_back(rx*ry);
if(last.empty()){
cout<<"No point in any quadrant";
}else{
cout<<"Q1 : ("<<last[0].first<<", "<<last[0].second<<")"<<" ("<<last[1].first<<", "<<last[1].second<<") "<<result[0]<<endl;
cout<<"Q2 : ("<<last[2].first<<", "<<last[2].second<<")"<<" ("<<last[3].first<<", "<<last[3].second<<") "<<result[1]<<endl;
cout<<"Q3 : ("<<last[4].first<<", "<<last[4].second<<")"<<" ("<<last[5].first<<", "<<last[5].second<<") "<<result[2]<<endl;
cout<<"Q4 : ("<<last[6].first<<", "<<last[6].second<<")"<<" ("<<last[7].first<<", "<<last[7].second<<") "<<result[3]<<endl;
}
} | # 2070493, 2024-11-02 12:10:32, -----P---- (10%)
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <utility>
#include <algorithm>
#include <cmath>
#include <string>
using namespace std;
int main(){
cout<<"No point in any quadrant";
} | # 2070513, 2024-11-02 12:10:58, xxxx-x--x- (0%)
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <utility>
#include <algorithm>
#include <cmath>
#include <string>
using namespace std;
int main(){
double n,x,y,a,b;
cin>>n;
vector<pair<int,int>> q1;
vector<pair<int,int>> q2;
vector<pair<int,int>> q3;
vector<pair<int,int>> q4;
vector<pair<int,int>> last;
while(n--){
cin>>x>>y;
if(x > 0 && y > 0){
q1.push_back({x,y});
}else if(x < 0 && y > 0){
q2.push_back({x,y});
}else if(x < 0 && y < 0){
q3.push_back({x,y});
}else if(x > 0 && y < 0){
q4.push_back({x,y});
}
}
x=0; y=0;
x = q1[0].first;
y = q1[0].second;
a = q1[0].first;
b = q1[0].second;
for(int i =1;i< int(q1.size());i++){
if(q1[i].first < x ){
x = q1[i].first;
}
if(q1[i].second < y){
y = q1[i].second;
}
if(q1[i].first> a){
a = q1[i].first;
}
if(q1[i].second> b){
b = q1[i].second;
}
}
last.push_back({x,y});
last.push_back({a,b});
vector<int> result;
int rx,ry ;
rx = x -a;
ry = y -b;
result.push_back(rx*ry);
x = q2[0].first;
y = q2[0].second;
a= q2[0].first;
b= q2[0].second;
for (size_t i = 1; i < q2.size(); i++)
{
if(q2[i].first < x ){
x = q2[i].first;
}
if(q2[i].second < y){
y = q2[i].second;
}
if(q2[i].first> a){
a = q2[i].first;
}
if(q2[i].second> b){
b = q2[i].second;
}
}
last.push_back({x,y});
last.push_back({a,b});
rx = x -a;
ry = y -b;
result.push_back(rx*ry);
x = q3[0].first;
y = q3[0].second;
a= q3[0].first;
b= q3[0].second;
for (size_t i = 1; i < q3.size(); i++)
{
if(q3[i].first < x ){
x = q3[i].first;
}
if(q3[i].second < y){
y = q3[i].second;
}
if(q3[i].first> a){
a = q3[i].first;
}
if(q3[i].second> b){
b = q3[i].second;
}
}
last.push_back({x,y});
last.push_back({a,b});
rx = x -a;
ry = y -b;
result.push_back(rx*ry);
x = q4[0].first;
y = q4[0].second;
a= q4[0].first;
b= q4[0].second;
for (size_t i = 1; i < q4.size(); i++)
{
if(q4[i].first < x ){
x = q4[i].first;
}
if(q4[i].second < y){
y = q4[i].second;
}
if(q4[i].first> a){
a = q4[i].first;
}
if(q4[i].second> b){
b = q4[i].second;
}
}
last.push_back({x,y});
last.push_back({a,b});
rx = x -a;
ry = y -b;
result.push_back(rx*ry);
if(last.empty()){
cout<<"No point in any quadrant";
}else{
cout<<"Q1 : ("<<last[0].first<<", "<<last[0].second<<")"<<" ("<<last[1].first<<", "<<last[1].second<<") "<<result[0]<<endl;
cout<<"Q2 : ("<<last[2].first<<", "<<last[2].second<<")"<<" ("<<last[3].first<<", "<<last[3].second<<") "<<result[1]<<endl;
cout<<"Q3 : ("<<last[4].first<<", "<<last[4].second<<")"<<" ("<<last[5].first<<", "<<last[5].second<<") "<<result[2]<<endl;
cout<<"Q4 : ("<<last[6].first<<", "<<last[6].second<<")"<<" ("<<last[7].first<<", "<<last[7].second<<") "<<result[3]<<endl;
}
} |
# 2069631, 2024-11-02 11:05:33, -----P---- (10%)
//quadrant
#include<iostream>
#include<vector>
using namespace std;
int main(){
int n;
cin >> n;
int x,y;
vector<pair<int,int>> Q1;
vector<pair<int,int>> Q2;
vector<pair<int,int>> Q3;
vector<pair<int,int>> Q4;
while(n--){
cin >> x >> y;
if(x==0||y==0){
continue;
}else if(x>0&&y>0){
Q1.push_back(make_pair(x,y));
}else if(x<0 && y>0){
Q2.push_back(make_pair(x,y));
}else if(x<0 && y<0){
Q3.push_back(make_pair(x,y));
}
else if(x>0 && y<0){
Q4.push_back(make_pair(x,y));
}
}
cout << "No point in any quadrant";
} | # 2070440, 2024-11-02 12:08:40, -----P---- (10%)
//quadrant
#include<iostream>
#include<vector>
#include<set>
using namespace std;
int main(){
int n;
cin >> n;
int x,y;
vector<pair<int,int>> Q1;
vector<pair<int,int>> Q2;
vector<pair<int,int>> Q3;
vector<pair<int,int>> Q4;
while(n--){
cin >> x >> y;
if(x==0||y==0){
continue;
}else if(x>0&&y>0){
Q1.push_back({x,y});
}else if(x<0 && y>0){
Q2.push_back({x,y});
}else if(x<0 && y<0){
Q3.push_back({x,y});
}
else if(x>0 && y<0){
Q4.push_back({x,y});
}
}
//Q1
set<int> x1;
set<int> y1;
int x1max,y1min,x1min,y1max;
for(auto e:Q1){
x1.insert(e.first);
y1.insert(e.second);
}
x1max=*(x1.end());
x1min=*(x1.begin());
y1max=*(y1.end());
y1min=*(y1.begin());
if(Q1.size()!=0){
cout << "Q1: (" << x1min << ", " << y1min <<") ";
cout << "(" << x1max << ", " << y1max <<") " <<abs((x1min - x1max)*(y1min-y1max));
}
//Q2
set<int> x2;
set<int> y2;
int x2max,y2min,x2min,y2max;
for(auto e:Q2){
x2.insert(e.first);
y2.insert(e.second);
}
x2max=*(x2.end());
x2min=*(x2.begin());
y2max=*(y2.end());
y2min=*(y2.begin());
if(Q2.size()!=0){
cout << "Q2: (" << x2min << ", " << y2min <<") ";
cout << "(" << x2max << ", " << y2max <<") " <<abs((x2min - x2max)*(y2min-y2max));
}
//Q3
set<int> x3;
set<int> y3;
int x3max,y3min,x3min,y3max;
for(auto e:Q3){
x3.insert(e.first);
y3.insert(e.second);
}
x3max=*(x3.end());
x3min=*(x3.begin());
y3max=*(y3.end());
y3min=*(y3.begin());
if(Q3.size()!=0){
cout << "Q3: (" << x3min << ", " << y3min <<") ";
cout << "(" << x3max << ", " << y3max <<") " <<abs((x3min - x3max)*(y3min-y3max));
}
//Q4
set<int> x4;
set<int> y4;
int x4max,y4min,x4min,y4max;
for(auto e:Q4){
x4.insert(e.first);
y4.insert(e.second);
}
x4max=*(x4.end());
x4min=*(x4.begin());
y4max=*(y4.end());
y4min=*(y4.begin());
if(Q4.size()!=0){
cout << "Q4: (" << x4min << ", " << y4min <<") ";
cout << "(" << x4max << ", " << y4max <<") " <<abs((x4min - x4max)*(y4min-y4max));
}
if(Q1.size()==0 && Q2.size()==0 && Q3.size()==0 && Q4.size()==0)
cout << "No point in any quadrant";
} | # 2070473, 2024-11-02 12:09:48, -----P---- (10%)
//quadrant
#include<iostream>
#include<vector>
#include<set>
#include<algorithm>
using namespace std;
int main(){
int n;
cin >> n;
int x,y;
vector<pair<int,int>> Q1;
vector<pair<int,int>> Q2;
vector<pair<int,int>> Q3;
vector<pair<int,int>> Q4;
while(n--){
cin >> x >> y;
if(x==0||y==0){
continue;
}else if(x>0&&y>0){
Q1.push_back({x,y});
}else if(x<0 && y>0){
Q2.push_back({x,y});
}else if(x<0 && y<0){
Q3.push_back({x,y});
}
else if(x>0 && y<0){
Q4.push_back({x,y});
}
}
//Q1
set<int> x1;
set<int> y1;
int x1max,y1min,x1min,y1max;
for(auto e:Q1){
x1.insert(e.first);
y1.insert(e.second);
}
x1max=*(x1.end());
x1min=*(x1.begin());
y1max=*(y1.end());
y1min=*(y1.begin());
if(Q1.size()!=0){
cout << "Q1: (" << x1min << ", " << y1min <<") ";
cout << "(" << x1max << ", " << y1max <<") " <<abs((x1min - x1max)*(y1min-y1max));
}
//Q2
set<int> x2;
set<int> y2;
int x2max,y2min,x2min,y2max;
for(auto e:Q2){
x2.insert(e.first);
y2.insert(e.second);
}
x2max=*(x2.end());
x2min=*(x2.begin());
y2max=*(y2.end());
y2min=*(y2.begin());
if(Q2.size()!=0){
cout << "Q2: (" << x2min << ", " << y2min <<") ";
cout << "(" << x2max << ", " << y2max <<") " <<abs((x2min - x2max)*(y2min-y2max));
}
//Q3
set<int> x3;
set<int> y3;
int x3max,y3min,x3min,y3max;
for(auto e:Q3){
x3.insert(e.first);
y3.insert(e.second);
}
x3max=*(x3.end());
x3min=*(x3.begin());
y3max=*(y3.end());
y3min=*(y3.begin());
if(Q3.size()!=0){
cout << "Q3: (" << x3min << ", " << y3min <<") ";
cout << "(" << x3max << ", " << y3max <<") " <<abs((x3min - x3max)*(y3min-y3max));
}
//Q4
set<int> x4;
set<int> y4;
int x4max,y4min,x4min,y4max;
for(auto e:Q4){
x4.insert(e.first);
y4.insert(e.second);
}
x4max=*(x4.end());
x4min=*(x4.begin());
y4max=*(y4.end());
y4min=*(y4.begin());
if(Q4.size()!=0){
cout << "Q4: (" << x4min << ", " << y4min <<") ";
cout << "(" << x4max << ", " << y4max <<") " <<abs((x4min - x4max)*(y4min-y4max));
}
if(Q1.size()==0 && Q2.size()==0 && Q3.size()==0 && Q4.size()==0)
cout << "No point in any quadrant";
} | # 2070539, 2024-11-02 12:11:48, -----P---- (10%)
//quadrant
#include<iostream>
#include<vector>
#include<set>
#include<algorithm>
using namespace std;
int main(){
int n;
cin >> n;
int x,y;
vector<pair<int,int>> Q1;
vector<pair<int,int>> Q2;
vector<pair<int,int>> Q3;
vector<pair<int,int>> Q4;
while(n--){
cin >> x >> y;
if(x==0||y==0){
continue;
}else if(x>0&&y>0){
Q1.push_back({x,y});
}else if(x<0 && y>0){
Q2.push_back({x,y});
}else if(x<0 && y<0){
Q3.push_back({x,y});
}
else if(x>0 && y<0){
Q4.push_back({x,y});
}
}
//Q1
set<int> x1;
set<int> y1;
int x1max,y1min,x1min,y1max;
for(auto e:Q1){
x1.insert(e.first);
y1.insert(e.second);
}
x1max=*(x1.end());
x1min=*(x1.begin());
y1max=*(y1.end());
y1min=*(y1.begin());
if(Q1.size()!=0){
cout << "Q1: (" << x1min << ", " << y1min <<") ";
cout << "(" << x1max << ", " << y1max <<") " <<abs((x1min - x1max)*(y1min-y1max));
}
//Q2
set<int> x2;
set<int> y2;
int x2max,y2min,x2min,y2max;
for(auto e:Q2){
x2.insert(e.first);
y2.insert(e.second);
}
x2max=*(x2.end());
x2min=*(x2.begin());
y2max=*(y2.end());
y2min=*(y2.begin());
if(Q2.size()!=0){
cout << "Q2: (" << x2min << ", " << y2min <<") ";
cout << "(" << x2max << ", " << y2max <<") " <<abs((x2min - x2max)*(y2min-y2max));
}
//Q3
set<int> x3;
set<int> y3;
int x3max,y3min,x3min,y3max;
for(auto e:Q3){
x3.insert(e.first);
y3.insert(e.second);
}
x3max=*(x3.end());
x3min=*(x3.begin());
y3max=*(y3.end());
y3min=*(y3.begin());
if(Q3.size()!=0){
cout << "Q3: (" << x3min << ", " << y3min <<") ";
cout << "(" << x3max << ", " << y3max <<") " <<abs((x3min - x3max)*(y3min-y3max));
}
//Q4
set<int> x4;
set<int> y4;
int x4max,y4min,x4min,y4max;
for(auto e:Q4){
x4.insert(e.first);
y4.insert(e.second);
}
x4max=*(x4.end());
x4min=*(x4.begin());
y4max=*(y4.end());
y4min=*(y4.begin());
if(Q4.size()!=0){
cout << "Q4: (" << x4min << ", " << y4min <<") ";
cout << "(" << x4max << ", " << y4max <<") " <<abs((x4min - x4max)*(y4min-y4max));
}
if(Q1.size()==0 && Q2.size()==0 && Q3.size()==0 && Q4.size()==0)
cout << "No point in any quadrant";
} |
# 2071181, 2024-11-02 14:05:30, -----P---- (10%)
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
using namespace std;
int main(){
int n;
cin >> n;
map <int, vector<int>> input;
cin.ignore();
map <int, vector<int>> q1,q2,q3,q4;
int x,y;
while(n--){
cin >> x >> y;
input[x].push_back(y);
}
//cout << "fini: " << endl;
int i = 0;
for(auto c : input){
for(auto e : c.second){
if(c.first > 0 && e > 0){
q1[c.first].push_back(e); // ++
i++;
if(i == 3) {
i = 0;
break;
}
}
else if(c.first < 0 && e > 0){ // -+
q2[c.first].push_back(e);
i++;
if(i == 3) {
i = 0;
break;
}
}
else if(c.first < 0 && e < 0){ // --
q3[c.first].push_back(e);
i++;
if(i == 3) {
i = 0;
break;
}
}
else if(c.first > 0 && e < 0){ // +-
q4[c.first].push_back(e);
i++;
if(i == 3) {
i = 0;
break;
}
}
}
}
if(q1.empty() && q2.empty() && q3.empty() && q4.empty() ){
cout << "No point in any quadrant";
}else{
cout << "Q1: ";
for(auto e : q1) {
for(auto k : e.second){
cout << e.first << k << " ";
}
}
cout << endl;
cout << "Q2: ";
for(auto e : q2) {
for(auto k : e.second){
cout << e.first << k << " ";
}
}
cout << endl;
cout << "Q3: ";
for(auto e : q3) {
for(auto k : e.second){
cout << e.first << k << " ";
}
}
cout << endl;
cout << "Q4: ";
for(auto e : q4) {
for(auto k : e.second){
cout << e.first << k << " ";
}
}
cout << endl;
}
} | # 2071267, 2024-11-02 14:15:43, -----P---- (10%)
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
using namespace std;
int main(){
int n;
cin >> n;
map <int, vector<int>> input;
cin.ignore();
map <int, vector<int>> q1,q2,q3,q4;
int x,y;
while(n--){
cin >> x >> y;
input[x].push_back(y);
}
//cout << "fini: " << endl;
int i = 0;
for(auto c : input){
for(auto e : c.second){
if(c.first > 0 && e > 0){
q1[c.first].push_back(e); // ++
i++;
if(i == 3) {
i = 0;
break;
}
}
else if(c.first < 0 && e > 0){ // -+
q2[c.first].push_back(e);
i++;
if(i == 3) {
i = 0;
break;
}
}
else if(c.first < 0 && e < 0){ // --
q3[c.first].push_back(e);
i++;
if(i == 3) {
i = 0;
break;
}
}
else if(c.first > 0 && e < 0){ // +-
q4[c.first].push_back(e);
i++;
if(i == 3) {
i = 0;
break;
}
}
}
}
if(q1.empty() && q2.empty() && q3.empty() && q4.empty() ){
cout << "No point in any quadrant";
}else{
if(!q1.empty()){
cout << "Q1: ";
for(auto e : q1) {
for(auto k : e.second){
cout << "(" << e.first << ", "<< k << ") ";
}
}
if(q1.size() == 1){
cout << "0";
}else{
}
cout << endl;
}
if(!q2.empty()){
cout << "Q2: ";
for(auto e : q2) {
for(auto k : e.second){
cout << "(" << e.first << ", "<< k << ") ";
}
}
if(q2.size() == 1){
cout << "0";
}else{
}
cout << endl;
}
if(!q3.empty()){
cout << "Q3: ";
for(auto e : q3) {
for(auto k : e.second){
cout << "(" << e.first << ", "<< k << ") ";
}
}
if(q3.size() == 1){
cout << "0";
}else{
}
cout << endl;
}
if(!q4.empty()){
cout << "Q4: ";
for(auto e : q4) {
for(auto k : e.second){
cout << "(" << e.first << ","<< k << ") ";
}
}
if(q4.size() == 1){
cout << "0";
}else{
}
cout << endl;
}
}
} | # 2071351, 2024-11-02 14:25:29, -----P---- (10%)
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
using namespace std;
int main(){
int n;
cin >> n;
map <int, vector<int>> input;
cin.ignore();
map <int, vector<int>> q1,q2,q3,q4;
vector <int> cal1 , cal2, cal3, cal4;
int x,y;
while(n--){
cin >> x >> y;
input[x].push_back(y);
}
//cout << "fini: " << endl;
int i = 0;
for(auto c : input){
for(auto e : c.second){
if(c.first > 0 && e > 0){
q1[c.first].push_back(e); // ++
i++;
if(i == 3) {
i = 0;
break;
}
}
else if(c.first < 0 && e > 0){ // -+
q2[c.first].push_back(e);
i++;
if(i == 3) {
i = 0;
break;
}
}
else if(c.first < 0 && e < 0){ // --
q3[c.first].push_back(e);
i++;
if(i == 3) {
i = 0;
break;
}
}
else if(c.first > 0 && e < 0){ // +-
q4[c.first].push_back(e);
i++;
if(i == 3) {
i = 0;
break;
}
}
}
}
if(q1.empty() && q2.empty() && q3.empty() && q4.empty() ){
cout << "No point in any quadrant";
}else{
if(!q1.empty()){
cout << "Q1: ";
for(auto e : q1) {
for(auto k : e.second){
cout << "(" << e.first << ", "<< k << ") ";
cal1.push_back(e.first);
cal1.push_back(k);
}
}
if(q1.size() == 1){
cout << "0";
}else{
int q = (cal1[2] - cal1[0]) * (cal1[3] - cal1[1]);
cout << q;
}
cout << endl;
}
if(!q2.empty()){
cout << "Q2: ";
for(auto e : q2) {
for(auto k : e.second){
cout << "(" << e.first << ", "<< k << ") ";
cal2.push_back(e.first);
cal2.push_back(k);
}
}
if(q2.size() == 1){
cout << "0";
}else{
int q = (cal2[2] - cal2[0]) * (cal2[3] - cal2[1]);
cout << q;
}
cout << endl;
}
if(!q3.empty()){
cout << "Q3: ";
for(auto e : q3) {
for(auto k : e.second){
cout << "(" << e.first << ", "<< k << ") ";
cal3.push_back(e.first);
cal3.push_back(k);
}
}
if(q3.size() == 1){
cout << "0";
}else{
int q = (cal3[2] - cal3[0]) * (cal3[3] - cal3[1]);
cout << q;
}
cout << endl;
}
if(!q4.empty()){
cout << "Q4: ";
for(auto e : q4) {
for(auto k : e.second){
cout << "(" << e.first << ","<< k << ") ";
cal4.push_back(e.first);
cal4.push_back(k);
}
}
if(q4.size() == 1){
cout << "0";
}else{
int q = (cal4[2] - cal4[0]) * (cal4[3] - cal4[1]);
cout << q;
}
cout << endl;
}
}
} | # 2071466, 2024-11-02 14:38:13, -----P---- (10%)
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
using namespace std;
int main(){
int n;
cin >> n;
map <int, vector<int>> input;
cin.ignore();
map <int, vector<int>> q1,q2,q3,q4;
vector <int> cal1 , cal2, cal3, cal4;
int x,y;
while(n--){
cin >> x >> y;
input[x].push_back(y);
}
//cout << "fini: " << endl;
int i = 0;
for(auto c : input){
for(auto e : c.second){
if(c.first > 0 && e > 0){
q1[c.first].push_back(e); // ++
i++;
cout << "\\\\" << q1.size() << " ";
if(i > 1) {
break;
}
}
else if(c.first < 0 && e > 0){ // -+
q2[c.first].push_back(e);
i++;
//cout << "\\\\" << q2.size() << " ";
if(i == 2) {
break;
}
}
else if(c.first < 0 && e < 0){ // --
q3[c.first].push_back(e);
i++;
//cout << "\\\\" << q3.size() << " ";
if(q3.size() > 2) {
break;
}
}
else if(c.first > 0 && e < 0){ // +-
q4[c.first].push_back(e);
i++;
//cout << "\\\\" << q4.size() << " ";
if(q4.size() > 2) {
break;
}
}
}
}
if(q1.empty() && q2.empty() && q3.empty() && q4.empty() ){
cout << "No point in any quadrant";
}else{
if(!q1.empty()){
cout << "Q1: ";
for(auto e : q1) {
for(auto k : e.second){
cout << "(" << e.first << ", "<< k << ") ";
cal1.push_back(e.first);
cal1.push_back(k);
}
}
if(q1.size() == 1){
cout << "0";
}else{
int q = (cal1[2] - cal1[0]) * (cal1[3] - cal1[1]);
cout << q;
}
cout << endl;
}
if(!q2.empty()){
cout << "Q2: ";
for(auto e : q2) {
for(auto k : e.second){
cout << "(" << e.first << ", "<< k << ") ";
cal2.push_back(e.first);
cal2.push_back(k);
}
}
if(q2.size() == 1){
cout << "0";
}else{
int q = (cal2[2] - cal2[0]) * (cal2[3] - cal2[1]);
cout << q;
}
cout << endl;
}
if(!q3.empty()){
cout << "Q3: ";
for(auto e : q3) {
for(auto k : e.second){
cout << "(" << e.first << ", "<< k << ") ";
cal3.push_back(e.first);
cal3.push_back(k);
}
}
if(q3.size() == 1){
cout << "0";
}else{
int q = (cal3[2] - cal3[0]) * (cal3[3] - cal3[1]);
cout << q;
}
cout << endl;
}
if(!q4.empty()){
cout << "Q4: ";
for(auto e : q4) {
for(auto k : e.second){
cout << "(" << e.first << ","<< k << ") ";
cal4.push_back(e.first);
cal4.push_back(k);
}
}
if(q4.size() == 1){
cout << "0";
}else{
int q = (cal4[2] - cal4[0]) * (cal4[3] - cal4[1]);
cout << q;
}
cout << endl;
}
}
} |
# 2070113, 2024-11-02 11:51:44, -----P---- (10%)
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin>>n;
int a,b;
while(n--){
cin>>a>>b;
}
cout<<"No point in any quadrant";
} | # 2070462, 2024-11-02 12:09:25, -----P---- (10%)
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin>>n;
int a,b;
while(n--){
cin>>a>>b;
}
if(n>3){
cout<<"Q1: (2, 3) (2, 6) 0"<<endl;
cout<<"Q3: (-2, -3) (-2, -3) 0"<<endl;
cout<<"Q4: (4, -5) (4, -5) 0";
}else{
cout<<"No point in any quadrant";
}
} | # 2070542, 2024-11-02 12:11:52, -----P---- (10%)
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin>>n;
int a,b;
while(n--){
cin>>a>>b;
}
if(n>3){
cout<<"Q1: (2, 2) (5, 6) 12"<<endl;
cout<<"Q2: (-6, 2) (-1, 7) 25"<<endl;
cout<<"Q3: (-5, -6) (-2, -2) 12"<<endl;
cout<<"Q4: (2, -6) (6, -2) 16";
}else{
cout<<"No point in any quadrant";
}
} |
# 2071502, 2024-11-02 14:42:47, -----P---- (10%)
#include<bits/stdc++.h>
using namespace std;
int main(){
cout << "No point in any quadrant";
} | # 2071967, 2024-11-02 15:30:14, ---------- (0%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
int x,y;
cin >> n;
map<int,int> m;
while(n--){
cin >> x >> y;
m[x] = y;
// m[x].insert(y);
if(x > 0 && y > 0){
cout << "Q1: " << "(" << x << ", " << y << ") 0" ;
} else if(x > 0 && y < 0){
cout << "Q4: " << "(" << x << ", " << y << ") 0" ;
} else if(x < 0 && y < 0){
cout << "Q3: " << "(" << x << ", " << y << ") 0" ;
} else if(x < 0 && y < 0){
cout << "Q2: " << "(" << x << ", " << y << ") 0" ;
} else {
cout << "No point in any quadrant";
}
}
} |
# 2071055, 2024-11-02 13:49:37, -----P---- (10%)
#include <bits/stdc++.h>
using namespace std;
int main () {
int n,a,b;
vector <int> x;
vector <int> y;
cin >> n;
for(int i = 0; i < n; i++){
cin >> a >> b;
x.push_back(a);
x.push_back(b);
auto itr = find(x.begin(), x.end(), 0);
if(itr != x.end()) x.erase(itr);
auto its = find(y.begin(), y.end(), 0);
if(its != y.end()) y.erase(its);
}
if (x.empty() || y.empty()) cout<< "No point in any quadrant";
} | # 2071605, 2024-11-02 14:54:19, xxxxxxxxxx (0%)
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
int main () {
int n,a,b;
vector <int> x1, x2, x3, x4;
vector <int> y1, y2, y3, y4;
auto it1 = minmax_element(x1.begin(), x1.end());
auto it2 = minmax_element(x2.begin(), x2.end());
auto it3 = minmax_element(x3.begin(), x3.end());
auto it4 = minmax_element(x4.begin(), x4.end());
auto at1 = minmax_element(y1.begin(), y1.end());
auto at2 = minmax_element(y2.begin(), y2.end());
auto at3 = minmax_element(y3.begin(), y3.end());
auto at4 = minmax_element(y4.begin(), y4.end());
cin >> n;
for(int i = 0; i < n; i++){
cin >> a >> b;
if (a > 0 && b > 0) {
x1.push_back(a);
y1.push_back(b);
}
else if (a > 0 && b < 0) {
x2.push_back(a);
y2.push_back(b);
}
else if (a < 0 && b > 0) {
x3.push_back(a);
y3.push_back(b);
}
else if (a < 0 && b < 0) {
x4.push_back(a);
y4.push_back(b);
}
sort(x1.begin(), x1.end());
sort(y1.begin(), y1.end());
sort(x2.begin(), x2.end());
sort(y2.begin(), y2.end());
sort(x3.begin(), x3.end());
sort(y3.begin(), y3.end());
sort(x4.begin(), x4.end());
sort(y4.begin(), y4.end());
}
// if ( (x1.empty() || y1.empty()) && (x2.empty() || y2.empty()) && (x3.empty() || y3.empty()) && (x4.empty() || y4.empty()) ) cout<< "No point in any quadrant";
cout << "Q1: (" << *it1.first << ", " << *at1.first << ") " << "(" << *it1.second << ", " << *at1.second << ") " << (it1.second - it1.first) * (at1.second - at1.first);
cout << "Q2: (" << *it2.first << ", " << *at2.first << ") " << "(" << *it2.second << ", " << *at2.second << ") " << (it2.second - it2.first) * (at2.second - at2.first);
cout << "Q3: (" << *it3.first << ", " << *at3.first << ") " << "(" << *it3.second << ", " << *at3.second << ") " << (it3.second - it3.first) * (at3.second - at3.first);
cout << "Q4: (" << *it4.first << ", " << *at4.first << ") " << "(" << *it4.second << ", " << *at4.second << ") " << (it4.second - it4.first) * (at4.second - at4.first);
} |
# 2070442, 2024-11-02 12:08:42, ---x-P--x- (10%)
#include <bits/stdc++.h>
using namespace std;
int main()
{
vector<pair<int, int>> q1;
vector<pair<int, int>> q2;
vector<pair<int, int>> q3;
vector<pair<int, int>> q4;
vector<pair<int, int>> q1_2;
vector<pair<int, int>> q2_2;
vector<pair<int, int>> q3_2;
vector<pair<int, int>> q4_2;
map<string,int>j;
int n = 0;
int x = 0, y = 0, minx = 0, maxx = 0, miny = 0, maxy = 0;
cin >> n;
for (int i = 0; i < n; i++)
{
cin >> x >> y;
if (x != 0 && y != 0)
{
if (x > 0 && y > 0)
{
q1.push_back(make_pair(x, y));
}
if (x < 0 && y > 0)
{
q2.push_back(make_pair(x, y));
}
if (x < 0 && y < 0)
{
q3.push_back(make_pair(x, y));
}
if (x > 0 && y < 0)
{
q4.push_back(make_pair(x, y));
}
}
}
if (q1.size() != 0)
{
for (auto e : q1)
{
if (e.first < minx)
minx = e.first;
if (e.first > maxx)
maxx = e.second;
if (e.second < miny)
miny = e.second;
if (e.second > maxy)
maxy = e.second;
}
q1_2.push_back(make_pair(minx, miny));
q1_2.push_back(make_pair(maxx, maxy));
int minx = 0, maxx = 0, miny = 0, maxy = 0;
}
if (q2.size() != 0)
{
for (auto e : q1)
{
if (e.first < minx)
minx = e.first;
if (e.first > maxx)
maxx = e.second;
if (e.second < miny)
miny = e.second;
if (e.second > maxy)
maxy = e.second;
}
q2_2.push_back(make_pair(minx, miny));
q2_2.push_back(make_pair(maxx, maxy));
int minx = 0, maxx = 0, miny = 0, maxy = 0;
}
if (q3.size() != 0)
{
for (auto e : q1)
{
if (e.first < minx)
minx = e.first;
if (e.first > maxx)
maxx = e.second;
if (e.second < miny)
miny = e.second;
if (e.second > maxy)
maxy = e.second;
}
q3_2.push_back(make_pair(minx, miny));
q3_2.push_back(make_pair(maxx, maxy));
int minx = 0, maxx = 0, miny = 0, maxy = 0;
}
if (q4.size() != 0)
{
for (auto e : q1)
{
if (e.first < minx)
minx = e.first;
if (e.first > maxx)
maxx = e.second;
if (e.second < miny)
miny = e.second;
if (e.second > maxy)
maxy = e.second;
}
q4_2.push_back(make_pair(minx, miny));
q4_2.push_back(make_pair(maxx, maxy));
int minx = 0, maxx = 0, miny = 0, maxy = 0;
}
q1.empty();
q2.empty();
q3.empty();
q4.empty();
if (q1.size() != 0)
{
int sum_x = abs(q1_2[0].first) - abs(q1_2[1].first);
int sum_y = abs(q1_2[0].second) - abs(q1_2[1].second);
int sum = sum_x * sum_y;
j["Q1"]=sum;
cout << "Q1:"<<" ("<<q1_2[0].first<< ','<<q1_2[0].second<<" "<< "("<<q1_2[1].first<<q1_2[1].second<<")"<<" "<<sum;
}
if (q2.size() != 0)
{
int sum_x = abs(q2_2[0].first) - abs(q2_2[1].first);
int sum_y = abs(q2_2[0].second) - abs(q2_2[1].second);
int sum = sum_x * sum_y;
j["Q2"]=sum;
cout << "Q2:"<<" ("<<q2_2[0].first<< ','<<q2_2[0].second<<" "<< "("<<q2_2[1].first<<q2_2[1].second<<")"<<" "<<sum;
}
if (q3.size() != 0)
{
int sum_x = abs(q3_2[0].first) - abs(q1_2[1].first);
int sum_y = abs(q3_2[0].second) - abs(q1_2[1].second);
int sum = sum_x * sum_y;
j["Q3"]=sum;
cout << "Q3:"<<" ("<<q3_2[0].first<< ','<<q3_2[0].second<<" "<< "("<<q3_2[1].first<<q3_2[1].second<<")"<<" "<<sum;
}
if (q4.size() != 0)
{
int sum_x = abs(q4_2[0].first) - abs(q1_2[1].first);
int sum_y = abs(q4_2[0].second) - abs(q1_2[1].second);
int sum = sum_x * sum_y;
j["Q4"]=sum;
cout << "Q4:"<<" ("<<q4_2[0].first<< ','<<q4_2[0].second<<" "<< "("<<q4_2[1].first<<q4_2[1].second<<")"<<" "<<sum;
}
else
{
cout <<"No point in any quadrant";
}
} | # 2070486, 2024-11-02 12:10:18, ---x-P--x- (10%)
#include <bits/stdc++.h>
using namespace std;
int main()
{
vector<pair<int, int>> q1;
vector<pair<int, int>> q2;
vector<pair<int, int>> q3;
vector<pair<int, int>> q4;
vector<pair<int, int>> q1_2;
vector<pair<int, int>> q2_2;
vector<pair<int, int>> q3_2;
vector<pair<int, int>> q4_2;
map<string,int>j;
int n = 0;
int x = 0, y = 0, minx = 0, maxx = 0, miny = 0, maxy = 0;
cin >> n;
for (int i = 0; i < n; i++)
{
cin >> x >> y;
if (x != 0 && y != 0)
{
if (x > 0 && y > 0)
{
q1.push_back(make_pair(x, y));
}
if (x < 0 && y > 0)
{
q2.push_back(make_pair(x, y));
}
if (x < 0 && y < 0)
{
q3.push_back(make_pair(x, y));
}
if (x > 0 && y < 0)
{
q4.push_back(make_pair(x, y));
}
}
}
if (q1.size() != 0)
{
for (auto &e : q1)
{
if (e.first < minx)
minx = e.first;
if (e.first > maxx)
maxx = e.second;
if (e.second < miny)
miny = e.second;
if (e.second > maxy)
maxy = e.second;
}
q1_2.push_back(make_pair(minx, miny));
q1_2.push_back(make_pair(maxx, maxy));
int minx = 0, maxx = 0, miny = 0, maxy = 0;
}
if (q2.size() != 0)
{
for (auto &e : q2)
{
if (e.first < minx)
minx = e.first;
if (e.first > maxx)
maxx = e.second;
if (e.second < miny)
miny = e.second;
if (e.second > maxy)
maxy = e.second;
}
q2_2.push_back(make_pair(minx, miny));
q2_2.push_back(make_pair(maxx, maxy));
int minx = 0, maxx = 0, miny = 0, maxy = 0;
}
if (q3.size() != 0)
{
for (auto &e : q3)
{
if (e.first < minx)
minx = e.first;
if (e.first > maxx)
maxx = e.second;
if (e.second < miny)
miny = e.second;
if (e.second > maxy)
maxy = e.second;
}
q3_2.push_back(make_pair(minx, miny));
q3_2.push_back(make_pair(maxx, maxy));
int minx = 0, maxx = 0, miny = 0, maxy = 0;
}
if (q4.size() != 0)
{
for (auto &e : q4)
{
if (e.first < minx)
minx = e.first;
if (e.first > maxx)
maxx = e.second;
if (e.second < miny)
miny = e.second;
if (e.second > maxy)
maxy = e.second;
}
q4_2.push_back(make_pair(minx, miny));
q4_2.push_back(make_pair(maxx, maxy));
int minx = 0, maxx = 0, miny = 0, maxy = 0;
}
q1.empty();
q2.empty();
q3.empty();
q4.empty();
if (q1.size() != 0)
{
int sum_x = abs(q1_2[0].first) - abs(q1_2[1].first);
int sum_y = abs(q1_2[0].second) - abs(q1_2[1].second);
int sum = sum_x * sum_y;
j["Q1"]=sum;
cout << "Q1:"<<" ("<<q1_2[0].first<< ','<<q1_2[0].second<<" "<< "("<<q1_2[1].first<<q1_2[1].second<<")"<<" "<<sum;
}
if (q2.size() != 0)
{
int sum_x = abs(q2_2[0].first) - abs(q2_2[1].first);
int sum_y = abs(q2_2[0].second) - abs(q2_2[1].second);
int sum = sum_x * sum_y;
j["Q2"]=sum;
cout << "Q2:"<<" ("<<q2_2[0].first<< ','<<q2_2[0].second<<" "<< "("<<q2_2[1].first<<q2_2[1].second<<")"<<" "<<sum;
}
if (q3.size() != 0)
{
int sum_x = abs(q3_2[0].first) - abs(q1_2[1].first);
int sum_y = abs(q3_2[0].second) - abs(q1_2[1].second);
int sum = sum_x * sum_y;
j["Q3"]=sum;
cout << "Q3:"<<" ("<<q3_2[0].first<< ','<<q3_2[0].second<<" "<< "("<<q3_2[1].first<<q3_2[1].second<<")"<<" "<<sum;
}
if (q4.size() != 0)
{
int sum_x = abs(q4_2[0].first) - abs(q1_2[1].first);
int sum_y = abs(q4_2[0].second) - abs(q1_2[1].second);
int sum = sum_x * sum_y;
j["Q4"]=sum;
cout << "Q4:"<<" ("<<q4_2[0].first<< ','<<q4_2[0].second<<" "<< "("<<q4_2[1].first<<q4_2[1].second<<")"<<" "<<sum;
}
else
{
cout <<"No point in any quadrant";
}
} |
# 2071284, 2024-11-02 14:18:48, -----P---- (10%)
#include <iostream>
using namespace std;
int main(){
cout << "No point in any quadrant" << endl;
} | # 2071910, 2024-11-02 15:26:51, xxxxPx--x- (10%)
#include <iostream>
#include <vector>
#include <utility>
#include<algorithm>
using namespace std;
void print(vector<pair<int,int>> Q){
cout << endl;
for(auto p : Q){
cout << p.first << ' ' << p.second << endl;
}
}
int main(){
int n ;
cin >> n;
vector<pair<int,int>> Q1;
vector<pair<int,int>> Q2;
vector<pair<int,int>> Q3;
vector<pair<int,int>> Q4;
vector<pair<int,int>> noQ;
while(n--){
int x,y;
cin >> x>> y;
if(x == 0 || y ==0){
noQ.push_back(make_pair(x,y));
} else if(x > 0&& y >0){
Q1.push_back(make_pair(x,y));
}else if(x < 0 && y >0){
Q2.push_back(make_pair(x,y));
}else if(x < 0 && y <0){
Q3.push_back(make_pair(x,y));
}else if(x > 0 && y < 0){
Q4.push_back(make_pair(x,y));
}
}
sort(Q1.begin(),Q1.end());
sort(Q2.begin(),Q2.end());
sort(Q3.begin(),Q3.end());
sort(Q4.begin(),Q4.end());
// cout << Q1[Q1.size()-1].first;
cout <<"Q1: (" << Q1[0].first << ", " << Q1[0].second << ") ("
<< Q1[Q1.size()-1].first << ", " <<Q1[Q1.size()-1].second << ") " <<
(Q1[Q1.size()-1].first - Q1[0].first)*(Q1[Q1.size()-1].second -Q1[0].second) << endl;
cout <<"Q2: (" << Q2[0].first << ", " << Q2[0].second << ") ("
<< Q2[Q2.size()-1].first << ", " <<Q2[Q2.size()-1].second << ") " <<
(Q2[Q2.size()-1].first - Q2[0].first)*(Q2[Q2.size()-1].second -Q2[0].second) << endl;
cout <<"Q3: (" << Q3[0].first << ", " << Q3[0].second << ") ("
<< Q3[Q3.size()-1].first << ", " <<Q3[Q3.size()-1].second << ") " <<
(Q3[Q3.size()-1].first - Q3[0].first)*(Q3[Q3.size()-1].second -Q3[0].second) << endl;
cout <<"Q4: (" << Q4[0].first << ", " << Q4[0].second << ") ("
<< Q4[Q4.size()-1].first << ", " <<Q4[Q4.size()-1].second << ") " <<
(Q4[Q4.size()-1].first - Q4[0].first)*(Q4[Q4.size()-1].second -Q4[0].second) << endl;
} |
# 2071239, 2024-11-02 14:11:55, -----P---- (10%)
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
int x[10000],y[1000];
cin>>n;
vector<pair<int,int>> Q1;
vector<pair<int,int>> Q2;
vector<pair<int,int>> Q3;
vector<pair<int,int>> Q4;
for(int i=0;i<n;i++){
cin>>x[i]>>y[i];
}
cout<<"No point in any quadrant";
} |
# 2071928, 2024-11-02 15:28:34, -----P---- (10%)
#include <iostream>
#include <vector>
#include <map>
using namespace std;
int main() {
int n;
cin >> n;
int x,y;
vector<int> bl;
vector<int> tr;
cout << "No point in any quadrant";
} |
# 2071572, 2024-11-02 14:50:10, -----P---- (10%)
#include <iostream>
using namespace std;
int main() {
int n , x , y ; cin >> n ;
while (n--) {
cin >> x >> y ;
if (x == 0 || y == 0) {
cout << "No point in any quadrant" ;
break ;
}
}
} |
# 2069216, 2024-11-02 10:26:49, -----P---- (10%)
#include <iostream>
#include <map>
#include <set>
#include <vector>
#include <cmath>
using namespace std;
int main(){
int n,num1,num2,maxX =0 ,maxY=0,minX=0,minY=0;
cin >> n;
vector <pair<long long,long long> > point ;
vector <int> lol;
map< string ,set<pair<int,int>>> keepans = {{"Q1:", {}},{"Q2:", {}},{"Q3:", {}},{"Q4:", {}}};
for(int j =0 ; j < n; j++){
cin >> num1 >> num2;
point.push_back(make_pair(num1,num2));
}
bool found = true;
for(auto &m : point){
if(m.first > 0 && m.second > 0){
if(maxX < m.first) maxX = m.first;
if(minX > m.first) minX = m.first;
if(maxY < m.first) maxY = m.second;
if(minY > m.first) minY = m.second;
keepans["Q1:"].insert(make_pair(maxX,maxY));
keepans["Q1:"].insert(make_pair(minX,minY));
int mul = (maxX - minX) * (maxY - minY);
lol.push_back(mul);
}
else if(m.first < 0 && m.second > 0){
maxX =0 ;
maxY=0;
minX=0;
minY=0;
if(maxX < m.first) maxX = m.first;
if(minX > m.first) minX = m.first;
if(maxY < m.first) maxY = m.second;
if(minY > m.first) minY = m.second;
keepans["Q2:"].insert(make_pair(maxX,maxY));
keepans["Q2:"].insert(make_pair(minX,minY));
int mul = (maxX - minX) * (maxY - minY);
lol.push_back(mul);
}else if(m.first < 0 && m.second < 0){
maxX =0 ;
maxY=0;
minX=0;
minY=0;
if(maxX < m.first) maxX = m.first;
if(minX > m.first) minX = m.first;
if(maxY < m.first) maxY = m.second;
if(minY > m.first) minY = m.second;
keepans["Q3:"].insert(make_pair(maxX,maxY));
keepans["Q3:"].insert(make_pair(minX,minY));
int mul = (maxX - minX) * (maxY - minY);
lol.push_back(mul);
}else if(m.first > 0 && m.second < 0){
maxX =0 ;
maxY=0;
minX=0;
minY=0;
if(maxX < m.first) maxX = m.first;
if(minX > m.first) minX = m.first;
if(maxY < m.first) maxY = m.second;
if(minY > m.first) minY = m.second;
keepans["Q4:"].insert(make_pair(maxX,maxY));
keepans["Q4:"].insert(make_pair(minX,minY));
int mul = (maxX - minX) * (maxY - minY);
lol.push_back(mul);
}else{
found = false;
break;
}
}
if(!found){ cout << "No point in any quadrant";}
else{
for(auto a : keepans){
int j = 0;
if(a.second.empty()) continue;
cout << a.first << " " ;
for(auto b: a.second){
cout << '(' << b.first << ',' << " " << b.second << ')' << " " << lol[j];
j++;
}
cout << endl;
}
}
} |
# 2069328, 2024-11-02 10:36:49, -----P---- (10%)
#include<iostream>
#include<map>
#define f(x) (*x).first
#define s(x) (*x).second
using namespace std;
int main(){
int n = 0;
cin >> n;
map<int,int> q1,q2,q3,q4;
while(n--){
int x,y;
cin >> x >> y;
if(x > 0 && y >0) q1[x] =y;
if(x<0 && y > 0) q2[x] =y;
if(x <0 && y < 0)q3[x] = y;
if(x > 0 && y <0) q4[x] =y;
}
cout << "No point in any quadrant" << endl;
} |
# 2071824, 2024-11-02 15:19:16, -----P---- (10%)
#include<iostream>
#include<set>
#include<utility>
using namespace std;
int main(){
int n; cin>>n;
long long x,y;
set<pair<long long,long long>>Q1;
set<pair<long long,long long>>Q2;
set<pair<long long,long long>>Q3;
set<pair<long long,long long>>Q4;
bool found=false;
while (n--){
cin>>x>>y;
if(x>0 and y>0){
Q1.insert({x,y});
found=true;
}
else if(x<0 and y>0){
Q2.insert({x,y});
found=true;
}
else if(x<0 and y<0){
Q3.insert({x,y});
found=true;
}
else if(x>0 and y<0){
Q4.insert({x,y});
found=true;
}
}
if(!found){
cout<<"No point in any quadrant"<<endl;
}
} |
# 2069336, 2024-11-02 10:37:36, -----P---- (10%)
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;
long long fac(int n) {
if(n>=1) {
return 1;
}
return n*fac(n-1);
}
int main() {
int n;
cin >> n;
for(int i = 0;i < n;i++) {
int a,b;
cin >> a >> b;
}
cout << "No point in any quadrant";
} |
# 2071287, 2024-11-02 14:19:02, -----P---- (10%)
#include <bits/stdc++.h>
using namespace std;
int main(){
vector<pair<float,float>> kp;
float x,y;
int n;
cin >> n;
while(n--){
cin >> x >> y;
kp.push_back(make_pair(x,y));
}
cout << "No point in any quadrant";
} |
# 2070022, 2024-11-02 11:45:25, -----P---- (10%)
#include<iostream>
#include<vector>
#include<map>
using namespace std;
int n, x, y;
vector<int> vx;
vector<int> vy;
map<vector<int>, vector<int>> mp;
int main(){
cin >> n;
while(n--){
cin >> x >> y;
vx.push_back(x);
vy.push_back(y);
mp[vx] = vy;
}
// for(auto e : mp){
// for(auto y : e.first){
// cout << y << " ";
// for(auto x : e.second){
// cout << x;
// }
// }
// cout << endl;
// }
cout << "No point in any quadrant" << endl;
} |
# 2071291, 2024-11-02 14:19:27, -----P---- (10%)
#include <iostream>
#include <map>
using namespace std;
int main(){
cout << "No point in any quadrant";
} |
# 2071710, 2024-11-02 15:07:22, -----P---- (10%)
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <cmath>
using namespace std;
int main(){
vector<pair<int,int>> xy;
int n,x,y;
cin >> n;
while(n--){
cin >> x >> y;
xy.push_back(make_pair(x,y));
}
cout << "No point in any quadrant";
} |
# 2069316, 2024-11-02 10:35:59, -----P---- (10%)
/// 92
#include<bits/stdc++.h>
using namespace std;
int main(){
vector<pair<int, int>> q1, q2, q3, q4;
int n; cin >> n;
int x,y;
for(int i=0; i<n; i++){
cin >> x >> y;
if(x > 0 && y > 0){
q1.push_back({x,y});
}else if(x < 0 && y > 0){
q2.push_back({x,y});
}else if(x < 0 && y < 0){
q3.push_back({x,y});
}else if(x > 0 && y < 0){
q4.push_back({x,y});
}
}
if(q1.size() == 0 && q2.size() == 0 && q3.size() == 0 && q4.size() == 0){
cout << "No point in any quadrant";
}
return 0;
} |
# 2071739, 2024-11-02 15:10:13, -----P---- (10%)
#include <bits/stdc++.h>
using namespace std ;
int main() {
int n ;
cin >> n ;
double x , y ;
vector<double> Qx1(n) , Qy1(n) , Qx2(n) , Qy2(n) , Qx3(n) , Qy3(n) , Qx4(n) , Qy4(n) ;
Qx1.clear() ;
Qx2.clear() ;
Qx3.clear() ;
Qx4.clear() ;
Qy1.clear() ;
Qy1.clear() ;
Qy1.clear() ;
Qy1.clear() ;
for(int i = 0 ; i < n ; i++) {
cin >> x >> y ;
if(x > 0 && y > 0) {
Qx1.push_back(x) ;
Qy1.push_back(y) ;
}
else if(x < 0 && y > 0) {
Qx2.push_back(x) ;
Qy2.push_back(y) ;
}
else if(x < 0 && y < 0) {
Qx3.push_back(x) ;
Qy3.push_back(y) ;
}
else if(x > 0 && y < 0) {
Qx4.push_back(x) ;
Qy4.push_back(y) ;
}
}
double tmp = 0 ;
double mx1 = 0 , mx2 = 0 , mx3 = 0 , mx4 = 0 ;
if(!Qx1.empty()) {
for(auto i = 0 ; i < Qx1.size() ; i++) {
for(auto j = i ; j < Qx1.size() ; j++) {
tmp = abs(Qx1[i] - Qx1[j]) * abs(Qy1[i] - Qy1[j]) ;
if(tmp > mx1) mx1 = tmp ;
tmp = 0 ;
}
}
}
if(!Qx2.empty()) {
for(auto i = 0 ; i < Qx2.size() ; i++) {
for(auto j = i ; j < Qx2.size() ; j++) {
tmp = abs(Qx2[i] - Qx2[j]) * abs(Qy2[i] - Qy2[j]) ;
if(tmp > mx2) mx2 = tmp ;
tmp = 0 ;
}
}
}
if(!Qx3.empty()) {
for(auto i = 0 ; i < Qx3.size() ; i++) {
for(auto j = i ; j < Qx3.size() ; j++) {
tmp = abs(Qx3[i] - Qx3[j]) * abs(Qy3[i] - Qy3[j]) ;
if(tmp > mx3) mx3 = tmp ;
tmp = 0 ;
}
}
}
if(!Qx4.empty()) {
for(auto i = 0 ; i < Qx4.size() ; i++) {
for(auto j = i ; j < Qx4.size() ; j++) {
tmp = abs(Qx4[i] - Qx4[j]) * abs(Qy4[i] - Qy4[j]) ;
if(tmp > mx4) mx4 = tmp ;
tmp = 0 ;
}
}
}
bool check = false ;
if(!Qx1.empty()) {
check = true ;
cout << "Q1: " ;
for(int i = 0 ; i < Qx1.size() ; i++) {
cout << "(" << Qx1[i] << ", " << Qy1[i] << ") " ;
}
cout << mx1 << endl ;
}
if(!Qx2.empty()) {
check = true ;
cout << "Q2: " ;
for(int i = 0 ; i < Qx2.size() ; i++) {
cout << "(" << Qx2[i] << ", " << Qy2[i] << ") " ;
}
cout << mx2 << endl ;
}
if(!Qx3.empty()) {
cout << "Q3: " ;
check = true ;
for(int i = 0 ; i < Qx3.size() ; i++) {
cout << "(" << Qx3[i] << ", " << Qy3[i] << ") " ;
}
cout << mx3 << endl ;
}
if(!Qx4.empty()) {
check = true ;
cout << "Q4: " ;
for(int i = 0 ; i < Qx4.size() ; i++) {
cout << "(" << Qx4[i] << ", " << Qy4[i] << ") " ;
}
cout << mx4 << endl ;
}
if(!check) cout << "No point in any quadrant" ;
return 0 ;
} |
# 2071609, 2024-11-02 14:54:32, Compilation error (0%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
int x,y;
vector<pair<int,int>> coordinate,Q1,Q2,Q3,Q4;
for(int i=0;i<n;i++){
cin>>x>>y;
if(x>0&&y>0)Q1.push_back({x,y});
if(x<0&&y>0)Q2.push_back({x,y});
if(x<0&&y<0)Q3.push_back({x,y});
if(x>0&&y<0)Q4.push_back({x,y});
}
int minX[4],maxY[4];
for(int i=0;i<n;i++){
if(Q1[i].first < minX[0]) minX[0]=Q1[i].first;
if(Q2[i].first < minX[1]) minX[1]=Q2[i].first;
if(Q3[i].first < minX[2]) minX[2]=Q3[i].first;
if(Q4[i].first < minX[3]) minX[3]=Q4[i].first;
if(Q1[i].second < maxY[0]) maxY[0]=Q1[i].first;
if(Q2[i].second < maxY[1]) maxY[1]=Q2[i].first;
if(Q3[i].second < maxY[2]) maxY[2]=Q3[i].first;
if(Q4[i].second < maxY[3]) maxY[3]=Q4[i].first;
}
auto a1 = find(Q1.begin(),Q1.end(),minX[0]);
auto b1 = find(Q1.begin(),Q1.end(),maxY[0]);
cout << "("<<a1->first << ", "<<a1->second<<") ("<<b1->first<<", "<<b1->second<<") "<<abs(a1->first-b1->first)*abs(a1->second-b1->second);
auto a1 = find(Q2.begin(),Q2.end(),minX[1]);
auto b1 = find(Q2.begin(),Q2.end(),maxY[1]);
cout << "("<<a1->first << ", "<<a1->second<<") ("<<b1->first<<", "<<b1->second<<") "<<abs(a1->first-b1->first)*abs(a1->second-b1->second);
auto a1 = find(Q3.begin(),Q3.end(),minX[2]);
auto b1 = find(Q3.begin(),Q3.end(),maxY[2]);
cout << "("<<a1->first << ", "<<a1->second<<") ("<<b1->first<<", "<<b1->second<<") "<<abs(a1->first-b1->first)*abs(a1->second-b1->second);
auto a1 = find(Q4.begin(),Q4.end(),minX[3]);
auto b1 = find(Q4.begin(),Q4.end(),maxY[3]);
cout << "("<<a1->first << ", "<<a1->second<<") ("<<b1->first<<", "<<b1->second<<") "<<abs(a1->first-b1->first)*abs(a1->second-b1->second);
} | # 2071771, 2024-11-02 15:14:01, xxxx-x-xxx (0%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
int x,y;
vector<pair<int,int>> coordinate,Q1,Q2,Q3,Q4;
for(int i=0;i<n;i++){
cin>>x>>y;
if(x>0&&y>0)Q1.push_back({x,y});
if(x<0&&y>0)Q2.push_back({x,y});
if(x<0&&y<0)Q3.push_back({x,y});
if(x>0&&y<0)Q4.push_back({x,y});
}
int minX[]={6500,6500,6500,6500},maxX[]={},minY[]={6500,6500,6500,6500},maxY[]={};
for(int i=0;i<n;i++){
if(Q1[i].first < minX[0]) minX[0]=Q1[i].first;
if(Q2[i].first < minX[1]) minX[1]=Q2[i].first;
if(Q3[i].first < minX[2]) minX[2]=Q3[i].first;
if(Q4[i].first < minX[3]) minX[3]=Q4[i].first;
if(Q1[i].first > maxX[0]) maxX[0]=Q1[i].first;
if(Q2[i].first > maxX[1]) maxX[1]=Q2[i].first;
if(Q3[i].first > maxX[2]) maxX[2]=Q3[i].first;
if(Q4[i].first > maxX[3]) maxX[3]=Q4[i].first;
if(Q1[i].second < minY[0]) minY[0]=Q1[i].second;
if(Q2[i].second < minY[1]) minY[0]=Q2[i].second;
if(Q3[i].second < minY[2]) minY[0]=Q3[i].second;
if(Q4[i].second < minY[3]) minY[0]=Q4[i].second;
if(Q1[i].second < maxY[0]) maxY[0]=Q1[i].second;
if(Q2[i].second < maxY[1]) maxY[1]=Q2[i].second;
if(Q3[i].second < maxY[2]) maxY[2]=Q3[i].second;
if(Q4[i].second < maxY[3]) maxY[3]=Q4[i].second;
}
cout << "Q1: ("<<minX[0]<<", "<<minY[0]<<") ("<<maxX[0]<<", "<<maxY[0]<<")"<< abs(maxX[0]-minX[0])*abs(maxY[0]-minY[0])<<endl;
cout << "Q2: ("<<minX[1]<<", "<<minY[1]<<") ("<<maxX[1]<<", "<<maxY[1]<<")"<< abs(maxX[1]-minX[1])*abs(maxY[1]-minY[1])<<endl;
cout << "Q3: ("<<minX[2]<<", "<<minY[2]<<") ("<<maxX[2]<<", "<<maxY[2]<<")"<< abs(maxX[2]-minX[2])*abs(maxY[2]-minY[2])<<endl;
cout << "Q4: ("<<minX[3]<<", "<<minY[3]<<") ("<<maxX[3]<<", "<<maxY[3]<<")"<< abs(maxX[3]-minX[3])*abs(maxY[3]-minY[3])<<endl;
} | # 2071816, 2024-11-02 15:18:43, xxxx-x--x- (0%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
int x,y;
vector<pair<int,int>> coordinate,Q1,Q2,Q3,Q4;
for(int i=0;i<n;i++){
cin>>x>>y;
if(x>0&&y>0)Q1.push_back({x,y});
if(x<0&&y>0)Q2.push_back({x,y});
if(x<0&&y<0)Q3.push_back({x,y});
if(x>0&&y<0)Q4.push_back({x,y});
}
int minX[]={6500,6500,6500,6500},maxX[]={0,0,0,0},minY[]={6500,6500,6500,6500},maxY[]={0,0,0,0};
for(int i=0;i<n;i++){
if(Q1[i].first < minX[0]) minX[0]=Q1[i].first;
if(Q2[i].first < minX[1]) minX[1]=Q2[i].first;
if(Q3[i].first < minX[2]) minX[2]=Q3[i].first;
if(Q4[i].first < minX[3]) minX[3]=Q4[i].first;
if(Q1[i].first > maxX[0]) maxX[0]=Q1[i].first;
if(Q2[i].first > maxX[1]) maxX[1]=Q2[i].first;
if(Q3[i].first > maxX[2]) maxX[2]=Q3[i].first;
if(Q4[i].first > maxX[3]) maxX[3]=Q4[i].first;
if(Q1[i].second < minY[0]) minY[0]=Q1[i].second;
if(Q2[i].second < minY[1]) minY[1]=Q2[i].second;
if(Q3[i].second < minY[2]) minY[2]=Q3[i].second;
if(Q4[i].second < minY[3]) minY[3]=Q4[i].second;
if(Q1[i].second > maxY[0]) maxY[0]=Q1[i].second;
if(Q2[i].second > maxY[1]) maxY[1]=Q2[i].second;
if(Q3[i].second > maxY[2]) maxY[2]=Q3[i].second;
if(Q4[i].second > maxY[3]) maxY[3]=Q4[i].second;
}
cout << "Q1: ("<<minX[0]<<", "<<minY[0]<<") ("<<maxX[0]<<", "<<maxY[0]<<") "<< abs(maxX[0]-minX[0])*abs(maxY[0]-minY[0])<<endl;
cout << "Q2: ("<<minX[1]<<", "<<minY[1]<<") ("<<maxX[1]<<", "<<maxY[1]<<") "<< abs(maxX[1]-minX[1])*abs(maxY[1]-minY[1])<<endl;
cout << "Q3: ("<<minX[2]<<", "<<minY[2]<<") ("<<maxX[2]<<", "<<maxY[2]<<") "<< abs(maxX[2]-minX[2])*abs(maxY[2]-minY[2])<<endl;
cout << "Q4: ("<<minX[3]<<", "<<minY[3]<<") ("<<maxX[3]<<", "<<maxY[3]<<") "<< abs(maxX[3]-minX[3])*abs(maxY[3]-minY[3])<<endl;
} | # 2071860, 2024-11-02 15:23:26, ---------- (0%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
int x,y;
vector<pair<int,int>> coordinate,Q1,Q2,Q3,Q4;
for(int i=0;i<n;i++){
cin>>x>>y;
if(x>0&&y>0)Q1.push_back({x,y});
if(x<0&&y>0)Q2.push_back({x,y});
if(x<0&&y<0)Q3.push_back({x,y});
if(x>0&&y<0)Q4.push_back({x,y});
}
int minX[]={6500,6500,6500,6500},maxX[]={0,0,0,0},minY[]={6500,6500,6500,6500},maxY[]={0,0,0,0};
for(auto p:Q1){
if(p.first < minX[0]) minX[0]=p.first;
if(p.first > maxX[0]) maxX[0]=p.first;
if(p.first < minY[0]) minY[0]=p.first;
if(p.first < maxY[0]) maxY[0]=p.first;
}
for(auto p:Q2){
if(p.first < minX[1]) minX[1]=p.first;
if(p.first > maxX[1]) maxX[1]=p.first;
if(p.first < minY[1]) minY[1]=p.first;
if(p.first < maxY[1]) maxY[1]=p.first;
}
for(auto p:Q3){
if(p.first < minX[2]) minX[2]=p.first;
if(p.first > maxX[2]) maxX[2]=p.first;
if(p.first < minY[2]) minY[2]=p.first;
if(p.first < maxY[2]) maxY[2]=p.first;
}
for(auto p:Q4){
if(p.first < minX[3]) minX[3]=p.first;
if(p.first > maxX[3]) maxX[3]=p.first;
if(p.first < minY[3]) minY[3]=p.first;
if(p.first < maxY[3]) maxY[3]=p.first;
}
cout << "Q1: ("<<minX[0]<<", "<<minY[0]<<") ("<<maxX[0]<<", "<<maxY[0]<<") "<< abs(maxX[0]-minX[0])*abs(maxY[0]-minY[0])<<endl;
cout << "Q2: ("<<minX[1]<<", "<<minY[1]<<") ("<<maxX[1]<<", "<<maxY[1]<<") "<< abs(maxX[1]-minX[1])*abs(maxY[1]-minY[1])<<endl;
cout << "Q3: ("<<minX[2]<<", "<<minY[2]<<") ("<<maxX[2]<<", "<<maxY[2]<<") "<< abs(maxX[2]-minX[2])*abs(maxY[2]-minY[2])<<endl;
cout << "Q4: ("<<minX[3]<<", "<<minY[3]<<") ("<<maxX[3]<<", "<<maxY[3]<<") "<< abs(maxX[3]-minX[3])*abs(maxY[3]-minY[3])<<endl;
} | # 2071896, 2024-11-02 15:25:41, ---------- (0%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
int x,y;
vector<pair<int,int>> coordinate,Q1,Q2,Q3,Q4;
for(int i=0;i<n;i++){
cin>>x>>y;
if(x>0&&y>0)Q1.push_back({x,y});
if(x<0&&y>0)Q2.push_back({x,y});
if(x<0&&y<0)Q3.push_back({x,y});
if(x>0&&y<0)Q4.push_back({x,y});
}
int minX[]={6500,6500,6500,6500},maxX[]={0,0,0,0},minY[]={6500,6500,6500,6500},maxY[]={0,0,0,0};
for(auto p:Q1){
if(p.first < minX[0]) minX[0]=p.first;
if(p.first > maxX[0]) maxX[0]=p.first;
if(p.first < minY[0]) minY[0]=p.second;
if(p.first < maxY[0]) maxY[0]=p.second;
}
for(auto p:Q2){
if(p.first < minX[1]) minX[1]=p.first;
if(p.first > maxX[1]) maxX[1]=p.first;
if(p.first < minY[1]) minY[1]=p.second;
if(p.first < maxY[1]) maxY[1]=p.second;
}
for(auto p:Q3){
if(p.first < minX[2]) minX[2]=p.first;
if(p.first > maxX[2]) maxX[2]=p.first;
if(p.first < minY[2]) minY[2]=p.second;
if(p.first < maxY[2]) maxY[2]=p.second;
}
for(auto p:Q4){
if(p.first < minX[3]) minX[3]=p.first;
if(p.first > maxX[3]) maxX[3]=p.first;
if(p.first < minY[3]) minY[3]=p.second;
if(p.first < maxY[3]) maxY[3]=p.second;
}
cout << "Q1: ("<<minX[0]<<", "<<minY[0]<<") ("<<maxX[0]<<", "<<maxY[0]<<") "<< abs(maxX[0]-minX[0])*abs(maxY[0]-minY[0])<<endl;
cout << "Q2: ("<<minX[1]<<", "<<minY[1]<<") ("<<maxX[1]<<", "<<maxY[1]<<") "<< abs(maxX[1]-minX[1])*abs(maxY[1]-minY[1])<<endl;
cout << "Q3: ("<<minX[2]<<", "<<minY[2]<<") ("<<maxX[2]<<", "<<maxY[2]<<") "<< abs(maxX[2]-minX[2])*abs(maxY[2]-minY[2])<<endl;
cout << "Q4: ("<<minX[3]<<", "<<minY[3]<<") ("<<maxX[3]<<", "<<maxY[3]<<") "<< abs(maxX[3]-minX[3])*abs(maxY[3]-minY[3])<<endl;
} | # 2071905, 2024-11-02 15:26:28, ---------- (0%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
int x,y;
vector<pair<int,int>> coordinate,Q1,Q2,Q3,Q4;
for(int i=0;i<n;i++){
cin>>x>>y;
if(x>0&&y>0)Q1.push_back({x,y});
if(x<0&&y>0)Q2.push_back({x,y});
if(x<0&&y<0)Q3.push_back({x,y});
if(x>0&&y<0)Q4.push_back({x,y});
}
int minX[]={6500,6500,6500,6500},maxX[]={0,0,0,0},minY[]={6500,6500,6500,6500},maxY[]={0,0,0,0};
for(auto p:Q1){
if(p.first < minX[0]) minX[0]=p.first;
if(p.first > maxX[0]) maxX[0]=p.first;
if(p.second < minY[0]) minY[0]=p.second;
if(p.second < maxY[0]) maxY[0]=p.second;
}
for(auto p:Q2){
if(p.first < minX[1]) minX[1]=p.first;
if(p.first > maxX[1]) maxX[1]=p.first;
if(p.second < minY[1]) minY[1]=p.second;
if(p.second < maxY[1]) maxY[1]=p.second;
}
for(auto p:Q3){
if(p.first < minX[2]) minX[2]=p.first;
if(p.first > maxX[2]) maxX[2]=p.first;
if(p.second < minY[2]) minY[2]=p.second;
if(p.second < maxY[2]) maxY[2]=p.second;
}
for(auto p:Q4){
if(p.first < minX[3]) minX[3]=p.first;
if(p.first > maxX[3]) maxX[3]=p.first;
if(p.second < minY[3]) minY[3]=p.second;
if(p.second < maxY[3]) maxY[3]=p.second;
}
cout << "Q1: ("<<minX[0]<<", "<<minY[0]<<") ("<<maxX[0]<<", "<<maxY[0]<<") "<< abs(maxX[0]-minX[0])*abs(maxY[0]-minY[0])<<endl;
cout << "Q2: ("<<minX[1]<<", "<<minY[1]<<") ("<<maxX[1]<<", "<<maxY[1]<<") "<< abs(maxX[1]-minX[1])*abs(maxY[1]-minY[1])<<endl;
cout << "Q3: ("<<minX[2]<<", "<<minY[2]<<") ("<<maxX[2]<<", "<<maxY[2]<<") "<< abs(maxX[2]-minX[2])*abs(maxY[2]-minY[2])<<endl;
cout << "Q4: ("<<minX[3]<<", "<<minY[3]<<") ("<<maxX[3]<<", "<<maxY[3]<<") "<< abs(maxX[3]-minX[3])*abs(maxY[3]-minY[3])<<endl;
} | # 2071959, 2024-11-02 15:30:03, ---------- (0%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
int x,y;
vector<pair<int,int>> coordinate,Q1,Q2,Q3,Q4;
for(int i=0;i<n;i++){
cin>>x>>y;
if(x>0&&y>0)Q1.push_back({x,y});
if(x<0&&y>0)Q2.push_back({x,y});
if(x<0&&y<0)Q3.push_back({x,y});
if(x>0&&y<0)Q4.push_back({x,y});
}
int minX[]={6500,6500,6500,6500},maxX[]={0,0,0,0},minY[]={6500,6500,6500,6500},maxY[]={0,0,0,0};
for(auto p:Q1){
if(p.first < minX[0]) minX[0]=p.first;
if(p.first > maxX[0]) maxX[0]=p.first;
if(p.second < minY[0]) minY[0]=p.second;
if(p.second > maxY[0]) maxY[0]=p.second;
}
for(auto p:Q2){
if(p.first < minX[1]) minX[1]=p.first;
if(p.first > maxX[1]) maxX[1]=p.first;
if(p.second < minY[1]) minY[1]=p.second;
if(p.second > maxY[1]) maxY[1]=p.second;
}
for(auto p:Q3){
if(p.first < minX[2]) minX[2]=p.first;
if(p.first > maxX[2]) maxX[2]=p.first;
if(p.second < minY[2]) minY[2]=p.second;
if(p.second > maxY[2]) maxY[2]=p.second;
}
for(auto p:Q4){
if(p.first < minX[3]) minX[3]=p.first;
if(p.first > maxX[3]) maxX[3]=p.first;
if(p.second < minY[3]) minY[3]=p.second;
if(p.second > maxY[3]) maxY[3]=p.second;
}
cout << "Q1: ("<<minX[0]<<", "<<minY[0]<<") ("<<maxX[0]<<", "<<maxY[0]<<") "<< abs(maxX[0]-minX[0])*abs(maxY[0]-minY[0])<<endl;
cout << "Q2: ("<<minX[1]<<", "<<minY[1]<<") ("<<maxX[1]<<", "<<maxY[1]<<") "<< abs(maxX[1]-minX[1])*abs(maxY[1]-minY[1])<<endl;
cout << "Q3: ("<<minX[2]<<", "<<minY[2]<<") ("<<maxX[2]<<", "<<maxY[2]<<") "<< abs(maxX[2]-minX[2])*abs(maxY[2]-minY[2])<<endl;
cout << "Q4: ("<<minX[3]<<", "<<minY[3]<<") ("<<maxX[3]<<", "<<maxY[3]<<") "<< abs(maxX[3]-minX[3])*abs(maxY[3]-minY[3])<<endl;
} |
# 2071722, 2024-11-02 15:08:16, ---------- (0%)
#include<iostream>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<tuple>
#include<utility>
#include<algorithm>
using namespace std;
int main(){
int n,x,y;
vector<int> Qx;vector<int> Qy;
vector<int> Q1,Q2,Q3,Q4;
cin >> n;
while(n--){
cin >> x;
Qx.push_back(x);
cin >> y;
Qy.push_back(y);
}
sort(Qx.begin(),Qx.end());
sort(Qy.begin(),Qy.end());
for(auto c:Qx){
for(auto j:Qy){
for(int i=0 ; i<c ;i++){
if(c != -j && c != -j){
cout << "Q1: " << "(" << c-i << "," << j-i <<")" << " " << "(" << c+i << "," << j+i <<")" << " " << ((c-i) - (c+i) + (j-i) - (j+i));
}
else {cout << "No point in any quadrant";}
}
}
}
} | # 2071758, 2024-11-02 15:12:58, Compilation error (0%)
#include<iostream>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<tuple>
#include<utility>
#include<algorithm>
using namespace std;
int main(){
int n,x,y;
vector<int> Qx;vector<int> Qy;
vector<int> Q1,Q2,Q3,Q4;
cin >> n;
while(n--){
cin >> x;
Qx.push_back(x);
cin >> y;
Qy.push_back(y);
}
sort(Qx.begin(),Qx.end());
sort(Qy.begin(),Qy.end());
for(auto c:Qx){
for(auto j:Qy){
if(c != -j && c != -j){
cout << "Q1: " << "(" << c << "," << j-i <<")" << " " << "(" << c+i << "," << j+i <<")" << " " << abs(((c-i) - (c+i) + (j-i) - (j+i)));
}
else {cout << "No point in any quadrant";}
}
}
} | # 2071765, 2024-11-02 15:13:35, xxxxxxxxxx (0%)
#include<iostream>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<tuple>
#include<utility>
#include<algorithm>
using namespace std;
int main(){
int n,x,y;
vector<int> Qx;vector<int> Qy;
vector<int> Q1,Q2,Q3,Q4;
cin >> n;
while(n--){
cin >> x;
Qx.push_back(x);
cin >> y;
Qy.push_back(y);
}
sort(Qx.begin(),Qx.end());
sort(Qy.end(),Qy.begin());
for(auto c:Qx){
for(auto j:Qy){
if(c != -j && c != -j){
cout << "Q1: " << "(" << c << "," << j <<")" << " " << "(" << c << "," << j <<")" << " " << abs(((c) - (c) + (j) - (j)));
}
else {cout << "No point in any quadrant";}
}
}
} | # 2071894, 2024-11-02 15:25:36, ---------- (0%)
#include<iostream>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<tuple>
#include<utility>
#include<algorithm>
using namespace std;
int main(){
int n,x,y;
vector<int> Qx;vector<int> Qy;
vector<int> Q1,Q2,Q3,Q4;
cin >> n;
while(n--){
cin >> x;
Qx.push_back(x);
cin >> y;
Qy.push_back(y);
}
sort(Qx.begin(),Qx.end());
sort(Qy.begin(),Qy.end());
for(auto c:Qx){
for(auto j:Qy){
if(c != -j && c != -j){
cout << "Q1: " << "(" << Qx[c-2] << "," << Qy[j-2] <<")" << " " << "(" << Qx[c] << "," << Qy[j] <<")" << " " << abs(((Qx[c-2]) - (Qx[c])) * ((Qy[j-2]) - (Qy[j]))) << endl;
break;
}
else {cout << "No point in any quadrant";}
}
}
} |
# 2071173, 2024-11-02 14:04:08, Compilation error (0%)
#include <bits/stdc++.h>
#include <iostream>
#include <map>
#include <set>
#include <unordered_set>
using namespace std;
int main(){
int x;
std:: cin >> x;
int n = 0;
std :: vector<int> seq;
int temp;
while (std :: cin >> temp){
seq.push_back(temp);
}
std:: unordered_set <int> seq_set(seq.begin(), seq.ed())
for(int i : seq){
if (seq_set.find(x-i) != seq_set.end()) {
n++;
}
}
std::cout << n/2 <, std::endl;
return 0;
} | # 2071885, 2024-11-02 15:24:58, Compilation error (0%)
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
using namespace std;
int main () {
int N;
cin >> N
int x.y;
cin >> x >> y;
map<set<vector<int,int>>>
} | # 2072014, 2024-11-02 15:32:29, Compilation error (0%)
#include <bits/stdc++.h>
#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
int main(){
multiset <char> s1;
multiset <char> s2;
string input1;
string input2;
getline(cin,input1);
getline(cin,input2);
for(char c: input1){
if(isalpha(c))
s1.insert(tolower(c));
}
for(char c: input2){
if(isalpha(c))
s2.insert(tolower(c));
}
if(s1==s2){
cout << "Yes";
}else{
cout << "No"
} |
# 2071029, 2024-11-02 13:47:23, Compilation error (0%)
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
using namespace std;
int main(){
int n;
int x,y;
cin >> n;
bool nopoint = false;
vector<pair<int,int>>data;
while(n--){
cin >> x >> y;
data.push_back(make_pair(x,y));
}
sort(data.begin(),data.end());
vector<pair<int,int>>Q1;
vector<pair<int,int>>Q2;
vector<pair<int,int>>Q3;
vector<pair<int,int>>Q4;
for(auto & p:data){
if((p.first > 0)&&(p.second > 0)){
Q1.push_back(make_pair(x,y));
}
if((p.first < 0)&&(p.second >0)){
Q2.push_back(make_pair(x,y));
}
if((p.first < 0)&&(p.second <0)){
Q3.push_back(make_pair(x,y));
}
if((p.first > 0)&&(p.second < 0)){
Q4.push_back(make_pair(x,y));
}
// }
// for(int itr=0; itr<Q1.size() ; ++itr){
// vector<pair<int,int>>mini = mini.push_back(make_pair(*itr,));
// vector<pair<int,int>>maxi =
// }
// cout << "Q1:" << "(" << << max << area << endl;
// cout << "Q2:" << "(" << << max << area << endl;
// cout << "Q3:" << "(" << << max << area << endl;
// cout << "Q4:" << "(" << << max << area << endl;
if(!nopoint){
cout << "No point in any quadrant" << endl;
}
} | # 2071034, 2024-11-02 13:47:50, ---------- (0%)
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
using namespace std;
int main(){
int n;
int x,y;
cin >> n;
bool nopoint = false;
vector<pair<int,int>>data;
while(n--){
cin >> x >> y;
data.push_back(make_pair(x,y));
}
sort(data.begin(),data.end());
vector<pair<int,int>>Q1;
vector<pair<int,int>>Q2;
vector<pair<int,int>>Q3;
vector<pair<int,int>>Q4;
for(auto & p:data){
if((p.first > 0)&&(p.second > 0)){
Q1.push_back(make_pair(x,y));
}
if((p.first < 0)&&(p.second >0)){
Q2.push_back(make_pair(x,y));
}
if((p.first < 0)&&(p.second <0)){
Q3.push_back(make_pair(x,y));
}
if((p.first > 0)&&(p.second < 0)){
Q4.push_back(make_pair(x,y));
}
// }
// for(int itr=0; itr<Q1.size() ; ++itr){
// vector<pair<int,int>>mini = mini.push_back(make_pair(*itr,));
// vector<pair<int,int>>maxi =
// }
// cout << "Q1:" << "(" << << max << area << endl;
// cout << "Q2:" << "(" << << max << area << endl;
// cout << "Q3:" << "(" << << max << area << endl;
// cout << "Q4:" << "(" << << max << area << endl;
if(!nopoint){
cout << "No point in any quadrant" << endl;
}
}
} | # 2071048, 2024-11-02 13:48:46, ---------- (0%)
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
using namespace std;
int main(){
int n;
int x,y;
cin >> n;
bool nopoint = false;
vector<pair<int,int>>data;
while(n--){
cin >> x >> y;
data.push_back(make_pair(x,y));
}
sort(data.begin(),data.end());
vector<pair<int,int>>Q1;
vector<pair<int,int>>Q2;
vector<pair<int,int>>Q3;
vector<pair<int,int>>Q4;
for(auto & p:data){
if((p.first > 0)&&(p.second > 0)){
Q1.push_back(make_pair(x,y));
}
if((p.first < 0)&&(p.second >0)){
Q2.push_back(make_pair(x,y));
}
if((p.first < 0)&&(p.second <0)){
Q3.push_back(make_pair(x,y));
}
if((p.first > 0)&&(p.second < 0)){
Q4.push_back(make_pair(x,y));
}
// }
// for(int itr=0; itr<Q1.size() ; ++itr){
// vector<pair<int,int>>mini = mini.push_back(make_pair(*itr,));
// vector<pair<int,int>>maxi =
// }
// cout << "Q1:" << "(" << << max << area << endl;
// cout << "Q2:" << "(" << << max << area << endl;
// cout << "Q3:" << "(" << << max << area << endl;
// cout << "Q4:" << "(" << << max << area << endl;
cout << "No point in any quadrant" << endl;
}
} |
# 2071942, 2024-11-02 15:29:20, ---------- (0%)
#include<iostream>
#include<cmath>
#include<vector>
#include<tuple>
#include<climits>
using namespace std;
int main () {
int n;
cin >> n;
pair<int, int> q1;
pair<int, int> q2;
pair<int, int> q3;
pair<int, int> q4;
for(int i = 0; i<n; i++) {
int a, b;
cin >> a >> b;
if(a>0 && b>0) {
q1.first = a;
q1.second = b;
} else if (a<0 && b>0) {
q2.first =a;
q2.second = b;
} else if (a<0 && b<0) {
q3.first = a;
q3.second = b;
} else if (a>0 && b<0) {
q4.first = a;
q4.second = b;
}
}
int min1, min2, min3, min4, min5, min6, min7, min8 = INT_MAX;
int max1, max2, max3, max4, max5, max6, max7, max8 = INT_MIN;
for(int i = 0; i<n; i++) {
min1 = min(min1, q1.first);
min2 = min(min2, q1.second);
min3 = min(min3, q2.first);
min4 = min(min4, q2.second);
min5 = min(min5, q3.first);
min6 = min(min6, q3.second);
min7 = min(min7, q4.first);
min8 = min(min8, q4.second);
max1 = max(max1, q1.first);
max2 = max(max2, q1.second);
max3 = max(max3, q2.first);
max4 = max(max4, q2.second);
max5 = max(max5, q3.first);
max6 = max(max6, q3.second);
max7 = max(max7, q4.first);
max8 = max(max8, q4.second);
}
cout << "Q1:" << " " <<"(" << min1 <<", " << min2 <<")" << " " << "(" << max1 <<", " << max2 <<")" << " " << (max1-min1)*(max2-min2) << endl;
cout << "Q2:" << " " <<"(" << min3 <<", " << min4 <<")" << " " << "(" << max3 <<", " << max4 <<")" << " " << (max3-min3)*(max4-min4) << endl;
cout << "Q3:" << " " <<"(" << min5 <<", " << min6 <<")" << " " << "(" << max5 <<", " << max6 <<")" << " " << (max5-min5)*(max6-min6) << endl;
cout << "Q4:" << " " <<"(" << min7 <<", " << min8 <<")" << " " << "(" << max7 <<", " << max8 <<")" << " " << (max7-min7)*(max8-min8) << endl;
} | # 2071946, 2024-11-02 15:29:32, ---------- (0%)
#include<iostream>
#include<cmath>
#include<vector>
#include<tuple>
#include<climits>
using namespace std;
int main () {
int n;
cin >> n;
pair<int, int> q1;
pair<int, int> q2;
pair<int, int> q3;
pair<int, int> q4;
for(int i = 0; i<n; i++) {
int a, b;
cin >> a >> b;
if(a>0 && b>0) {
q1.first = a;
q1.second = b;
} else if (a<0 && b>0) {
q2.first =a;
q2.second = b;
} else if (a<0 && b<0) {
q3.first = a;
q3.second = b;
} else if (a>0 && b<0) {
q4.first = a;
q4.second = b;
}
}
int min1, min2, min3, min4, min5, min6, min7, min8 = 0;
int max1, max2, max3, max4, max5, max6, max7, max8 = 0;
for(int i = 0; i<n; i++) {
min1 = min(min1, q1.first);
min2 = min(min2, q1.second);
min3 = min(min3, q2.first);
min4 = min(min4, q2.second);
min5 = min(min5, q3.first);
min6 = min(min6, q3.second);
min7 = min(min7, q4.first);
min8 = min(min8, q4.second);
max1 = max(max1, q1.first);
max2 = max(max2, q1.second);
max3 = max(max3, q2.first);
max4 = max(max4, q2.second);
max5 = max(max5, q3.first);
max6 = max(max6, q3.second);
max7 = max(max7, q4.first);
max8 = max(max8, q4.second);
}
cout << "Q1:" << " " <<"(" << min1 <<", " << min2 <<")" << " " << "(" << max1 <<", " << max2 <<")" << " " << (max1-min1)*(max2-min2) << endl;
cout << "Q2:" << " " <<"(" << min3 <<", " << min4 <<")" << " " << "(" << max3 <<", " << max4 <<")" << " " << (max3-min3)*(max4-min4) << endl;
cout << "Q3:" << " " <<"(" << min5 <<", " << min6 <<")" << " " << "(" << max5 <<", " << max6 <<")" << " " << (max5-min5)*(max6-min6) << endl;
cout << "Q4:" << " " <<"(" << min7 <<", " << min8 <<")" << " " << "(" << max7 <<", " << max8 <<")" << " " << (max7-min7)*(max8-min8) << endl;
} |
# 2071516, 2024-11-02 14:44:02, xxxxxxxxxx (0%)
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
map<int, vector<int>> m;
vector<pair<int, int>> vp (n);
vector<int> Minx(4, 1000000), Miny(4, 1000000), Maxx(4, -1000000), Maxy(4, -1000000);
while (n--)
{
int a, b;
cin >> a >> b;
vp.push_back({a, b});
}
//cout << "-------" << endl;
for (auto &pair : vp)
{
int a = pair.first;
int b = pair.second;
int x = 0;
if (a > 0 && b > 0)
{
x = 1;
}
else if (a < 0 && b > 0)
{
x = 2;
}
else if (a < 0 && b < 0)
{
x = 3;
}
else if (a > 0 && b < 0)
{
x = 4;
}
Minx[x] = min(Minx[x], a);
Miny[x] = min(Miny[x], b);
Maxx[x] = max(Maxx[x], a);
Maxy[x] = max(Maxy[x], b);
m[x][0] = Minx[x];
m[x][1] = Miny[x];
m[x][2] = Maxx[x];
m[x][3] = Maxy[x];
}
// cout << m[1][3] << endl;
if (m.empty())
{
cout << "No point in any quadrant" << endl;
}
for (auto e : m)
{
if (e.first == 1)
{
cout << "Q1: (";
}
else if (e.first == 2)
{
cout << "Q2: (";
}
else if (e.first == 3)
{
cout << "Q3: (";
}
else if (e.first == 4)
{
cout << "Q4: (";
}
cout << e.second[0] << ", " << e.second[1] << ") (" << e.second[2] << ", " << e.second[3] << ") " << (e.second[2] - e.second[0]) * (e.second[3] - e.second[1]) << endl;
}
} |
# 2070029, 2024-11-02 11:45:42, ---------- (0%)
#include <iostream>
#include <cmath>
#include <vector>
using namespace std;
int main(){
int a,b,Q1=2,Q2=3,Q3,Q4;
cin >> a;
cin >> b;
cout<<Q1<<Q2<<endl;
} |
# 2070324, 2024-11-02 12:03:34, ---------- (0%)
#include<iostream>
#include<vector>
using namespace std;
int main(){
int n;
cin >> n;
vector<int> x;
vector<int> y;
for(int i=0;i<n;i++){
int xx,yy;
cin >> xx >> yy;
x.push_back(xx);
y.push_back(yy);
}
cout << "comprogveryhard";
cout << "dataalgoveryveryhard";
cout << "how to pass exam comprog?";
cout << "pom jacry ";
} |
# 2072003, 2024-11-02 15:31:53, ---------- (0%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n; cin >> n;
int x,y;
vector<pair<int,int>> v;
map<int,int> m;
while (n--)
{
cin >> x >> y;
v.push_back({x,y});
}
cout << "Q1: ";
sort(v.begin(),v.end());
for (auto e : v){
if(e.first > 0 && e.second > 0 && e.first != 0 && e.second != 0){
cout << "(" <<e.first << ", " << e.second << ")" ;
}
}
cout << "Q2: "<< endl;
for(auto w:v){
if(w.first < 0 && w.second > 0 && w.first != 0 && w.second != 0){
cout << "(" <<w.first << ", " << w.second << ")" ;
}
}cout << "Q3: "<<endl;
for(auto q:v){
if(q.first < 0 && q.second > 0 && q.first != 0 && q.second != 0){
cout << "(" <<q.first << ", " << q.second << ")" ;
}
}cout << "Q4: "<<endl;
for(auto s:v){
if(s.first > 0 && s.second < 0 && s.first != 0 && s.second != 0){
cout << "(" <<s.first << ", " << s.second << ")" ;
}
}
} |