제출 #1103656

#제출 시각아이디문제언어결과실행 시간메모리
1103656TVSownNaval battle (CEOI24_battle)C++17
컴파일 에러
0 ms0 KiB
///*** Sown_Vipro ***/// /// ->GIAI BA QUOC GIA<- /// #include<bits/stdc++.h> using namespace std; //#pragma GCC optimize ("O3") //#pragma GCC optimize ("unroll-loops") //#pragma GCC target("popcnt") #define F first #define S second #define pb push_back #define pi pair<int, int> #define pii pair<int, pair<int, int> > #define FOR(i, a, b) for(int i = a; i <= b; ++i) #define REP(i, a, b) for(int i = a; i >= b; --i) #define inp(name) if(fopen(name, "r")) freopen(name, "r", stdin); #define out(name) if(fopen(name, "w")) freopen(name, "w", stdout); #define szz(s) int(s.size()) const int N = 1e6 + 5, MAX = 1e6, oo = 1e9 + 5, MOD = 1e9 + 7; int n; int d[N]; struct node{ int x, y, t;p9 } p[N]; pi Find(node a, node b){ int l = a.y, r = (a.t == 1 ? oo : 0); if(l > r) swap(l, r); // cout << l << " " << r << "\n"; if(l <= b.y && b.y <= r) return {a.x, b.y}; return {-1, -1}; } int check(node a, node b){ if(a.t == b.t) return 0; if(a.t > b.t) swap(a, b); // cout << a.x << " " << a.y << " " << a.t << "\n"; // cout << b.x << " " << b.y << " " << b.t << "\n"; if(a.t == 1 && b.t == 2) return (a.x == b.x && a.y <= b.y); if(a.t == 3 && b.t == 4) return (a.y == b.y && a.x <= b.x); pi g = Find(a, b); if(g.F == -1) return 0; // cout << g.F << " " << g.S << "\n"; return abs(b.x - g.F) == abs(a.y - g.S); } void solve(){ cin >> n; FOR(i, 1, n){ char t; cin >> p[i].x >> p[i].y >> t; if(t == 'S') p[i].t = 1; if(t == 'N') p[i].t = 2; if(t == 'E') p[i].t = 3; if(t == 'W') p[i].t = 4; } // cout << check(p[1], p[7]); FOR(i, 1, n){ FOR(j, 1, i - 1){ if(check(p[i], p[j])){ // cout << i << " " << j << "\n"; d[i] = d[j] = 1; } } } // int c = 0; FOR(i, 1, n) if(!d[i]) cout << i << " "; // if(!c) cout << 0; } signed main(){ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); inp("in.txt"); int t = 1; // cin >> t; while(t--){ solve(); } }

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

Main.cpp:23:17: error: 'p9' does not name a type; did you mean 'pb'?
   23 |     int x, y, t;p9
      |                 ^~
      |                 pb
Main.cpp: In function 'int main()':
Main.cpp:16:47: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 | #define inp(name) if(fopen(name, "r")) freopen(name, "r", stdin);
      |                                        ~~~~~~~^~~~~~~~~~~~~~~~~~
Main.cpp:77:5: note: in expansion of macro 'inp'
   77 |     inp("in.txt");
      |     ^~~