Submission
Status:
[PPPPPPPPPP-SSSS]
Subtask/Task Score:
{0/100}
Score: 0
User: theem1502
Problemset: forex
Language: cpp
Time: 0.003 second
Submitted On: 2026-02-17 17:52:30
#include <bits/stdc++.h>
using namespace std;
int main() {
int num;
cin >> num;
vector<vector<double>> thearray(num, vector<double> (num));
for (int i = 0; i < num; i++) {
for (int j = 0; j < num; j++) {
cin >> thearray[i][j];
}
}
int leastsequence = 1e9;
int thei = 0;
for (int i = 0; i < num; i++) {
for (int j = 0; j <num; j++) {
if (thearray[i][j] * thearray[j][i] > 1.0) {
// cout << "yes" << i << " " << j << "\n";
double change = thearray[i][j] * thearray[j][i];
// cout << "change = " << change << "\n";
int thes = 2;
while(change <= 1.01 ) {
change *= thearray[i][j] * thearray[j][i];
thes += 2;
}
if (thes < leastsequence) {
leastsequence = thes;
thei = i;
}
}
}
}
if (leastsequence == 1e9) {
cout << -1;
return 0;
}
cout << thei+1 << " " << leastsequence;
}