Submission #90192

#TimeUsernameProblemLanguageResultExecution timeMemory
90192asifthegreatAliens (IOI07_aliens)C++14
Compilation error
0 ms0 KiB
//#include "Aliens.h" #include <bits/stdc++.h> using namespace std; #define debug(a) cout << #a << " = " << a << endl; //#define int long long //const int N = 1000; //bool mat[N][N]; //int NUMBER_OF_CHECKING = 0; //void initialize(int n,int m); bool check(int x,int y); /*void initialize(int m) { memset(mat,false,sizeof mat); for(int i = 5; i <= 5+m-1;i++){ //int i = 5; for(int j = 5; j <= 5+m-1;j++){ mat[i][j] = true; } for(int j = 15; j <= 15+m-1;j++){ mat[i][j] = true; } for(int j = 25; j <= 25+m-1;j++){ mat[i][j] = true; } } for(int i = 15; i <= 15+m-1;i++){ //int i = 5; for(int j = 5; j <= 5+m-1;j++){ mat[i][j] = true; } for(int j = 15; j <= 15+m-1;j++){ mat[i][j] = true; } for(int j = 25; j <= 25+m-1;j++){ mat[i][j] = true; } } for(int i = 25; i <= 25+m-1;i++){ //int i = 5; for(int j = 5; j <= 5+m-1;j++){ mat[i][j] = true; } for(int j = 15; j <= 15+m-1;j++){ mat[i][j] = true; } for(int j = 25; j <= 25+m-1;j++){ mat[i][j] = true; } } for(int i = 1; i <= 50;i++){ for(int j = 1; j <= 50;j++){ cout << mat[i][j] << " "; }cout << endl; } }*/ bool check(int x,int y) { string s; printf("examine %d %d\n",x,y); fflush(stdout); cin >> s; return s == "true"; /*NUMBER_OF_CHECKING++; if(NUMBER_OF_CHECKING > 300){ printf("Too many queries.. aborting\n"); exit(-1); } if(x < 1 or y < 1 or x > 10000 or y > 10000){ printf("cartesian point out of range\n mission aborting....\n"); printf("[%d %d]\n",x,y); exit(-1); } if(mat[x][y])return true; return false;*/ } int32_t main() { int n,m; scanf("%d %d ",&n,&m); //cin >> n >> m; //initialize(m); //cout << check(17,17) << endl; int x,y; scanf("%d %d",&x,&y); int lo = y,hi = y+m; int dan = -1,bam=-1,upore=-1,niche=-1; while(hi-lo > 2){ int mid=(lo+hi)/2; if(check(x,mid)){ dan = max(dan,mid); lo = mid+1; } else hi = mid-1; } for(int mid = lo;mid <= hi;mid++){ if(check(x,mid)){ dan = max(dan,mid); } } //debug(dan); if(dan+m*4 <= n and check(x,dan+m*4)){ dan = dan+m*4; } else if(dan + m* 2 <= n and check(x,dan+m*2))dan = dan+m*2; // dan clear hoyei gelo :-D lo = max(1ll,y-m); hi = y; bam = y; while(hi-lo > 2){ int mid=(lo+hi)/2; if(check(x,mid)){ bam = min(bam,mid); hi = mid-1; } else lo = mid+1; } for(int mid = lo;mid <= hi;mid++){ if(check(x,mid)){ bam = min(bam,mid); } } //printf("dan = %lld\nbam = %lld\n",dan,bam); if(bam-m*4 > 0 and check(x,bam-m*4)){ bam -= m*4; } else if(bam-m*2 > 0 and check(x,bam-m*2)){ bam -= m*2; } //printf("dan = %lld bam = %lld\n",dan,bam); // bam to hoyei gelo :-D hi = x; lo = max(1,x-m); upore = x; while(hi-lo > 2){ int mid=(lo+hi)/2; if(check(mid,y)){ upore = min(upore,mid); hi = mid-1; } else lo = mid+1; } for(int mid = lo;mid <= hi;mid++){ if(check(mid,y)){ upore = min(upore,mid); } } if(upore-m*4 > 0 and check(upore-m*4,y)){ upore -= m*4; } else if(upore-m*2 > 0 and check(upore-m*2,y)){ upore -= m*2; } niche = x; lo = x; hi = x+m; while(hi-lo > 2){ int mid=(lo+hi)/2; if(check(mid,y)){ niche = max(niche,mid); lo = mid+1; } else hi = mid-1; } for(int mid = lo;mid <= hi;mid++){ if(check(mid,y)){ niche = max(niche,mid); } } //debug(dan); if(niche+m*4 <= n and check(niche+m*4,y)){ niche = niche+m*4; } else if(niche + m* 2 <= n and check(niche+m*2,y))niche = niche+m*2; //printf("dan = %lld bam = %lld upore = %lld niche = %lld\n",dan,bam,upore,niche); x = (niche-upore)/2 + m; y = (dan-bam)/2 + m; printf("solution %d %d\n",x,y); fflush(stdout); return 0; }

Compilation message (stderr)

aliens.cpp: In function 'int32_t main()':
aliens.cpp:119:18: error: no matching function for call to 'max(long long int, int)'
  lo = max(1ll,y-m);
                  ^
In file included from /usr/include/c++/7/bits/char_traits.h:39:0,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/istream:38,
                 from /usr/include/c++/7/sstream:38,
                 from /usr/include/c++/7/complex:45,
                 from /usr/include/c++/7/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
                 from aliens.cpp:2:
/usr/include/c++/7/bits/stl_algobase.h:219:5: note: candidate: template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)
     max(const _Tp& __a, const _Tp& __b)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:219:5: note:   template argument deduction/substitution failed:
aliens.cpp:119:18: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
  lo = max(1ll,y-m);
                  ^
In file included from /usr/include/c++/7/bits/char_traits.h:39:0,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/istream:38,
                 from /usr/include/c++/7/sstream:38,
                 from /usr/include/c++/7/complex:45,
                 from /usr/include/c++/7/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
                 from aliens.cpp:2:
/usr/include/c++/7/bits/stl_algobase.h:265:5: note: candidate: template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)
     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:265:5: note:   template argument deduction/substitution failed:
aliens.cpp:119:18: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
  lo = max(1ll,y-m);
                  ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from aliens.cpp:2:
/usr/include/c++/7/bits/stl_algo.h:3462:5: note: candidate: template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)
     max(initializer_list<_Tp> __l)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3462:5: note:   template argument deduction/substitution failed:
aliens.cpp:119:18: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
  lo = max(1ll,y-m);
                  ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from aliens.cpp:2:
/usr/include/c++/7/bits/stl_algo.h:3468:5: note: candidate: template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)
     max(initializer_list<_Tp> __l, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3468:5: note:   template argument deduction/substitution failed:
aliens.cpp:119:18: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
  lo = max(1ll,y-m);
                  ^
aliens.cpp:91:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d ",&n,&m);
  ~~~~~^~~~~~~~~~~~~~~~
aliens.cpp:96:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d",&x,&y);
  ~~~~~^~~~~~~~~~~~~~~