|
|
вернуться в форумwhat is my problem on c++? (Wa2) this is my code: #include <iostream> #include <vector> #include <algorithm> #include <cmath> using namespace std; int main() { vector <int> A; vector <int> B; int a,b,n; cin>>n; for(int i=0; i<n; i++) { cin>>a>>b; A.push_back(a); B.push_back(b); } sort(A.begin(),A.end()); sort(B.begin(),B.end()); a=1; b=a; for(int i=1; i<n; i++) { if(A[i]!=A[i-1]) a++; if(B[i]!=B[i-1]) b++; } cout<<min(a,b); system("pause"); return 0; } Re: what is my problem on c++? (Wa2) Test --- 3 1 10 2 11 3 12 --- Your answer is 3, expected is 1 |
|
|