제출 #247364

#제출 시각아이디문제언어결과실행 시간메모리
247364errorgornMouse (info1cup19_mouse)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "grader.h" using namespace std; #define ll long long #define fi first #define se second #define rep(x,s,e) for (auto x=s-(s>e);x!=e-(s>e);(s<e?x++:x--)) #define all(x) (x).begin(),(x).end() #define sz(x) (int)(x).size() mt19937 rng (42069); set<ii> tested; void solve(int n){ vector<int> v; rep(x,1,n+1){ v.push_back(x); } int curr=query(v); while (curr!=n){ int i,j; do{ i=rng()%n,j=rng()%n; if (i>j) swap(i,j); } while (i==j && !tested.count(ii(i,j)); swap(v[i],v[j]); int temp=query(v); if (temp<curr){ swap(v[i],v[j]); tested.insert(ii(i,j)); } else{ tested.clear(); curr=temp; } } }

컴파일 시 표준 에러 (stderr) 메시지

mouse.cpp:14:5: error: 'ii' was not declared in this scope
 set<ii> tested;
     ^~
mouse.cpp:14:5: note: suggested alternative: 'fi'
 set<ii> tested;
     ^~
     fi
mouse.cpp:14:7: error: template argument 1 is invalid
 set<ii> tested;
       ^
mouse.cpp:14:7: error: template argument 2 is invalid
mouse.cpp:14:7: error: template argument 3 is invalid
mouse.cpp: In function 'void solve(int)':
mouse.cpp:31:28: error: request for member 'count' in 'tested', which is of non-class type 'int'
   } while (i==j && !tested.count(ii(i,j));
                            ^~~~~
mouse.cpp:31:34: error: 'ii' was not declared in this scope
   } while (i==j && !tested.count(ii(i,j));
                                  ^~
mouse.cpp:31:34: note: suggested alternative: 'i'
   } while (i==j && !tested.count(ii(i,j));
                                  ^~
                                  i
mouse.cpp:31:42: error: expected ')' before ';' token
   } while (i==j && !tested.count(ii(i,j));
                                          ^
mouse.cpp:37:11: error: request for member 'insert' in 'tested', which is of non-class type 'int'
    tested.insert(ii(i,j));
           ^~~~~~
mouse.cpp:40:11: error: request for member 'clear' in 'tested', which is of non-class type 'int'
    tested.clear();
           ^~~~~