Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- bool isDiag = false;
- int N;
- void fill(vector<int> &li, int va){
- int beg = va - 2;
- if(beg < 1) beg = N + beg ;
- //if(isDiag) cout <<"va: " << va << ", beg: " << beg << endl;
- for (int i = 0; i < 5; i++)
- {
- int next = beg + i;
- if(next > N){
- next = next % N;
- }
- if(next == 0) {
- //!!!problem must not contain 0
- next = 1;
- }
- li.push_back(next);
- }
- }
- int main(){
- //isDiag = true;
- if (isDiag)
- {
- freopen( "P7 combo/3.in", "r", stdin);
- }else{
- freopen( "combo.in", "r", stdin);
- }
- int ans = 0;
- cin >> N ;
- vector<int> j1 ;
- vector<int> j2 ;
- vector<int> j3 ;
- vector<int> m1 ;
- vector<int> m2 ;
- vector<int> m3 ;
- int v1, v2, v3;
- cin >> v1 >> v2 >> v3;
- fill(j1, v1);
- fill(j2, v2);
- fill(j3, v3);
- cin >> v1 >> v2 >> v3;
- fill(m1, v1);
- fill(m2, v2);
- fill(m3, v3);
- set<string> dat ;
- for (int i = 0; i < 5; i++)
- {
- for (int j = 0; j < 5; j++)
- {
- for (int k = 0; k < 5; k++)
- {
- string jmix = to_string(j1[i])+to_string(j2[j])+to_string(j3[k]);
- string mmix = to_string(m1[i])+to_string(m2[j])+to_string(m3[k]);
- if(isDiag) cout << "j mix: " << jmix << ", m mix: " << mmix << endl;
- dat.insert(jmix);
- dat.insert(mmix);
- }
- }
- //if(isDiag) cout << "j1-" << i << ": " << j1[i] << ", j2-" << i << ": " << j2[i] << endl;
- }
- ans = dat.size();
- if(!isDiag) freopen("combo.out", "w", stdout);
- cout << ans << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement