-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
162 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
//#include<iostream> | ||
//#include<queue> | ||
//using namespace std; | ||
// | ||
//typedef struct | ||
//{ | ||
// int y; | ||
// int x; | ||
//}Pos; | ||
// | ||
//int arr[51][51]; | ||
// | ||
//int N, M; | ||
//int curY, curX, curD; | ||
//int result = 0; | ||
// | ||
//Pos moveDir[] = { {-1, 0}, {0, 1}, {1, 0}, {0, -1} }; | ||
//Pos backDir[] = { {1, 0},{0, -1},{-1, 0},{0, 1} }; | ||
// | ||
//void DFS(Pos pos, int curD) | ||
//{ | ||
// | ||
// if (arr[pos.y][pos.x] == 1) | ||
// { | ||
// return; | ||
// } | ||
// if (arr[pos.y][pos.x] == 0) | ||
// { | ||
// arr[pos.y][pos.x] = 2; | ||
// result++; | ||
// } | ||
// | ||
// for (int i = 0; i < 4; i++) | ||
// { | ||
// int nextD = (curD - 1 == -1) ? 3 : curD - 1; | ||
// | ||
// int nextY = pos.y + moveDir[nextD].y; | ||
// int nextX = pos.x + moveDir[nextD].x; | ||
// | ||
// if (arr[nextY][nextX] == 0) | ||
// { | ||
// DFS({ nextY, nextX }, nextD); | ||
// return; | ||
// } | ||
// else | ||
// { | ||
// curD = nextD; | ||
// } | ||
// } | ||
// | ||
// //int backY = pos.y + (moveDir[(curD + 2) % 4].y); | ||
// //int backX = pos.x + (moveDir[(curD + 2) % 4].x); | ||
// int backY = pos.y + backDir[curD].y; | ||
// int backX = pos.x + backDir[curD].x; | ||
// | ||
// | ||
// DFS({ backY, backX }, curD); | ||
// | ||
// | ||
//} | ||
// | ||
//int main(void) | ||
//{ | ||
// cin >> N >> M; | ||
// | ||
// cin >> curY >> curX >> curD; | ||
// | ||
// for (int i = 0; i < N; i++) | ||
// { | ||
// for (int j = 0; j < M; j++) | ||
// { | ||
// cin >> arr[i][j]; | ||
// } | ||
// } | ||
// | ||
// DFS({ curY, curX }, curD); | ||
// | ||
// cout << result; | ||
// | ||
// return 0; | ||
//} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
//#include<iostream> | ||
//#include<cstdio> | ||
//#include<vector> | ||
//#include<queue> | ||
//using namespace std; | ||
// | ||
//int number = 6; | ||
//int INF = 1000000000; | ||
// | ||
//vector<pair<int, int>> a[20001]; | ||
//int distanceArr[20001]; | ||
// | ||
//int V, E, startIdx; | ||
// | ||
////time out bitch | ||
////cin vs scanf | ||
// | ||
//void dijkstra() | ||
//{ | ||
// distanceArr[startIdx] = 0; | ||
// priority_queue<pair<int, int>> pq; | ||
// | ||
// pq.push(make_pair(0, startIdx)); | ||
// | ||
// while (!pq.empty()) | ||
// { | ||
// int current = pq.top().second; | ||
// int distances = -pq.top().first; | ||
// pq.pop(); | ||
// | ||
// if (distanceArr[current] < distances) | ||
// { | ||
// continue; | ||
// } | ||
// | ||
// for (int i = 0; i < a[current].size(); i++) | ||
// { | ||
// int next = a[current][i].first; | ||
// int nextDis = a[current][i].second; | ||
// | ||
// if (nextDis + distances < distanceArr[next]) | ||
// { | ||
// distanceArr[next] = nextDis + distances; | ||
// pq.push(make_pair(-distanceArr[next], next)); | ||
// } | ||
// } | ||
// } | ||
// | ||
// for (int i = 1; i <= V; i++) | ||
// { | ||
// if (distanceArr[i] == INF) | ||
// { | ||
// printf("INF\n"); | ||
// } | ||
// else | ||
// { | ||
// printf("%d\n", distanceArr[i]); | ||
// } | ||
// } | ||
//} | ||
// | ||
//int main(void) | ||
//{ | ||
// scanf("%d %d %d", &V, &E, &startIdx); | ||
// | ||
// for (int i = 1; i <= V; i++) | ||
// { | ||
// distanceArr[i] = INF; | ||
// } | ||
// | ||
// for (int i = 0; i < E; i++) | ||
// { | ||
// int t_u, t_v, t_w; | ||
// scanf("%d %d %d", &t_u, &t_v, &t_w); | ||
// a[t_u].push_back(make_pair(t_v, t_w)); | ||
// } | ||
// | ||
// dijkstra(); | ||
// | ||
// return 0; | ||
//} |