Day 9 submission
This commit is contained in:
parent
533aae2f1c
commit
dfcc3b4f76
|
@ -1,20 +1,20 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
int i1, i2, count=0;
|
int i1, i2, count=0;
|
||||||
|
|
||||||
cin >> i1;
|
cin >> i1;
|
||||||
|
|
||||||
while(cin >> i2)
|
while(cin >> i2)
|
||||||
{
|
{
|
||||||
if (i2 > i1) count++;
|
if (i2 > i1) count++;
|
||||||
i1 = i2;
|
i1 = i2;
|
||||||
}
|
}
|
||||||
|
|
||||||
cout << count << endl;
|
cout << count << endl;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
|
@ -1,22 +1,22 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
int i1, i2, i3, i4, count=0;
|
int i1, i2, i3, i4, count=0;
|
||||||
|
|
||||||
cin >> i1 >> i2 >> i3;
|
cin >> i1 >> i2 >> i3;
|
||||||
|
|
||||||
while(cin >> i4)
|
while(cin >> i4)
|
||||||
{
|
{
|
||||||
if (i2+i3+i4 > i1+i2+i3) count++;
|
if (i2+i3+i4 > i1+i2+i3) count++;
|
||||||
i1 = i2;
|
i1 = i2;
|
||||||
i2 = i3;
|
i2 = i3;
|
||||||
i3 = i4;
|
i3 = i4;
|
||||||
}
|
}
|
||||||
|
|
||||||
cout << count << endl;
|
cout << count << endl;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
|
@ -1,36 +1,36 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
string input;
|
string input;
|
||||||
const string forward = "forward";
|
const string forward = "forward";
|
||||||
const string up = "up";
|
const string up = "up";
|
||||||
const string down = "down";
|
const string down = "down";
|
||||||
int horizontal = 0;
|
int horizontal = 0;
|
||||||
int depth = 0;
|
int depth = 0;
|
||||||
|
|
||||||
while(getline(cin,input))
|
while(getline(cin,input))
|
||||||
{
|
{
|
||||||
int amount = atoi(&input.c_str()[input.find(' ')]);;
|
int amount = atoi(&input.c_str()[input.find(' ')]);;
|
||||||
|
|
||||||
if (string::npos != input.find(forward))
|
if (string::npos != input.find(forward))
|
||||||
{
|
{
|
||||||
horizontal += amount;
|
horizontal += amount;
|
||||||
}
|
}
|
||||||
else if (string::npos != input.find(up))
|
else if (string::npos != input.find(up))
|
||||||
{
|
{
|
||||||
depth -= amount;
|
depth -= amount;
|
||||||
}
|
}
|
||||||
else if (string::npos != input.find(down))
|
else if (string::npos != input.find(down))
|
||||||
{
|
{
|
||||||
depth += amount;
|
depth += amount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cout << horizontal*depth << endl;
|
cout << horizontal*depth << endl;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,38 +1,38 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
string input;
|
string input;
|
||||||
const string forward = "forward";
|
const string forward = "forward";
|
||||||
const string up = "up";
|
const string up = "up";
|
||||||
const string down = "down";
|
const string down = "down";
|
||||||
int horizontal = 0;
|
int horizontal = 0;
|
||||||
int depth = 0;
|
int depth = 0;
|
||||||
int aim = 0;
|
int aim = 0;
|
||||||
|
|
||||||
while(getline(cin,input))
|
while(getline(cin,input))
|
||||||
{
|
{
|
||||||
int amount = atoi(&input.c_str()[input.find(' ')]);;
|
int amount = atoi(&input.c_str()[input.find(' ')]);;
|
||||||
|
|
||||||
if (string::npos != input.find(forward))
|
if (string::npos != input.find(forward))
|
||||||
{
|
{
|
||||||
horizontal += amount;
|
horizontal += amount;
|
||||||
depth += amount*aim;
|
depth += amount*aim;
|
||||||
}
|
}
|
||||||
else if (string::npos != input.find(up))
|
else if (string::npos != input.find(up))
|
||||||
{
|
{
|
||||||
aim -= amount;
|
aim -= amount;
|
||||||
}
|
}
|
||||||
else if (string::npos != input.find(down))
|
else if (string::npos != input.find(down))
|
||||||
{
|
{
|
||||||
aim += amount;
|
aim += amount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cout << horizontal*depth << endl;
|
cout << horizontal*depth << endl;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,57 +1,57 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
vector<string> m_in, l_in;
|
vector<string> m_in, l_in;
|
||||||
string in_str;
|
string in_str;
|
||||||
|
|
||||||
while(cin >> in_str) m_in.push_back(in_str);
|
while(cin >> in_str) m_in.push_back(in_str);
|
||||||
|
|
||||||
l_in = vector<string>(m_in);
|
l_in = vector<string>(m_in);
|
||||||
|
|
||||||
int m_c, l_c;
|
int m_c, l_c;
|
||||||
|
|
||||||
for(int i = 0; i < m_in[0].size() && m_in.size() > 1; i++)
|
for(int i = 0; i < m_in[0].size() && m_in.size() > 1; i++)
|
||||||
{
|
{
|
||||||
m_c = 0;
|
m_c = 0;
|
||||||
for(int j = 0; j < m_in.size(); j++)
|
for(int j = 0; j < m_in.size(); j++)
|
||||||
{
|
{
|
||||||
m_c += (m_in[j][i] == '1')?1:-1;
|
m_c += (m_in[j][i] == '1')?1:-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int j = 0; j < m_in.size() && m_in.size() > 1; j++)
|
for(int j = 0; j < m_in.size() && m_in.size() > 1; j++)
|
||||||
{
|
{
|
||||||
if (((m_c>=0)?'0':'1')==m_in[j][i])
|
if (((m_c>=0)?'0':'1')==m_in[j][i])
|
||||||
{
|
{
|
||||||
m_in.erase(m_in.begin()+j);
|
m_in.erase(m_in.begin()+j);
|
||||||
j--;
|
j--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i = 0; i < l_in[0].size() && l_in.size() > 1; i++)
|
for(int i = 0; i < l_in[0].size() && l_in.size() > 1; i++)
|
||||||
{
|
{
|
||||||
l_c = 0;
|
l_c = 0;
|
||||||
for(int j = 0; j < l_in.size(); j++)
|
for(int j = 0; j < l_in.size(); j++)
|
||||||
{
|
{
|
||||||
l_c += (l_in[j][i] == '1')?1:-1;
|
l_c += (l_in[j][i] == '1')?1:-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int j = 0; j < l_in.size() && l_in.size() > 1; j++)
|
for(int j = 0; j < l_in.size() && l_in.size() > 1; j++)
|
||||||
{
|
{
|
||||||
if (((l_c>=0)?'1':'0')==l_in[j][i])
|
if (((l_c>=0)?'1':'0')==l_in[j][i])
|
||||||
{
|
{
|
||||||
l_in.erase(l_in.begin()+j);
|
l_in.erase(l_in.begin()+j);
|
||||||
j--;
|
j--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cout << stoi(m_in[0],nullptr,2)*stoi(l_in[0],nullptr,2) << endl;
|
cout << stoi(m_in[0],nullptr,2)*stoi(l_in[0],nullptr,2) << endl;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,59 +1,59 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
struct Line
|
struct Line
|
||||||
{
|
{
|
||||||
int x1,y1,x2,y2;
|
int x1,y1,x2,y2;
|
||||||
|
|
||||||
friend istream &operator>>( istream &input, Line &l ) {
|
friend istream &operator>>( istream &input, Line &l ) {
|
||||||
input >> l.x1 >> l.y1 >> l.x2 >> l.y2;
|
input >> l.x1 >> l.y1 >> l.x2 >> l.y2;
|
||||||
return input;
|
return input;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
inline constexpr int num_lines{500};
|
inline constexpr int num_lines{500};
|
||||||
inline constexpr int grid_size{1000};
|
inline constexpr int grid_size{1000};
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
int grid[grid_size*grid_size] = {0};
|
int grid[grid_size*grid_size] = {0};
|
||||||
Line line;
|
Line line;
|
||||||
set<int> dangerous_locations;
|
set<int> dangerous_locations;
|
||||||
|
|
||||||
for(int i = 0; i < num_lines; i++)
|
for(int i = 0; i < num_lines; i++)
|
||||||
{
|
{
|
||||||
cin >> line;
|
cin >> line;
|
||||||
|
|
||||||
if (line.x1 == line.x2)
|
if (line.x1 == line.x2)
|
||||||
{
|
{
|
||||||
for(int y = min(line.y1, line.y2); y <= max(line.y1, line.y2); y++)
|
for(int y = min(line.y1, line.y2); y <= max(line.y1, line.y2); y++)
|
||||||
{
|
{
|
||||||
grid[line.x1 + grid_size*y]++;
|
grid[line.x1 + grid_size*y]++;
|
||||||
|
|
||||||
if (grid[line.x1+y*grid_size] >= 2)
|
if (grid[line.x1+y*grid_size] >= 2)
|
||||||
{
|
{
|
||||||
dangerous_locations.insert(line.x1+y*grid_size);
|
dangerous_locations.insert(line.x1+y*grid_size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (line.y1 == line.y2)
|
else if (line.y1 == line.y2)
|
||||||
{
|
{
|
||||||
for(int x = min(line.x1, line.x2); x <= max(line.x1, line.x2); x++)
|
for(int x = min(line.x1, line.x2); x <= max(line.x1, line.x2); x++)
|
||||||
{
|
{
|
||||||
grid[x + line.y1*grid_size]++;
|
grid[x + line.y1*grid_size]++;
|
||||||
|
|
||||||
if (grid[x+line.y1*grid_size] >= 2)
|
if (grid[x+line.y1*grid_size] >= 2)
|
||||||
{
|
{
|
||||||
dangerous_locations.insert(x+line.y1*grid_size);
|
dangerous_locations.insert(x+line.y1*grid_size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cout << dangerous_locations.size() << endl;
|
cout << dangerous_locations.size() << endl;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,86 +1,86 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
struct Line
|
struct Line
|
||||||
{
|
{
|
||||||
int x1,y1,x2,y2;
|
int x1,y1,x2,y2;
|
||||||
|
|
||||||
friend istream &operator>>( istream &input, Line &l ) {
|
friend istream &operator>>( istream &input, Line &l ) {
|
||||||
input >> l.x1 >> l.y1 >> l.x2 >> l.y2;
|
input >> l.x1 >> l.y1 >> l.x2 >> l.y2;
|
||||||
return input;
|
return input;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
inline constexpr int num_lines{500};
|
inline constexpr int num_lines{500};
|
||||||
inline constexpr int grid_size{1000};
|
inline constexpr int grid_size{1000};
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
int grid[grid_size*grid_size] = {0};
|
int grid[grid_size*grid_size] = {0};
|
||||||
Line line;
|
Line line;
|
||||||
set<int> dangerous_locations;
|
set<int> dangerous_locations;
|
||||||
|
|
||||||
for(int i = 0; i < num_lines; i++)
|
for(int i = 0; i < num_lines; i++)
|
||||||
{
|
{
|
||||||
cin >> line;
|
cin >> line;
|
||||||
|
|
||||||
if (line.x1 == line.x2)
|
if (line.x1 == line.x2)
|
||||||
{
|
{
|
||||||
for(int y = min(line.y1, line.y2); y <= max(line.y1, line.y2); y++)
|
for(int y = min(line.y1, line.y2); y <= max(line.y1, line.y2); y++)
|
||||||
{
|
{
|
||||||
grid[line.x1 + grid_size*y]++;
|
grid[line.x1 + grid_size*y]++;
|
||||||
|
|
||||||
if (grid[line.x1+y*grid_size] >= 2)
|
if (grid[line.x1+y*grid_size] >= 2)
|
||||||
{
|
{
|
||||||
dangerous_locations.insert(line.x1+y*grid_size);
|
dangerous_locations.insert(line.x1+y*grid_size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (line.y1 == line.y2)
|
else if (line.y1 == line.y2)
|
||||||
{
|
{
|
||||||
for(int x = min(line.x1, line.x2); x <= max(line.x1, line.x2); x++)
|
for(int x = min(line.x1, line.x2); x <= max(line.x1, line.x2); x++)
|
||||||
{
|
{
|
||||||
grid[x + line.y1*grid_size]++;
|
grid[x + line.y1*grid_size]++;
|
||||||
|
|
||||||
if (grid[x+line.y1*grid_size] >= 2)
|
if (grid[x+line.y1*grid_size] >= 2)
|
||||||
{
|
{
|
||||||
dangerous_locations.insert(x+line.y1*grid_size);
|
dangerous_locations.insert(x+line.y1*grid_size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((line.y2-line.y1)/(line.x2-line.x1) > 0)
|
if ((line.y2-line.y1)/(line.x2-line.x1) > 0)
|
||||||
{
|
{
|
||||||
for(int x = min(line.x1, line.x2), y = min(line.y1, line.y2); x <= max(line.x1, line.x2); x++, y++)
|
for(int x = min(line.x1, line.x2), y = min(line.y1, line.y2); x <= max(line.x1, line.x2); x++, y++)
|
||||||
{
|
{
|
||||||
grid[x + y*grid_size]++;
|
grid[x + y*grid_size]++;
|
||||||
|
|
||||||
if (grid[x+y*grid_size] >= 2)
|
if (grid[x+y*grid_size] >= 2)
|
||||||
{
|
{
|
||||||
dangerous_locations.insert(x+y*grid_size);
|
dangerous_locations.insert(x+y*grid_size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for(int x = min(line.x1, line.x2), y = max(line.y1, line.y2); x <= max(line.x1, line.x2); x++, y--)
|
for(int x = min(line.x1, line.x2), y = max(line.y1, line.y2); x <= max(line.x1, line.x2); x++, y--)
|
||||||
{
|
{
|
||||||
grid[x + y*grid_size]++;
|
grid[x + y*grid_size]++;
|
||||||
|
|
||||||
if (grid[x+y*grid_size] >= 2)
|
if (grid[x+y*grid_size] >= 2)
|
||||||
{
|
{
|
||||||
dangerous_locations.insert(x+y*grid_size);
|
dangerous_locations.insert(x+y*grid_size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cout << dangerous_locations.size() << endl;
|
cout << dangerous_locations.size() << endl;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,33 +1,33 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
vector<int> fish(300);
|
vector<int> fish(300);
|
||||||
|
|
||||||
for(int i = 0; i < 300; i++) cin >> fish[i];
|
for(int i = 0; i < 300; i++) cin >> fish[i];
|
||||||
|
|
||||||
for(int i = 0; i < 80; i++)
|
for(int i = 0; i < 80; i++)
|
||||||
{
|
{
|
||||||
int new_fish_count = 0;
|
int new_fish_count = 0;
|
||||||
|
|
||||||
for(int j = 0; j < fish.size(); j++)
|
for(int j = 0; j < fish.size(); j++)
|
||||||
{
|
{
|
||||||
if (--fish[j] < 0)
|
if (--fish[j] < 0)
|
||||||
{
|
{
|
||||||
fish[j] = 6;
|
fish[j] = 6;
|
||||||
new_fish_count++;
|
new_fish_count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
vector<int> new_fish(new_fish_count, 8);
|
vector<int> new_fish(new_fish_count, 8);
|
||||||
|
|
||||||
fish.insert(fish.end(), new_fish.begin(), new_fish.end());
|
fish.insert(fish.end(), new_fish.begin(), new_fish.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
cout << fish.size() << endl;
|
cout << fish.size() << endl;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,33 +1,33 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
int next_fish;
|
int next_fish;
|
||||||
unsigned long long fish[9] = {0};
|
unsigned long long fish[9] = {0};
|
||||||
for(int i = 0; i < 300; i++)
|
for(int i = 0; i < 300; i++)
|
||||||
{
|
{
|
||||||
cin >> next_fish;
|
cin >> next_fish;
|
||||||
fish[next_fish]++;
|
fish[next_fish]++;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long long total_fish = 300;
|
unsigned long long total_fish = 300;
|
||||||
for(int i = 0; i < 256; i++)
|
for(int i = 0; i < 256; i++)
|
||||||
{
|
{
|
||||||
unsigned long long spawning_fish = fish[0];
|
unsigned long long spawning_fish = fish[0];
|
||||||
total_fish += spawning_fish;
|
total_fish += spawning_fish;
|
||||||
|
|
||||||
for(int j = 1; j < 9; j++)
|
for(int j = 1; j < 9; j++)
|
||||||
{
|
{
|
||||||
fish[j-1] = fish[j];
|
fish[j-1] = fish[j];
|
||||||
}
|
}
|
||||||
|
|
||||||
fish[6] += spawning_fish;
|
fish[6] += spawning_fish;
|
||||||
fish[8] = spawning_fish;
|
fish[8] = spawning_fish;
|
||||||
}
|
}
|
||||||
|
|
||||||
cout << total_fish << endl;
|
cout << total_fish << endl;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,23 +1,23 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
vector<int> crabs(1000);
|
vector<int> crabs(1000);
|
||||||
|
|
||||||
for(int i = 0; i < 1000; i++) cin >> crabs[i];
|
for(int i = 0; i < 1000; i++) cin >> crabs[i];
|
||||||
|
|
||||||
sort(crabs.begin(), crabs.end());
|
sort(crabs.begin(), crabs.end());
|
||||||
|
|
||||||
int final_position = round(((float)crabs[499]+(float)crabs[500])/2.0f);
|
int final_position = round(((float)crabs[499]+(float)crabs[500])/2.0f);
|
||||||
|
|
||||||
int fuel = 0;
|
int fuel = 0;
|
||||||
for(int i = 0; i < 1000; i++) fuel += (int)abs((float)final_position-crabs[i]);
|
for(int i = 0; i < 1000; i++) fuel += (int)abs((float)final_position-crabs[i]);
|
||||||
|
|
||||||
cout << fuel << endl;
|
cout << fuel << endl;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,31 +1,31 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
vector<int> crabs(1000);
|
vector<int> crabs(1000);
|
||||||
|
|
||||||
for(int i = 0; i < 1000; i++) cin >> crabs[i];
|
for(int i = 0; i < 1000; i++) cin >> crabs[i];
|
||||||
|
|
||||||
sort(crabs.begin(), crabs.end());
|
sort(crabs.begin(), crabs.end());
|
||||||
|
|
||||||
vector<int> costs(crabs[999],0);
|
vector<int> costs(crabs[999],0);
|
||||||
|
|
||||||
for(int i = 0; i < costs.size(); i++)
|
for(int i = 0; i < costs.size(); i++)
|
||||||
{
|
{
|
||||||
for(int j = 0; j < 1000; j++)
|
for(int j = 0; j < 1000; j++)
|
||||||
{
|
{
|
||||||
int diff = (int)abs((float)i-crabs[j]);
|
int diff = (int)abs((float)i-crabs[j]);
|
||||||
costs[i] += (diff*(diff+1))/2;
|
costs[i] += (diff*(diff+1))/2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sort(costs.begin(), costs.end());
|
sort(costs.begin(), costs.end());
|
||||||
|
|
||||||
cout << costs[0] << endl;
|
cout << costs[0] << endl;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,51 +1,51 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
struct Note
|
struct Note
|
||||||
{
|
{
|
||||||
string patterns[10];
|
string patterns[10];
|
||||||
string outputs[4];
|
string outputs[4];
|
||||||
|
|
||||||
friend istream &operator>>( istream &input, Note &n ) {
|
friend istream &operator>>( istream &input, Note &n ) {
|
||||||
for(int i = 0; i < 10; i++)
|
for(int i = 0; i < 10; i++)
|
||||||
{
|
{
|
||||||
input >> n.patterns[i];
|
input >> n.patterns[i];
|
||||||
}
|
}
|
||||||
for(int i = 0; i < 4; i++)
|
for(int i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
input >> n.outputs[i];
|
input >> n.outputs[i];
|
||||||
}
|
}
|
||||||
return input;
|
return input;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
Note note;
|
Note note;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
while (cin >> note)
|
while (cin >> note)
|
||||||
{
|
{
|
||||||
for(int i = 0; i < 4; i++)
|
for(int i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
switch(note.outputs[i].size())
|
switch(note.outputs[i].size())
|
||||||
{
|
{
|
||||||
case 2:
|
case 2:
|
||||||
case 3:
|
case 3:
|
||||||
case 4:
|
case 4:
|
||||||
case 7:
|
case 7:
|
||||||
count++;
|
count++;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cout << count << endl;
|
cout << count << endl;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,236 +1,236 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
struct compare_length {
|
struct compare_length {
|
||||||
inline bool operator()(const std::string& first,
|
inline bool operator()(const std::string& first,
|
||||||
const std::string& second) const
|
const std::string& second) const
|
||||||
{
|
{
|
||||||
return first.size() < second.size();
|
return first.size() < second.size();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Note
|
struct Note
|
||||||
{
|
{
|
||||||
array<string,10> patterns;
|
array<string,10> patterns;
|
||||||
array<string,4> outputs;
|
array<string,4> outputs;
|
||||||
|
|
||||||
friend istream &operator>>( istream &input, Note &n ) {
|
friend istream &operator>>( istream &input, Note &n ) {
|
||||||
for(int i = 0; i < 10; i++)
|
for(int i = 0; i < 10; i++)
|
||||||
{
|
{
|
||||||
input >> n.patterns[i];
|
input >> n.patterns[i];
|
||||||
sort(n.patterns[i].begin(), n.patterns[i].end());
|
sort(n.patterns[i].begin(), n.patterns[i].end());
|
||||||
}
|
}
|
||||||
compare_length c;
|
compare_length c;
|
||||||
sort(n.patterns.begin(), n.patterns.end(), c);
|
sort(n.patterns.begin(), n.patterns.end(), c);
|
||||||
sort(n.patterns.begin()+3,n.patterns.begin()+6);
|
sort(n.patterns.begin()+3,n.patterns.begin()+6);
|
||||||
sort(n.patterns.begin()+6,n.patterns.begin()+9);
|
sort(n.patterns.begin()+6,n.patterns.begin()+9);
|
||||||
for(int i = 0; i < 4; i++)
|
for(int i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
input >> n.outputs[i];
|
input >> n.outputs[i];
|
||||||
sort(n.outputs[i].begin(), n.outputs[i].end());
|
sort(n.outputs[i].begin(), n.outputs[i].end());
|
||||||
}
|
}
|
||||||
return input;
|
return input;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
Note note;
|
Note note;
|
||||||
int result = 0;
|
int result = 0;
|
||||||
for(int total_count = 0; total_count < 200; total_count++)
|
for(int total_count = 0; total_count < 200; total_count++)
|
||||||
{
|
{
|
||||||
cin >> note;
|
cin >> note;
|
||||||
int pattern_map[10] = {1,7,4,9,9,9,9,9,9,8};
|
int pattern_map[10] = {1,7,4,9,9,9,9,9,9,8};
|
||||||
vector<set<char>> pattern_sets(note.patterns.size());
|
vector<set<char>> pattern_sets(note.patterns.size());
|
||||||
for(int i = 0; i < note.patterns.size(); i++)
|
for(int i = 0; i < note.patterns.size(); i++)
|
||||||
{
|
{
|
||||||
set<char> cur_set;
|
set<char> cur_set;
|
||||||
for(int j = 0; j < note.patterns[i].size(); j++)
|
for(int j = 0; j < note.patterns[i].size(); j++)
|
||||||
{
|
{
|
||||||
cur_set.insert(note.patterns[i][j]);
|
cur_set.insert(note.patterns[i][j]);
|
||||||
}
|
}
|
||||||
pattern_sets[i] = cur_set;
|
pattern_sets[i] = cur_set;
|
||||||
}
|
}
|
||||||
|
|
||||||
set<char> top = pattern_sets[1];
|
set<char> top = pattern_sets[1];
|
||||||
for(set<char>::iterator it = pattern_sets[0].begin(); it != pattern_sets[0].end(); ++it) top.erase(*it);
|
for(set<char>::iterator it = pattern_sets[0].begin(); it != pattern_sets[0].end(); ++it) top.erase(*it);
|
||||||
|
|
||||||
set<char> middle = pattern_sets[2];
|
set<char> middle = pattern_sets[2];
|
||||||
for(set<char>::iterator it = pattern_sets[0].begin(); it != pattern_sets[0].end(); ++it) middle.erase(*it);
|
for(set<char>::iterator it = pattern_sets[0].begin(); it != pattern_sets[0].end(); ++it) middle.erase(*it);
|
||||||
set<char> left_top = middle;
|
set<char> left_top = middle;
|
||||||
for(set<char>::iterator it = middle.begin(); it != middle.end(); ++it)
|
for(set<char>::iterator it = middle.begin(); it != middle.end(); ++it)
|
||||||
{
|
{
|
||||||
while (middle.end() != it && (pattern_sets[3].end() == pattern_sets[3].find(*it) ||
|
while (middle.end() != it && (pattern_sets[3].end() == pattern_sets[3].find(*it) ||
|
||||||
pattern_sets[4].end() == pattern_sets[4].find(*it) ||
|
pattern_sets[4].end() == pattern_sets[4].find(*it) ||
|
||||||
pattern_sets[5].end() == pattern_sets[5].find(*it)))
|
pattern_sets[5].end() == pattern_sets[5].find(*it)))
|
||||||
{
|
{
|
||||||
it = middle.erase(it);
|
it = middle.erase(it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
left_top.erase(*middle.begin());
|
left_top.erase(*middle.begin());
|
||||||
|
|
||||||
set<char> bottom = pattern_sets[9];
|
set<char> bottom = pattern_sets[9];
|
||||||
for(set<char>::iterator it = pattern_sets[1].begin(); it != pattern_sets[1].end(); ++it) bottom.erase(*it);
|
for(set<char>::iterator it = pattern_sets[1].begin(); it != pattern_sets[1].end(); ++it) bottom.erase(*it);
|
||||||
for(set<char>::iterator it = pattern_sets[2].begin(); it != pattern_sets[2].end(); ++it) bottom.erase(*it);
|
for(set<char>::iterator it = pattern_sets[2].begin(); it != pattern_sets[2].end(); ++it) bottom.erase(*it);
|
||||||
|
|
||||||
set<char> left_bottom = bottom;
|
set<char> left_bottom = bottom;
|
||||||
|
|
||||||
for(set<char>::iterator it = bottom.begin(); it != bottom.end(); ++it)
|
for(set<char>::iterator it = bottom.begin(); it != bottom.end(); ++it)
|
||||||
{
|
{
|
||||||
while (bottom.end() != it && (pattern_sets[3].end() == pattern_sets[3].find(*it) ||
|
while (bottom.end() != it && (pattern_sets[3].end() == pattern_sets[3].find(*it) ||
|
||||||
pattern_sets[4].end() == pattern_sets[4].find(*it) ||
|
pattern_sets[4].end() == pattern_sets[4].find(*it) ||
|
||||||
pattern_sets[5].end() == pattern_sets[5].find(*it)))
|
pattern_sets[5].end() == pattern_sets[5].find(*it)))
|
||||||
{
|
{
|
||||||
it = bottom.erase(it);
|
it = bottom.erase(it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
left_bottom.erase(*bottom.begin());
|
left_bottom.erase(*bottom.begin());
|
||||||
|
|
||||||
set<char> x;
|
set<char> x;
|
||||||
for(int i = 6; i <= 8; i++)
|
for(int i = 6; i <= 8; i++)
|
||||||
{
|
{
|
||||||
if (pattern_sets[i].find(*middle.begin()) != pattern_sets[i].end() &&
|
if (pattern_sets[i].find(*middle.begin()) != pattern_sets[i].end() &&
|
||||||
pattern_sets[i].find(*left_bottom.begin()) != pattern_sets[i].end())
|
pattern_sets[i].find(*left_bottom.begin()) != pattern_sets[i].end())
|
||||||
{
|
{
|
||||||
x = pattern_sets[i];
|
x = pattern_sets[i];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
set<char> right_top = pattern_sets[0];
|
set<char> right_top = pattern_sets[0];
|
||||||
for(set<char>::iterator it = x.begin(); it != x.end(); ++it)
|
for(set<char>::iterator it = x.begin(); it != x.end(); ++it)
|
||||||
right_top.erase(*it);
|
right_top.erase(*it);
|
||||||
|
|
||||||
set<char> right_bottom = pattern_sets[0];
|
set<char> right_bottom = pattern_sets[0];
|
||||||
right_bottom.erase(*right_top.begin());
|
right_bottom.erase(*right_top.begin());
|
||||||
|
|
||||||
string zero = "";
|
string zero = "";
|
||||||
zero.append(1,*top.begin());
|
zero.append(1,*top.begin());
|
||||||
zero.append(1,*left_top.begin());
|
zero.append(1,*left_top.begin());
|
||||||
zero.append(1,*right_top.begin());
|
zero.append(1,*right_top.begin());
|
||||||
zero.append(1,*left_bottom.begin());
|
zero.append(1,*left_bottom.begin());
|
||||||
zero.append(1,*right_bottom.begin());
|
zero.append(1,*right_bottom.begin());
|
||||||
zero.append(1,*bottom.begin());
|
zero.append(1,*bottom.begin());
|
||||||
|
|
||||||
sort(zero.begin(),zero.end());
|
sort(zero.begin(),zero.end());
|
||||||
|
|
||||||
for(int i = 6; i <= 8; i++)
|
for(int i = 6; i <= 8; i++)
|
||||||
{
|
{
|
||||||
if (zero.compare(note.patterns[i]) == 0)
|
if (zero.compare(note.patterns[i]) == 0)
|
||||||
{
|
{
|
||||||
pattern_map[i] = 0;
|
pattern_map[i] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
string two = "";
|
string two = "";
|
||||||
two.append(1,*top.begin());
|
two.append(1,*top.begin());
|
||||||
two.append(1,*right_top.begin());
|
two.append(1,*right_top.begin());
|
||||||
two.append(1,*middle.begin());
|
two.append(1,*middle.begin());
|
||||||
two.append(1,*left_bottom.begin());
|
two.append(1,*left_bottom.begin());
|
||||||
two.append(1,*bottom.begin());
|
two.append(1,*bottom.begin());
|
||||||
|
|
||||||
sort(two.begin(), two.end());
|
sort(two.begin(), two.end());
|
||||||
|
|
||||||
for(int i = 3; i <= 5; i++)
|
for(int i = 3; i <= 5; i++)
|
||||||
{
|
{
|
||||||
if (two.compare(note.patterns[i]) == 0)
|
if (two.compare(note.patterns[i]) == 0)
|
||||||
{
|
{
|
||||||
pattern_map[i] = 2;
|
pattern_map[i] = 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
string three = "";
|
string three = "";
|
||||||
three.append(1,*top.begin());
|
three.append(1,*top.begin());
|
||||||
three.append(1,*right_top.begin());
|
three.append(1,*right_top.begin());
|
||||||
three.append(1,*middle.begin());
|
three.append(1,*middle.begin());
|
||||||
three.append(1,*right_bottom.begin());
|
three.append(1,*right_bottom.begin());
|
||||||
three.append(1,*bottom.begin());
|
three.append(1,*bottom.begin());
|
||||||
|
|
||||||
sort(three.begin(), three.end());
|
sort(three.begin(), three.end());
|
||||||
|
|
||||||
for(int i = 3; i <= 5; i++)
|
for(int i = 3; i <= 5; i++)
|
||||||
{
|
{
|
||||||
if (three.compare(note.patterns[i]) == 0)
|
if (three.compare(note.patterns[i]) == 0)
|
||||||
{
|
{
|
||||||
pattern_map[i] = 3;
|
pattern_map[i] = 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
string five = "";
|
string five = "";
|
||||||
five.append(1,*top.begin());
|
five.append(1,*top.begin());
|
||||||
five.append(1,*left_top.begin());
|
five.append(1,*left_top.begin());
|
||||||
five.append(1,*middle.begin());
|
five.append(1,*middle.begin());
|
||||||
five.append(1,*right_bottom.begin());
|
five.append(1,*right_bottom.begin());
|
||||||
five.append(1,*bottom.begin());
|
five.append(1,*bottom.begin());
|
||||||
|
|
||||||
sort(five.begin(), five.end());
|
sort(five.begin(), five.end());
|
||||||
|
|
||||||
for(int i = 3; i <= 5; i++)
|
for(int i = 3; i <= 5; i++)
|
||||||
{
|
{
|
||||||
if (five.compare(note.patterns[i]) == 0)
|
if (five.compare(note.patterns[i]) == 0)
|
||||||
{
|
{
|
||||||
pattern_map[i] = 5;
|
pattern_map[i] = 5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
string six = "";
|
string six = "";
|
||||||
six.append(1,*top.begin());
|
six.append(1,*top.begin());
|
||||||
six.append(1,*left_top.begin());
|
six.append(1,*left_top.begin());
|
||||||
six.append(1,*middle.begin());
|
six.append(1,*middle.begin());
|
||||||
six.append(1,*right_bottom.begin());
|
six.append(1,*right_bottom.begin());
|
||||||
six.append(1,*left_bottom.begin());
|
six.append(1,*left_bottom.begin());
|
||||||
six.append(1,*bottom.begin());
|
six.append(1,*bottom.begin());
|
||||||
|
|
||||||
sort(six.begin(), six.end());
|
sort(six.begin(), six.end());
|
||||||
|
|
||||||
for(int i = 6; i <= 8; i++)
|
for(int i = 6; i <= 8; i++)
|
||||||
{
|
{
|
||||||
if (six.compare(note.patterns[i]) == 0)
|
if (six.compare(note.patterns[i]) == 0)
|
||||||
{
|
{
|
||||||
pattern_map[i] = 6;
|
pattern_map[i] = 6;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i = 0; i < 10; i++)
|
for(int i = 0; i < 10; i++)
|
||||||
{
|
{
|
||||||
bool found = false;
|
bool found = false;
|
||||||
for(int j = 0; j < 10; j++)
|
for(int j = 0; j < 10; j++)
|
||||||
{
|
{
|
||||||
if (pattern_map[j] == i)
|
if (pattern_map[j] == i)
|
||||||
{
|
{
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!found)
|
if (!found)
|
||||||
{
|
{
|
||||||
cout << total_count << endl;
|
cout << total_count << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i = 0, m = 1000; i < 4; i++, m/=10)
|
for(int i = 0, m = 1000; i < 4; i++, m/=10)
|
||||||
{
|
{
|
||||||
for(int j = 0; j < 10; j++)
|
for(int j = 0; j < 10; j++)
|
||||||
{
|
{
|
||||||
if (0 == note.outputs[i].compare(note.patterns[j]))
|
if (0 == note.outputs[i].compare(note.patterns[j]))
|
||||||
{
|
{
|
||||||
result += m*pattern_map[j];
|
result += m*pattern_map[j];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cout << result << endl;
|
cout << result << endl;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
int main(int argc, char* argv[])
|
||||||
|
{
|
||||||
|
int height_map[100*100];
|
||||||
|
|
||||||
|
for(int i = 0; i < 100; i++)
|
||||||
|
{
|
||||||
|
string in;
|
||||||
|
cin >> in;
|
||||||
|
for(int j = 0; j < 100; j++)
|
||||||
|
{
|
||||||
|
height_map[j+i*100] = (int)in[j]-(int)'0';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int result = 0;
|
||||||
|
for(int i = 0; i < 100*100; i++)
|
||||||
|
{
|
||||||
|
if (i-100 >= 0 && height_map[i-100] <= height_map[i])
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (i+100 < 100*100 && height_map[i+100] <= height_map[i])
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (i-1 >= 0 && height_map[i-1] <= height_map[i])
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (i+1 < 100*100 && height_map[i+1] <= height_map[i])
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
result += height_map[i]+1;
|
||||||
|
}
|
||||||
|
|
||||||
|
cout << result << endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -0,0 +1,82 @@
|
||||||
|
#include <iostream>
|
||||||
|
#include <vector>
|
||||||
|
#include <queue>
|
||||||
|
#include <utility>
|
||||||
|
#include <set>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
int main(int argc, char* argv[])
|
||||||
|
{
|
||||||
|
int height_map[100*100];
|
||||||
|
|
||||||
|
for(int i = 0; i < 100; i++)
|
||||||
|
{
|
||||||
|
string in;
|
||||||
|
cin >> in;
|
||||||
|
for(int j = 0; j < 100; j++)
|
||||||
|
{
|
||||||
|
height_map[j+i*100] = (int)in[j]-(int)'0';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
vector<int> basins(3, 0);
|
||||||
|
for(int i = 0; i < 100*100; i++)
|
||||||
|
{
|
||||||
|
if (i-100 >= 0 && height_map[i-100] <= height_map[i])
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (i+100 < 100*100 && height_map[i+100] <= height_map[i])
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (i-1 >= 0 && height_map[i-1] <= height_map[i])
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (i+1 < 100*100 && height_map[i+1] <= height_map[i])
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
queue<pair<int,int>> to_explore;
|
||||||
|
to_explore.push(pair<int,int>(i-100,i));
|
||||||
|
to_explore.push(pair<int,int>(i+100,i));
|
||||||
|
to_explore.push(pair<int,int>(i-1,i));
|
||||||
|
to_explore.push(pair<int,int>(i+1,i));
|
||||||
|
set<int> basin;
|
||||||
|
basin.insert(i);
|
||||||
|
while(!to_explore.empty())
|
||||||
|
{
|
||||||
|
pair<int,int> cur = to_explore.front();
|
||||||
|
to_explore.pop();
|
||||||
|
|
||||||
|
if (cur.first < 0 || cur.first >= 100*100)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (height_map[cur.first] != 9 && height_map[cur.first] > height_map[cur.second])
|
||||||
|
{
|
||||||
|
pair<set<int>::iterator,bool> res = basin.insert(cur.first);
|
||||||
|
if (res.second)
|
||||||
|
{
|
||||||
|
to_explore.push(pair<int,int>(cur.first-100,cur.first));
|
||||||
|
to_explore.push(pair<int,int>(cur.first+100,cur.first));
|
||||||
|
to_explore.push(pair<int,int>(cur.first-1,cur.first));
|
||||||
|
to_explore.push(pair<int,int>(cur.first+1,cur.first));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
basins.push_back(basin.size());
|
||||||
|
sort(basins.begin(), basins.end());
|
||||||
|
basins.erase(basins.begin());
|
||||||
|
}
|
||||||
|
|
||||||
|
cout << basins[0]*basins[1]*basins[2] << endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue