Submission #1040921

#TimeUsernameProblemLanguageResultExecution timeMemory
1040921AndreyMagic Show (APIO24_show)C++17
100 / 100
2 ms832 KiB
#include "Alice.h" #include<bits/stdc++.h> using namespace std; std::vector<std::pair<int,int>> Alice(){ long long x = setN(5000); vector<pair<int,int>> haha(0); for(int i = 2; i <= 5000; i++) { haha.push_back({x%(i-1)+1,i}); } return haha; }
#include "Bob.h" #include<bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { if(b == 0) { return a; } return gcd(b,a%b); } long long lcm(long long a, long long b) { return (a/gcd(a,b))*b; } long long Bob(std::vector<std::pair<int,int>> haha){ long long c = 1,ost = 0; for(int i = 0; i < haha.size(); i++) { int a = haha[i].first,b = haha[i].second; if(a > b) { swap(a,b); } while(ost%(b-1) != a-1) { ost+=c; } c = lcm(c,b-1); } if(ost == 0) { return c; } else { return ost; } }

Compilation message (stderr)

Bob.cpp: In function 'long long int Bob(std::vector<std::pair<int, int> >)':
Bob.cpp:18:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |     for(int i = 0; i < haha.size(); i++) {
      |                    ~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...