제출 #1027973

#제출 시각아이디문제언어결과실행 시간메모리
1027973AbitoPortal (BOI24_portal)C++17
1 / 100
21 ms1884 KiB
#include <bits/stdc++.h> #define F first #define S second #define pb push_back #define ppb pop_back #define ep insert #define endl '\n' #define elif else if #define pow pwr #define sqrt sqrtt #define int long long #define ll long long #define y1 YONE typedef unsigned long long ull; using namespace std; const int N=1e5+5; int x[N],y[N],n; map<int,vector<int>> mpx,mpy; int32_t main(){ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); cin>>n; for (int i=1;i<=n;i++) cin>>x[i]>>y[i]; if (n<=2){ cout<<-1<<endl; return 0; } sort(x+1,x+1+n); sort(y+1,y+1+n); //for (int i=1;i<=n;i++) cout<<x[i]<<' '<< if (x[1]==x[n] || y[1]==y[n]){ cout<<-1<<endl; return 0; } int x1=x[1],x2,y1=y[1],y2; for (int i=2;i<=n;i++){ if (x[i]==x1) continue; x2=x[i]; break; } for (int i=2;i<=n;i++){ if (y[i]==y1) continue; y2=y[i]; break; } cout<<(x2-x1)*(y2-y1)<<endl; /*if (x[1]==x[2] && x[1]==x[3]){ cout<<-1<<endl; return 0; } if (y[1]==y[2] && y[1]==y[3]){ cout<<-1<<endl; return 0; } if (x[1]!=x[2] && x[1]!=x[3] && x[2]!=x[3] && y[1]!=y[2] && y[1]!=y[3] && y[2]!=y[3]){ cout<<-1<<endl; return 0; } sort(x+1,x+1+n); sort(y+1,y+1+n); int X=x[3]-x[1]+1,Y=y[3]-y[1]+1; cout<<X*Y-X-Y+1<<endl;*/ return 0; }

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

Main.cpp: In function 'int32_t main()':
Main.cpp:45:14: warning: 'x2' may be used uninitialized in this function [-Wmaybe-uninitialized]
   45 |     cout<<(x2-x1)*(y2-y1)<<endl;
      |           ~~~^~~~
Main.cpp:45:22: warning: 'y2' may be used uninitialized in this function [-Wmaybe-uninitialized]
   45 |     cout<<(x2-x1)*(y2-y1)<<endl;
      |                   ~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...