Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- using namespace std;
- ifstream fin("distanta.in");
- ofstream fout("distanta.out");
- int dmax=0,poz=0,pozi[100000],pozj[100000],x;
- int main()
- {
- while(fin>>x)
- {
- ++poz;
- if(pozi[x]==0) pozi[x]=poz;
- else {pozj[x]=poz;
- if(pozj[x]-pozi[x]>dmax) dmax=pozj[x]-pozi[x];}
- }
- fout<<dmax;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement